author | Stefan Vogel <sv@exept.de> |
Fri, 31 Mar 2017 11:39:12 +0200 | |
changeset 17485 | 03eb18e3a5f6 |
parent 17481 | a2fe1e2e1727 |
child 17582 | e12643cd5864 |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
15211 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
"{ NameSpace: Smalltalk }" |
|
15 |
||
16 |
ApplicationModel subclass:#AbstractFileBrowser |
|
17 |
instanceVariableNames:'aspects' |
|
16720 | 18 |
classVariableNames:'CommandHistory CommandHistorySize DefaultCommandPerSuffix |
19 |
DefaultFilters DirectoryBookmarks LastEnforcedNameSpace |
|
20 |
LastFileDiffDirectory LastFileDiffFile LastFileSelection |
|
21 |
LastMercurialRepository LastMoveDestination LastMustMatchPattern |
|
22 |
LastScriptBlockString RootHolder RuntimeAspects |
|
23 |
VisitedDirectories' |
|
15211 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Tools-File' |
|
26 |
! |
|
3892 | 27 |
|
28 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
29 |
||
30 |
" |
|
31 |
The following class instance variables are inherited by this class: |
|
32 |
||
14126 | 33 |
ApplicationModel - ClassResources |
34 |
Model - |
|
35 |
Object - |
|
3892 | 36 |
" |
37 |
! |
|
38 |
||
39 |
Object subclass:#Clipboard |
|
14126 | 40 |
instanceVariableNames:'method files' |
41 |
classVariableNames:'' |
|
42 |
poolDictionaries:'' |
|
43 |
privateIn:AbstractFileBrowser |
|
3892 | 44 |
! |
45 |
||
46 |
Object subclass:#CodeExecutionLock |
|
14126 | 47 |
instanceVariableNames:'locked' |
48 |
classVariableNames:'' |
|
49 |
poolDictionaries:'' |
|
50 |
privateIn:AbstractFileBrowser |
|
3892 | 51 |
! |
52 |
||
4366 | 53 |
List subclass:#DirectoryHistory |
14126 | 54 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
55 |
backForwardList backForwardIndex historySize' |
|
56 |
classVariableNames:'HistorySize' |
|
57 |
poolDictionaries:'' |
|
58 |
privateIn:AbstractFileBrowser |
|
3952 | 59 |
! |
60 |
||
61 |
Object subclass:#DirectoryHistoryItem |
|
14126 | 62 |
instanceVariableNames:'path position' |
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 66 |
! |
67 |
||
68 |
Object subclass:#SaveAspectItem |
|
14126 | 69 |
instanceVariableNames:'value isHolder' |
70 |
classVariableNames:'' |
|
71 |
poolDictionaries:'' |
|
72 |
privateIn:AbstractFileBrowser |
|
3892 | 73 |
! |
74 |
||
5140 | 75 |
!AbstractFileBrowser class methodsFor:'documentation'! |
76 |
||
77 |
copyright |
|
78 |
" |
|
79 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
80 |
All Rights Reserved |
|
81 |
||
82 |
This software is furnished under a license and may be used |
|
83 |
only in accordance with the terms of that license and with the |
|
84 |
inclusion of the above copyright notice. This software may not |
|
85 |
be provided or otherwise made available to, or used by, any |
|
86 |
other person. No title to or ownership of the software is |
|
87 |
hereby transferred. |
|
88 |
" |
|
5967 | 89 |
! |
90 |
||
91 |
documentation |
|
92 |
" |
|
93 |
[Author:] |
|
94 |
Christian Penk |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
95 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
96 |
Notice: this certainly needs a redesign - all those abstract-abstract classes which |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
97 |
define stuff which is only needed in some parts makes this hard to understand. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
Especially the fact, that AbstractFileBrowser defines things both as abstract superclass |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
99 |
and as a container is almost incomprehensable... |
5967 | 100 |
" |
5140 | 101 |
! ! |
3892 | 102 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
103 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 104 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
105 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
106 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
107 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
108 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
109 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
110 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
111 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
112 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
113 |
currentSelection:aFilenameCol |
6589 | 114 |
aFilenameCol notEmptyOrNil ifTrue:[ |
12102 | 115 |
LastFileSelection := aFilenameCol collect:[:file | (file ? '') asFilename] |
6589 | 116 |
] |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
117 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
118 |
|
3952 | 119 |
directoryHistory |
120 |
||
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
121 |
VisitedDirectories isNil ifTrue:[ |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
122 |
VisitedDirectories := self directoryHistoryClass new. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
123 |
"/ VisitedDirectories inspect. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
124 |
]. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
125 |
^ VisitedDirectories |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
126 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
127 |
"Modified: / 21-11-2012 / 08:45:49 / cg" |
3952 | 128 |
! |
129 |
||
130 |
resetClassVars |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
131 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
132 |
LastFileSelection := nil. |
5936 | 133 |
|
134 |
" |
|
135 |
AbstractFileBrowser resetClassVars |
|
136 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
137 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
138 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
139 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
140 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
141 |
rootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
142 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
143 |
^ RootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
144 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
145 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
146 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
147 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
148 |
RootHolder := aRoot |
3952 | 149 |
! ! |
150 |
||
4915 | 151 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
152 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
153 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
154 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
155 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
156 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
157 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
158 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
159 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
160 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
161 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
162 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
163 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
164 |
|
8013 | 165 |
bookmarksFrom:aFileNameOrString |
12390 | 166 |
|bookmarks s fileName line| |
8013 | 167 |
|
168 |
fileName := aFileNameOrString asFilename. |
|
169 |
[ |
|
170 |
s := fileName readStream. |
|
171 |
] on:OpenError do:[:ex| |
|
172 |
^ nil. |
|
173 |
]. |
|
174 |
||
175 |
bookmarks := OrderedCollection new. |
|
176 |
[s atEnd] whileFalse:[ |
|
12390 | 177 |
line := s nextLine. |
178 |
(line startsWith:';') ifFalse:[ |
|
179 |
bookmarks add:(Base64Coder decode:line) asString. |
|
180 |
] |
|
8013 | 181 |
]. |
182 |
s close. |
|
183 |
||
184 |
^ bookmarks |
|
185 |
! |
|
186 |
||
4679 | 187 |
defaultBookMarksFileDirectory |
12390 | 188 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
189 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
190 |
^ Filename homeDirectory |
4679 | 191 |
! |
192 |
||
193 |
defaultBookMarksFilename |
|
12390 | 194 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
195 |
||
4679 | 196 |
^ '.fileBrowserBookmarks' |
197 |
! |
|
198 |
||
199 |
directoryBookmarks |
|
200 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
201 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 202 |
|
203 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
204 |
DirectoryBookmarks := OrderedCollection new. |
|
205 |
DirectoryBookmarks add:Filename homeDirectory asAbsoluteFilename. |
|
206 |
DirectoryBookmarks add:Filename currentDirectory asAbsoluteFilename. |
|
207 |
] |
|
208 |
]. |
|
209 |
^ DirectoryBookmarks |
|
210 |
||
211 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
212 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
213 |
self directoryBookmarks. |
4679 | 214 |
" |
215 |
! |
|
216 |
||
8013 | 217 |
directoryBookmarks: collectionOfFilenames |
218 |
||
219 |
DirectoryBookmarks := collectionOfFilenames. |
|
220 |
self saveBookmarksInDefaultBookmarksFile. |
|
221 |
! |
|
222 |
||
223 |
editBookmarksWithDefault: aFilenameOrNil |
|
224 |
| oldBookmarks newBookmarks | |
|
225 |
||
226 |
oldBookmarks := self directoryBookmarks copy. |
|
227 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
228 |
newBookmarks isNil ifTrue:[^ self]. |
|
229 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
230 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
231 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 232 |
! |
233 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
234 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
235 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
236 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
237 |
|
4679 | 238 |
loadBookmarksFrom:aFileNameOrString |
8013 | 239 |
|bookmarks| |
240 |
||
241 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
242 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 243 |
|
244 |
DirectoryBookmarks := OrderedCollection new. |
|
245 |
bookmarks do:[:eachPath | |
|
246 |
self addBookmark:eachPath asFilename |
|
247 |
]. |
|
248 |
! |
|
249 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
250 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
251 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
252 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
253 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
254 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
255 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
256 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 257 |
! |
258 |
||
259 |
saveBookmarks |
|
260 |
|fn| |
|
261 |
||
262 |
fn := Dialog |
|
9607 | 263 |
requestFileNameForSave:(self resources string:'Save Bookmarks') |
4679 | 264 |
default:(self defaultBookMarksFilename) |
265 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
266 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
267 |
||
268 |
self saveBookmarksIn:fn |
|
9607 | 269 |
|
270 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
4679 | 271 |
! |
272 |
||
8013 | 273 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
274 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
275 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
276 |
|
13683 | 277 |
|bookmarkStream fileName coder| |
4679 | 278 |
|
279 |
fileName := aFileNameOrString asFilename. |
|
280 |
fileName exists ifTrue:[ |
|
13683 | 281 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 282 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
283 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
284 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
285 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
286 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 287 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
288 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
289 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
290 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
291 |
]. |
12391 | 292 |
bookmarkStream syncData; close. |
5960 | 293 |
! |
294 |
||
8013 | 295 |
saveBookmarksIn:aFileNameOrString |
296 |
"save the bokmarks in aFileNameOrString. |
|
297 |
Use Base64 coding" |
|
298 |
||
299 |
| bookmarks | |
|
300 |
||
301 |
bookmarks := self directoryBookmarks. |
|
302 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
303 |
! |
|
304 |
||
5960 | 305 |
saveBookmarksInDefaultBookmarksFile |
306 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
307 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
308 |
|
4915 | 309 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
310 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
311 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
312 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
313 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
314 |
"Modified: / 21-11-2012 / 08:46:34 / cg" |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
315 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
316 |
|
3892 | 317 |
!AbstractFileBrowser class methodsFor:'defaults'! |
318 |
||
319 |
commandHistory |
|
320 |
||
321 |
CommandHistory isNil ifTrue:[ |
|
4414 | 322 |
CommandHistory := OrderedCollection new. |
3892 | 323 |
]. |
324 |
^ CommandHistory |
|
325 |
! |
|
326 |
||
327 |
commandHistorySize |
|
4190 | 328 |
"max no of entries in the HistoryList " |
6369 | 329 |
|
3892 | 330 |
CommandHistorySize isNil ifTrue:[ |
6369 | 331 |
CommandHistorySize := 150 |
3892 | 332 |
]. |
333 |
^ CommandHistorySize |
|
334 |
! |
|
335 |
||
336 |
defaultFilterList |
|
337 |
||
338 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 339 |
DefaultFilters := #( '*' |
340 |
'*.st' |
|
341 |
'*.[h,c]*' |
|
12760 | 342 |
'*.txt; *.htm*' |
343 |
'*.gif; *.xpm; *.jpg; *.png' |
|
344 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 345 |
) |
3892 | 346 |
]. |
347 |
^ DefaultFilters. |
|
12760 | 348 |
|
349 |
" |
|
350 |
DefaultFilters := nil |
|
351 |
" |
|
3892 | 352 |
! |
353 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
354 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
355 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
356 |
|
4523 | 357 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
358 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
359 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
360 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
361 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
362 |
|
16160 | 363 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
364 |
cmd notNil ifTrue:[ |
|
365 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
366 |
^ self |
|
367 |
]. |
|
368 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
369 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
370 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
371 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
372 |
"/ ]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
373 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
374 |
"/ XXX should be changed to take stuff from a config file |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
375 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
376 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
377 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
378 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
379 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
380 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
381 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
382 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
383 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
384 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
385 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
386 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
387 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
388 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
389 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
390 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
391 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
392 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
393 |
cmd := MIMETypes defaultCommandPerMIME at:mime ifAbsent:nil. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
394 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
395 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
396 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
397 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
398 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
399 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
400 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
401 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
402 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
403 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
404 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
405 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
406 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
408 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
409 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
410 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
411 |
cmd := 'tar tvf %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
412 |
select := 7. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
413 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
414 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
415 |
cmd := 'zoo -list %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
416 |
select := 9. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
417 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
418 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
419 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
420 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
421 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
422 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
424 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
427 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
429 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
430 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
431 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
432 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
433 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
434 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
435 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
436 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
437 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
442 |
(suffix = 'html') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
445 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
449 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
450 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
454 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
(suffix = 'xbm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
460 |
cmd := 'bitmap %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
461 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
462 |
(suffix = 'ps') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
463 |
cmd := 'ghostview %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
464 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
465 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
cmd := 'nroff -man %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
select := 10. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
468 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
469 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
470 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
471 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
472 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
473 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
474 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
|
4523 | 483 |
pathName := path pathName. |
484 |
OperatingSystem isUNIXlike ifTrue:[ |
|
485 |
pathName includesSeparator ifTrue:[ |
|
486 |
pathName := '"' , pathName , '"' |
|
487 |
] |
|
488 |
]. |
|
489 |
||
490 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
492 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
493 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
494 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
495 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
496 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
497 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
3892 | 507 |
! |
508 |
||
5941 | 509 |
listOfRuntimeValuesToRemember |
510 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
511 |
||
512 |
^ #( |
|
513 |
"/ #filterModel |
|
514 |
#enableFileHistory |
|
515 |
#fileHistory |
|
516 |
#currentSortOrder |
|
517 |
#sortBlockProperty |
|
518 |
) |
|
3892 | 519 |
! |
520 |
||
521 |
resetAspects |
|
522 |
||
523 |
RuntimeAspects := nil. |
|
524 |
||
5941 | 525 |
" |
526 |
self resetAspects |
|
527 |
" |
|
3892 | 528 |
! |
529 |
||
530 |
runtimeAspects |
|
531 |
||
532 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 533 |
RuntimeAspects := Dictionary new. |
3892 | 534 |
]. |
535 |
^ RuntimeAspects |
|
536 |
! |
|
537 |
||
4201 | 538 |
userPreferencesAspectList |
539 |
" list of all aspects that will be saved with save settings |
|
540 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 541 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 542 |
" |
543 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
544 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
545 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
546 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
547 |
showDirectoryTree true |
11501 | 548 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
549 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
550 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
551 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
552 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
553 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
554 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
555 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
556 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
557 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
558 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
559 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
560 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
561 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
562 |
openMultipleApplicationsForType false |
7788 | 563 |
filenameEntryFieldVisibleHolder true |
564 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
565 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
566 |
openAlwaysInTextEditor false |
15111 | 567 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
568 |
sortCaseless false |
13011 | 569 |
"/ useCodeView2InTools true -- vanishes |
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
570 |
showDirectoriesOnTop false |
4201 | 571 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
572 |
|
11501 | 573 |
"Modified: / 11-05-2012 / 09:22:04 / cg" |
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
574 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 575 |
! ! |
576 |
||
17202 | 577 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
578 |
||
579 |
doStartDrag:aDropSource in:aView |
|
580 |
"set the cursors before starting the drag & drop operation" |
|
581 |
||
582 |
|hdl| |
|
583 |
||
584 |
hdl := DragAndDropManager new. |
|
585 |
||
586 |
hdl disabledCursor:self disabledCursorIcon. |
|
587 |
hdl enabledCursor:self enabledCursorIcon. |
|
588 |
hdl alienCursor:nil. |
|
589 |
||
590 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
591 |
||
592 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
593 |
! ! |
|
594 |
||
5398 | 595 |
!AbstractFileBrowser class methodsFor:'help specs'! |
596 |
||
8261 | 597 |
basicFlyByHelpSpec |
6099 | 598 |
<resource: #help> |
599 |
||
8261 | 600 |
^ super flyByHelpSpec addPairsFrom:#( |
6099 | 601 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
602 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
603 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
604 |
|
6100 | 605 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
606 |
'Close this tab' |
6100 | 607 |
|
6099 | 608 |
#addTerminal |
17182 | 609 |
'Add a shell terminal page' |
6099 | 610 |
|
611 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
612 |
'Call the make command' |
6099 | 613 |
|
614 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
615 |
'Search a file' |
6099 | 616 |
|
617 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
618 |
'Directory up' |
6099 | 619 |
|
620 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
621 |
'Directory back' |
6099 | 622 |
|
623 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
624 |
'Directory forward' |
6099 | 625 |
|
626 |
#directoryHistory |
|
627 |
'Directory' |
|
628 |
||
629 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
630 |
'Copy the selected file(s)' |
6099 | 631 |
|
632 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
633 |
'Cut the selected file(s)' |
6099 | 634 |
|
635 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
636 |
'Edit the selected file' |
6099 | 637 |
|
638 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
639 |
'Goto home directory' |
6099 | 640 |
|
8093 | 641 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
642 |
'Goto desktop directory' |
8093 | 643 |
|
6099 | 644 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
645 |
'Goto default directory (ST/X start directory)' |
6099 | 646 |
|
6454 | 647 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
648 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 649 |
|
6456 | 650 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
651 |
'Goto current directory' |
6456 | 652 |
|
6099 | 653 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
654 |
'Paste file(s)' |
6099 | 655 |
|
656 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
657 |
'Delete the selected file(s)' |
6099 | 658 |
|
659 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
660 |
'File in' |
6099 | 661 |
|
662 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
663 |
'File history' |
6099 | 664 |
|
665 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
666 |
'Goto bookmarked directory' |
6099 | 667 |
|
668 |
#hideToolBar |
|
13910 | 669 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 670 |
|
671 |
#hideFilenameEntryField |
|
13910 | 672 |
'Hide filename & filter fields (show again via "View"-menu)' |
673 |
||
674 |
#hideBookmarks |
|
675 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 676 |
|
677 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
678 |
'Open a Changebrowser on file' |
6099 | 679 |
|
680 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
681 |
'Show file details' |
6099 | 682 |
|
683 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
684 |
'Hide file details' |
6099 | 685 |
|
686 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
687 |
'Show/hide file details' |
6099 | 688 |
|
689 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
690 |
'Show/hide file details' |
6099 | 691 |
|
692 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
693 |
'Select file details to be shown' |
6099 | 694 |
|
8088 | 695 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
696 |
'Show differences between file and editor versions' |
8088 | 697 |
|
698 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
699 |
'Toggle between hexadecimal and textual representation' |
8088 | 700 |
|
701 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
702 |
'Navigate the browser''s file list to the edited file' |
8088 | 703 |
|
704 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
705 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
706 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
707 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
708 |
'Save the editor''s contents into another file' |
8088 | 709 |
|
710 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
711 |
'Reload from the file' |
8088 | 712 |
|
713 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
714 |
'Send to the printer' |
8088 | 715 |
|
6099 | 716 |
). |
717 |
||
8261 | 718 |
" |
719 |
self flyByHelpSpec |
|
720 |
" |
|
721 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
722 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 723 |
! |
724 |
||
725 |
flyByHelpSpec |
|
726 |
<resource: #programHelp> |
|
727 |
||
728 |
|spec hist resources| |
|
729 |
||
730 |
spec := self basicFlyByHelpSpec. |
|
731 |
||
732 |
"/ add help items for the history |
|
6099 | 733 |
hist := self directoryHistory. |
734 |
hist notNil ifTrue:[ |
|
735 |
resources := self classResources. |
|
736 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
737 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 738 |
]. |
739 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
740 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 741 |
]. |
742 |
]. |
|
743 |
^ spec. |
|
744 |
||
745 |
" |
|
746 |
self flyByHelpSpec |
|
747 |
" |
|
748 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
749 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 750 |
! ! |
751 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
752 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
753 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
754 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
755 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
756 |
|
17413 | 757 |
^ ToolbarIconLibrary deleteIcon |
758 |
"/ ^ Icon deleteIcon |
|
759 |
||
760 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
761 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
762 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
763 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
764 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
765 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
766 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
767 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
768 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
769 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
770 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
771 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
772 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
773 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
774 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
775 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
776 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
777 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
778 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
779 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
780 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
781 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
782 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
783 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
784 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
785 |
! |
3892 | 786 |
|
15211 | 787 |
disabledCursorIcon |
788 |
"This resource specification was automatically generated |
|
789 |
by the ImageEditor of ST/X." |
|
790 |
||
791 |
"Do not manually edit this!! If it is corrupted, |
|
792 |
the ImageEditor may not be able to read the specification." |
|
793 |
||
794 |
" |
|
17202 | 795 |
self disabledCursorIcon inspect |
796 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 797 |
Icon flushCachedIcons |
798 |
" |
|
799 |
||
800 |
<resource: #image> |
|
801 |
||
802 |
^Icon |
|
803 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
804 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
805 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
806 |
8 @@H@P@@A X@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
807 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
808 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
809 |
! |
|
6337 | 810 |
|
15211 | 811 |
enabledCursorIcon |
812 |
"This resource specification was automatically generated |
|
813 |
by the ImageEditor of ST/X." |
|
814 |
||
815 |
"Do not manually edit this!! If it is corrupted, |
|
816 |
the ImageEditor may not be able to read the specification." |
|
817 |
||
818 |
" |
|
17202 | 819 |
self enabledCursorIcon inspect |
820 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 821 |
Icon flushCachedIcons |
822 |
" |
|
823 |
||
824 |
<resource: #image> |
|
825 |
||
826 |
^Icon |
|
827 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
828 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
829 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
830 |
P@@@@T@@@@E@@@@AP@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
831 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
832 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
833 |
! |
|
6337 | 834 |
|
3892 | 835 |
fileInIcon |
836 |
<resource: #programImage> |
|
837 |
||
6116 | 838 |
^ ToolbarIconLibrary fileInIcon |
3892 | 839 |
! |
840 |
||
6079 | 841 |
historyBackIcon |
842 |
<resource: #programImage> |
|
843 |
||
844 |
^ ToolbarIconLibrary historyBackIcon |
|
845 |
! |
|
846 |
||
847 |
historyForwardIcon |
|
848 |
<resource: #programImage> |
|
849 |
||
850 |
^ ToolbarIconLibrary historyForwardIcon |
|
851 |
! |
|
852 |
||
3892 | 853 |
homeIcon |
854 |
<resource: #programImage> |
|
855 |
||
6079 | 856 |
^ ToolbarIconLibrary homeIcon |
3892 | 857 |
! |
858 |
||
6074 | 859 |
homeIcon2 |
6079 | 860 |
<resource: #programImage> |
861 |
||
862 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 863 |
! |
864 |
||
865 |
htmlReloadIcon |
|
866 |
<resource: #programImage> |
|
867 |
||
868 |
^ ToolbarIconLibrary reload22x22Icon |
|
869 |
! |
|
870 |
||
15211 | 871 |
leftDownIcon |
872 |
<resource: #image> |
|
873 |
"This resource specification was automatically generated |
|
874 |
by the ImageEditor of ST/X." |
|
875 |
"Do not manually edit this!! If it is corrupted, |
|
876 |
the ImageEditor may not be able to read the specification." |
|
877 |
" |
|
878 |
self leftDownIcon inspect |
|
879 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
880 |
||
881 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
882 |
ifAbsentPut:[ |
|
883 |
(Depth2Image new) |
|
884 |
width:28; |
|
885 |
height:28; |
|
886 |
photometric:(#palette); |
|
887 |
bitsPerSample:(#( 2 )); |
|
888 |
samplesPerPixel:(1); |
|
889 |
bits:(ByteArray |
|
890 |
fromPackedString:' |
|
891 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
892 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
893 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
894 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
895 |
mask:((ImageMask new) |
|
896 |
width:28; |
|
897 |
height:28; |
|
898 |
bits:(ByteArray |
|
899 |
fromPackedString:' |
|
900 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
901 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
902 |
yourself); |
|
903 |
yourself |
|
904 |
] |
|
905 |
! |
|
906 |
||
907 |
menuHistoryList9x20Icon |
|
908 |
<resource: #image> |
|
909 |
"This resource specification was automatically generated |
|
910 |
by the ImageEditor of ST/X." |
|
911 |
"Do not manually edit this!! If it is corrupted, |
|
912 |
the ImageEditor may not be able to read the specification." |
|
913 |
" |
|
914 |
self menuHistoryList9x20Icon inspect |
|
915 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
916 |
Icon flushCachedIcons" |
|
917 |
||
918 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
919 |
ifAbsentPut:[ |
|
920 |
(Depth1Image new) |
|
921 |
width:9; |
|
922 |
height:20; |
|
923 |
photometric:(#palette); |
|
924 |
bitsPerSample:(#( 1 )); |
|
925 |
samplesPerPixel:(1); |
|
926 |
bits:(ByteArray |
|
927 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
928 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
929 |
mask:((ImageMask new) |
|
930 |
width:9; |
|
931 |
height:20; |
|
932 |
bits:(ByteArray |
|
933 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
934 |
yourself); |
|
935 |
yourself |
|
936 |
] |
|
937 |
! |
|
938 |
||
939 |
menuHistoryListIcon |
|
940 |
<resource: #image> |
|
941 |
"This resource specification was automatically generated |
|
942 |
by the ImageEditor of ST/X." |
|
943 |
"Do not manually edit this!! If it is corrupted, |
|
944 |
the ImageEditor may not be able to read the specification." |
|
945 |
" |
|
946 |
self menuHistoryListIcon inspect |
|
947 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
948 |
||
949 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
950 |
ifAbsentPut:[ |
|
951 |
(Depth1Image new) |
|
952 |
width:12; |
|
953 |
height:12; |
|
954 |
photometric:(#palette); |
|
955 |
bitsPerSample:(#( 1 )); |
|
956 |
samplesPerPixel:(1); |
|
957 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
958 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
959 |
mask:((ImageMask new) |
|
960 |
width:12; |
|
961 |
height:12; |
|
962 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
963 |
yourself); |
|
964 |
yourself |
|
965 |
] |
|
966 |
! |
|
3892 | 967 |
|
6087 | 968 |
newDirectoryIcon |
6074 | 969 |
<resource: #programImage> |
970 |
||
6087 | 971 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 972 |
! |
973 |
||
6091 | 974 |
removeTabIcon |
975 |
<resource: #programImage> |
|
976 |
||
977 |
^ ToolbarIconLibrary removeTabIcon |
|
978 |
! |
|
979 |
||
3892 | 980 |
vt100Terminal |
981 |
<resource: #programImage> |
|
982 |
||
983 |
^ ToolbarIconLibrary shell20x20Icon |
|
984 |
! ! |
|
985 |
||
5528 | 986 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
987 |
||
15211 | 988 |
encodingDialogSpec |
989 |
"This resource specification was automatically generated |
|
990 |
by the UIPainter of ST/X." |
|
991 |
||
992 |
"Do not manually edit this!! If it is corrupted, |
|
993 |
the UIPainter may not be able to read the specification." |
|
994 |
||
995 |
" |
|
996 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
997 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
998 |
" |
|
999 |
||
1000 |
<resource: #canvas> |
|
1001 |
||
1002 |
^ |
|
1003 |
#(FullSpec |
|
1004 |
name: encodingDialogSpec |
|
1005 |
window: |
|
1006 |
(WindowSpec |
|
1007 |
label: 'File Encoding' |
|
1008 |
name: 'File Encoding' |
|
1009 |
min: (Point 10 10) |
|
1010 |
bounds: (Rectangle 0 0 379 590) |
|
1011 |
) |
|
1012 |
component: |
|
1013 |
(SpecCollection |
|
1014 |
collection: ( |
|
1015 |
(LabelSpec |
|
1016 |
label: 'Select the External (File-) Encoding:' |
|
1017 |
name: 'Label1' |
|
1018 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1019 |
translateLabel: true |
|
1020 |
adjust: left |
|
1021 |
) |
|
1022 |
(DataSetSpec |
|
1023 |
name: 'Table1' |
|
1024 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1025 |
model: selectedEncoding |
|
1026 |
hasHorizontalScrollBar: true |
|
1027 |
hasVerticalScrollBar: true |
|
1028 |
dataList: encodingList |
|
1029 |
has3Dseparators: true |
|
1030 |
columns: |
|
1031 |
(Array |
|
1032 |
||
1033 |
(DataSetColumnSpec |
|
1034 |
label: 'Encoding' |
|
1035 |
labelButtonType: Button |
|
1036 |
height: heightOfFirstRow |
|
1037 |
model: at: |
|
1038 |
canSelect: false |
|
1039 |
isResizeable: false |
|
1040 |
showRowSeparator: false |
|
1041 |
showColSeparator: false |
|
1042 |
) |
|
1043 |
(DataSetColumnSpec |
|
1044 |
label: 'Description' |
|
1045 |
labelButtonType: Button |
|
1046 |
height: heightOfFirstRow |
|
1047 |
model: at: |
|
1048 |
canSelect: false |
|
1049 |
isResizeable: false |
|
1050 |
showRowSeparator: false |
|
1051 |
showColSeparator: false |
|
1052 |
) |
|
1053 |
) |
|
1054 |
doubleClickChannel: accept |
|
1055 |
) |
|
1056 |
(CheckBoxSpec |
|
1057 |
label: 'Lock Encoding' |
|
1058 |
name: 'LockEncodingCheckBox' |
|
1059 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1060 |
activeHelpKey: lockFileEncoding |
|
1061 |
model: lockFileEncoding |
|
1062 |
translateLabel: true |
|
1063 |
) |
|
1064 |
(HorizontalPanelViewSpec |
|
1065 |
name: 'ButtonPanel' |
|
1066 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1067 |
horizontalLayout: fitSpace |
|
1068 |
verticalLayout: center |
|
1069 |
horizontalSpace: 3 |
|
1070 |
verticalSpace: 3 |
|
1071 |
reverseOrderIfOKAtLeft: true |
|
1072 |
component: |
|
1073 |
(SpecCollection |
|
1074 |
collection: ( |
|
1075 |
(ActionButtonSpec |
|
1076 |
label: 'Cancel' |
|
1077 |
name: 'Button2' |
|
1078 |
translateLabel: true |
|
1079 |
model: cancel |
|
1080 |
extent: (Point 183 22) |
|
1081 |
) |
|
1082 |
(ActionButtonSpec |
|
1083 |
label: 'OK' |
|
1084 |
name: 'Button1' |
|
1085 |
translateLabel: true |
|
1086 |
model: accept |
|
1087 |
isDefault: true |
|
1088 |
extent: (Point 184 22) |
|
1089 |
) |
|
1090 |
) |
|
1091 |
||
1092 |
) |
|
1093 |
) |
|
1094 |
) |
|
1095 |
||
1096 |
) |
|
1097 |
) |
|
1098 |
! |
|
1099 |
||
1100 |
lineEndConventionDialogSpec |
|
1101 |
"This resource specification was automatically generated |
|
1102 |
by the UIPainter of ST/X." |
|
1103 |
||
1104 |
"Do not manually edit this!! If it is corrupted, |
|
1105 |
the UIPainter may not be able to read the specification." |
|
1106 |
||
1107 |
" |
|
1108 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1109 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1110 |
" |
|
1111 |
||
1112 |
<resource: #canvas> |
|
1113 |
||
1114 |
^ |
|
15212 | 1115 |
#(FullSpec |
1116 |
name: lineEndConventionDialogSpec |
|
1117 |
window: |
|
1118 |
(WindowSpec |
|
1119 |
label: 'Line-End Convention' |
|
1120 |
name: 'Line-End Convention' |
|
1121 |
min: (Point 10 10) |
|
1122 |
bounds: (Rectangle 0 0 379 239) |
|
1123 |
) |
|
1124 |
component: |
|
1125 |
(SpecCollection |
|
1126 |
collection: ( |
|
1127 |
(LabelSpec |
|
1128 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1129 |
name: 'Label1' |
|
1130 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1131 |
translateLabel: true |
|
1132 |
adjust: left |
|
1133 |
) |
|
1134 |
(VerticalPanelViewSpec |
|
1135 |
name: 'VerticalPanel1' |
|
1136 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1137 |
horizontalLayout: fit |
|
1138 |
verticalLayout: topSpace |
|
1139 |
horizontalSpace: 3 |
|
1140 |
verticalSpace: 3 |
|
1141 |
component: |
|
1142 |
(SpecCollection |
|
1143 |
collection: ( |
|
1144 |
(RadioButtonSpec |
|
1145 |
label: 'NL (Unix)' |
|
1146 |
name: 'RadioButton1' |
|
1147 |
translateLabel: true |
|
1148 |
model: lineEndConvention |
|
1149 |
isTriggerOnDown: true |
|
1150 |
select: nl |
|
1151 |
extent: (Point 359 22) |
|
1152 |
) |
|
1153 |
(RadioButtonSpec |
|
1154 |
label: 'CR-NL (MSDOS)' |
|
1155 |
name: 'RadioButton4' |
|
1156 |
translateLabel: true |
|
1157 |
model: lineEndConvention |
|
1158 |
isTriggerOnDown: true |
|
1159 |
select: crlf |
|
1160 |
extent: (Point 359 22) |
|
1161 |
) |
|
1162 |
(RadioButtonSpec |
|
1163 |
label: 'CR (VMS and pre OSX mac)' |
|
1164 |
name: 'RadioButton5' |
|
1165 |
translateLabel: true |
|
1166 |
model: lineEndConvention |
|
1167 |
isTriggerOnDown: true |
|
1168 |
select: cr |
|
1169 |
extent: (Point 359 22) |
|
15211 | 1170 |
) |
15212 | 1171 |
(RadioButtonSpec |
1172 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1173 |
name: 'RadioButton6' |
|
1174 |
translateLabel: true |
|
1175 |
model: lineEndConvention |
|
1176 |
isTriggerOnDown: true |
|
1177 |
select: etx |
|
1178 |
extent: (Point 359 22) |
|
1179 |
) |
|
1180 |
(RadioButtonSpec |
|
1181 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1182 |
name: 'RadioButton7' |
|
1183 |
translateLabel: true |
|
1184 |
model: lineEndConvention |
|
1185 |
isTriggerOnDown: true |
|
1186 |
select: eot |
|
1187 |
extent: (Point 359 22) |
|
15211 | 1188 |
) |
15212 | 1189 |
) |
1190 |
||
1191 |
) |
|
15211 | 1192 |
) |
15212 | 1193 |
(HorizontalPanelViewSpec |
1194 |
name: 'ButtonPanel' |
|
1195 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1196 |
horizontalLayout: fitSpace |
|
1197 |
verticalLayout: center |
|
1198 |
horizontalSpace: 3 |
|
1199 |
verticalSpace: 3 |
|
1200 |
reverseOrderIfOKAtLeft: true |
|
1201 |
component: |
|
1202 |
(SpecCollection |
|
1203 |
collection: ( |
|
1204 |
(ActionButtonSpec |
|
1205 |
label: 'Cancel' |
|
1206 |
name: 'Button2' |
|
1207 |
translateLabel: true |
|
1208 |
model: cancel |
|
1209 |
extent: (Point 185 22) |
|
1210 |
) |
|
1211 |
(ActionButtonSpec |
|
1212 |
label: 'OK' |
|
1213 |
name: 'Button1' |
|
1214 |
translateLabel: true |
|
1215 |
model: accept |
|
1216 |
isDefault: true |
|
1217 |
extent: (Point 185 22) |
|
1218 |
) |
|
1219 |
) |
|
1220 |
||
1221 |
) |
|
1222 |
) |
|
1223 |
) |
|
1224 |
||
1225 |
) |
|
1226 |
) |
|
15211 | 1227 |
! |
1228 |
||
1229 |
tabStopConversionDialogSpec |
|
1230 |
"This resource specification was automatically generated |
|
1231 |
by the UIPainter of ST/X." |
|
1232 |
||
1233 |
"Do not manually edit this!! If it is corrupted, |
|
1234 |
the UIPainter may not be able to read the specification." |
|
1235 |
||
1236 |
" |
|
1237 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1238 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1239 |
" |
|
1240 |
||
1241 |
<resource: #canvas> |
|
1242 |
||
1243 |
^ |
|
1244 |
#(FullSpec |
|
1245 |
name: 'tabStopConversionDialogSpec' |
|
1246 |
window: |
|
1247 |
(WindowSpec |
|
1248 |
label: 'Tab-Stop Conversion' |
|
1249 |
name: 'Tab-Stop Conversion' |
|
1250 |
min: (Point 10 10) |
|
1251 |
bounds: (Rectangle 0 0 379 239) |
|
1252 |
) |
|
1253 |
component: |
|
1254 |
(SpecCollection |
|
1255 |
collection: ( |
|
1256 |
(LabelSpec |
|
1257 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1258 |
name: 'Label1' |
|
1259 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1260 |
translateLabel: true |
|
1261 |
adjust: left |
|
1262 |
) |
|
1263 |
(VerticalPanelViewSpec |
|
1264 |
name: 'VerticalPanel1' |
|
1265 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1266 |
horizontalLayout: center |
|
1267 |
verticalLayout: center |
|
1268 |
horizontalSpace: 3 |
|
1269 |
verticalSpace: 3 |
|
1270 |
component: |
|
1271 |
(SpecCollection |
|
1272 |
collection: ( |
|
1273 |
(RadioButtonSpec |
|
1274 |
label: '4' |
|
1275 |
name: 'RadioButton1' |
|
1276 |
translateLabel: true |
|
1277 |
model: tabStops |
|
1278 |
isTriggerOnDown: true |
|
1279 |
select: 4 |
|
1280 |
extent: (Point 136 22) |
|
1281 |
) |
|
1282 |
(RadioButtonSpec |
|
1283 |
label: '8' |
|
1284 |
name: 'RadioButton4' |
|
1285 |
translateLabel: true |
|
1286 |
model: tabStops |
|
1287 |
isTriggerOnDown: true |
|
1288 |
select: 8 |
|
1289 |
extent: (Point 136 22) |
|
1290 |
) |
|
1291 |
) |
|
1292 |
||
1293 |
) |
|
1294 |
) |
|
1295 |
(HorizontalPanelViewSpec |
|
1296 |
name: 'ButtonPanel' |
|
1297 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1298 |
horizontalLayout: fitSpace |
|
1299 |
verticalLayout: center |
|
1300 |
horizontalSpace: 3 |
|
1301 |
verticalSpace: 3 |
|
1302 |
reverseOrderIfOKAtLeft: true |
|
1303 |
component: |
|
1304 |
(SpecCollection |
|
1305 |
collection: ( |
|
1306 |
(ActionButtonSpec |
|
1307 |
label: 'Cancel' |
|
1308 |
name: 'Button2' |
|
1309 |
translateLabel: true |
|
1310 |
model: cancel |
|
1311 |
extent: (Point 185 22) |
|
1312 |
) |
|
1313 |
(ActionButtonSpec |
|
1314 |
label: 'OK' |
|
1315 |
name: 'Button1' |
|
1316 |
translateLabel: true |
|
1317 |
model: accept |
|
1318 |
isDefault: true |
|
1319 |
extent: (Point 185 22) |
|
1320 |
) |
|
1321 |
) |
|
1322 |
||
1323 |
) |
|
1324 |
) |
|
1325 |
) |
|
1326 |
||
1327 |
) |
|
1328 |
) |
|
1329 |
||
1330 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1331 |
! ! |
|
5528 | 1332 |
|
3892 | 1333 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1334 |
||
15211 | 1335 |
baseBookmarksMenuSpec |
1336 |
"This resource specification was automatically generated |
|
1337 |
by the MenuEditor of ST/X." |
|
1338 |
||
1339 |
"Do not manually edit this!! If it is corrupted, |
|
1340 |
the MenuEditor may not be able to read the specification." |
|
1341 |
||
1342 |
" |
|
1343 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1344 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1345 |
" |
|
1346 |
||
1347 |
<resource: #menu> |
|
1348 |
||
1349 |
^ |
|
1350 |
#(Menu |
|
1351 |
( |
|
1352 |
(MenuItem |
|
1353 |
enabled: currentFilesHasDirectories |
|
1354 |
label: 'Add Bookmark' |
|
1355 |
itemValue: addBookmark |
|
1356 |
translateLabel: true |
|
1357 |
) |
|
1358 |
(MenuItem |
|
1359 |
enabled: hasBookmarksToRemove |
|
1360 |
label: 'Remove Bookmark' |
|
1361 |
itemValue: removeBookmark |
|
1362 |
translateLabel: true |
|
1363 |
) |
|
1364 |
(MenuItem |
|
1365 |
label: 'Save Bookmarks In...' |
|
1366 |
itemValue: saveBookmarks |
|
1367 |
translateLabel: true |
|
1368 |
) |
|
1369 |
) |
|
1370 |
nil |
|
1371 |
nil |
|
1372 |
) |
|
1373 |
! |
|
1374 |
||
1375 |
baseBookmarksMenuSpec2 |
|
1376 |
"This resource specification was automatically generated |
|
1377 |
by the MenuEditor of ST/X." |
|
1378 |
||
1379 |
"Do not manually edit this!! If it is corrupted, |
|
1380 |
the MenuEditor may not be able to read the specification." |
|
1381 |
||
1382 |
" |
|
1383 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1384 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1385 |
" |
|
1386 |
||
1387 |
<resource: #menu> |
|
1388 |
||
1389 |
^ |
|
1390 |
#(Menu |
|
1391 |
( |
|
1392 |
(MenuItem |
|
1393 |
label: 'Edit Bookmarks' |
|
1394 |
itemValue: editBookmarks |
|
1395 |
translateLabel: true |
|
1396 |
) |
|
1397 |
(MenuItem |
|
1398 |
label: '-' |
|
1399 |
) |
|
1400 |
(MenuItem |
|
1401 |
enabled: currentFilesHasDirectories |
|
1402 |
label: 'Add Bookmark' |
|
1403 |
itemValue: addBookmark |
|
1404 |
translateLabel: true |
|
1405 |
) |
|
1406 |
) |
|
1407 |
nil |
|
1408 |
nil |
|
1409 |
) |
|
1410 |
! |
|
1411 |
||
1412 |
browserMenu |
|
1413 |
"This resource specification was automatically generated |
|
1414 |
by the MenuEditor of ST/X." |
|
1415 |
||
1416 |
"Do not manually edit this!! If it is corrupted, |
|
1417 |
the MenuEditor may not be able to read the specification." |
|
1418 |
||
1419 |
||
1420 |
" |
|
1421 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1422 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1423 |
" |
|
1424 |
||
1425 |
<resource: #menu> |
|
1426 |
||
1427 |
^ |
|
1428 |
#(Menu |
|
1429 |
( |
|
1430 |
(MenuItem |
|
1431 |
label: 'Spawn Filebrowser' |
|
1432 |
itemValue: doSpawn |
|
1433 |
translateLabel: true |
|
1434 |
shortcutKey: Ctrln |
|
1435 |
) |
|
1436 |
(MenuItem |
|
1437 |
label: 'Windows Explorer' |
|
1438 |
itemValue: doOpenExplorer |
|
1439 |
translateLabel: true |
|
1440 |
isVisible: systemIsDOS |
|
1441 |
) |
|
1442 |
(MenuItem |
|
1443 |
label: 'Open Finder' |
|
1444 |
itemValue: doOpenFinder |
|
1445 |
translateLabel: true |
|
1446 |
isVisible: systemIsOSX |
|
1447 |
) |
|
1448 |
(MenuItem |
|
1449 |
label: 'C Browser' |
|
1450 |
itemValue: doOpenCBrowser |
|
1451 |
translateLabel: true |
|
1452 |
isVisible: cBrowserMenuItemVisible |
|
1453 |
) |
|
1454 |
(MenuItem |
|
1455 |
label: '-' |
|
1456 |
) |
|
1457 |
(MenuItem |
|
1458 |
label: 'Add Text Editor Page' |
|
1459 |
itemValue: newTextEditor |
|
1460 |
translateLabel: true |
|
1461 |
shortcutKey: Ctrlt |
|
1462 |
) |
|
1463 |
(MenuItem |
|
1464 |
label: 'Add Shell Terminal Page' |
|
1465 |
itemValue: doAddTerminal |
|
1466 |
translateLabel: true |
|
1467 |
) |
|
1468 |
(MenuItem |
|
1469 |
label: 'Add Archiver Page' |
|
1470 |
itemValue: doAddArchiver |
|
1471 |
translateLabel: true |
|
1472 |
) |
|
1473 |
(MenuItem |
|
1474 |
label: 'Add Search Page' |
|
1475 |
itemValue: doOpenSearchFile |
|
1476 |
translateLabel: true |
|
1477 |
) |
|
1478 |
(MenuItem |
|
1479 |
label: '-' |
|
1480 |
isVisible: false |
|
1481 |
) |
|
1482 |
(MenuItem |
|
1483 |
label: 'Settings...' |
|
1484 |
itemValue: doOpenSettings |
|
1485 |
translateLabel: true |
|
1486 |
isVisible: false |
|
1487 |
) |
|
1488 |
(MenuItem |
|
1489 |
label: 'Encoding...' |
|
1490 |
itemValue: fileEncodingDialog |
|
1491 |
translateLabel: true |
|
1492 |
isVisible: false |
|
1493 |
) |
|
1494 |
(MenuItem |
|
1495 |
label: 'Line End Convention...' |
|
1496 |
itemValue: lineEndConventionDialog |
|
1497 |
translateLabel: true |
|
1498 |
isVisible: false |
|
1499 |
) |
|
1500 |
(MenuItem |
|
1501 |
label: 'Tab Stop Conversion...' |
|
1502 |
itemValue: tabStopConversionDialog |
|
1503 |
translateLabel: true |
|
1504 |
isVisible: false |
|
1505 |
) |
|
1506 |
(MenuItem |
|
1507 |
label: '-' |
|
1508 |
) |
|
1509 |
(MenuItem |
|
1510 |
label: 'Exit' |
|
1511 |
itemValue: closeRequest |
|
1512 |
translateLabel: true |
|
1513 |
) |
|
1514 |
) |
|
1515 |
nil |
|
1516 |
nil |
|
1517 |
) |
|
1518 |
||
1519 |
"Modified: / 07-01-2012 / 12:51:20 / cg" |
|
1520 |
! |
|
1521 |
||
1522 |
directoryMenu |
|
1523 |
"This resource specification was automatically generated |
|
1524 |
by the MenuEditor of ST/X." |
|
1525 |
||
1526 |
"Do not manually edit this!! If it is corrupted, |
|
1527 |
the MenuEditor may not be able to read the specification." |
|
1528 |
||
1529 |
||
1530 |
" |
|
1531 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1532 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1533 |
" |
|
1534 |
||
1535 |
<resource: #menu> |
|
1536 |
||
1537 |
^ |
|
1538 |
#(Menu |
|
1539 |
( |
|
1540 |
(MenuItem |
|
1541 |
label: 'Bookmarks' |
|
1542 |
submenuChannel: bookmarksMenu |
|
1543 |
) |
|
1544 |
(MenuItem |
|
1545 |
label: 'Visited Directories' |
|
1546 |
submenuChannel: visitedDirectoriesMenu |
|
1547 |
) |
|
1548 |
(MenuItem |
|
1549 |
label: '-' |
|
1550 |
) |
|
1551 |
(MenuItem |
|
1552 |
label: 'Up' |
|
1553 |
itemValue: doGoDirectoryUp |
|
1554 |
) |
|
1555 |
(MenuItem |
|
1556 |
activeHelpKey: directoryBack |
|
1557 |
enabled: enableBack |
|
1558 |
label: 'Back' |
|
1559 |
itemValue: doBack |
|
1560 |
) |
|
1561 |
(MenuItem |
|
1562 |
activeHelpKey: directoryBack |
|
1563 |
enabled: enableForward |
|
1564 |
label: 'Forward' |
|
1565 |
itemValue: doForward |
|
1566 |
) |
|
1567 |
(MenuItem |
|
1568 |
label: '-' |
|
1569 |
) |
|
1570 |
(MenuItem |
|
1571 |
enabled: enableHome |
|
1572 |
label: 'Home Directory' |
|
1573 |
itemValue: doGotoHomeDirectory |
|
1574 |
) |
|
1575 |
(MenuItem |
|
1576 |
enabled: enableGotoDesktopDirectory |
|
1577 |
label: 'Desktop' |
|
1578 |
itemValue: doGotoDesktopDirectory |
|
1579 |
) |
|
1580 |
(MenuItem |
|
1581 |
enabled: enableGotoDefaultDirectory |
|
1582 |
label: 'Default (Current) Directory' |
|
1583 |
itemValue: doGotoDefaultDirectory |
|
1584 |
) |
|
1585 |
(MenuItem |
|
1586 |
enabled: enableGotoSmalltalkDirectory |
|
1587 |
label: 'Smalltalk (Application) Directory' |
|
1588 |
itemValue: doGotoSmalltalkDirectory |
|
1589 |
) |
|
1590 |
(MenuItem |
|
17187 | 1591 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1592 |
label: 'Smalltalk Workspace Directory' |
|
1593 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1594 |
) |
|
1595 |
(MenuItem |
|
15211 | 1596 |
enabled: enableGotoTempDirectory |
1597 |
label: 'Smalltalk Temp Directory' |
|
1598 |
itemValue: doGotoTempDirectory |
|
1599 |
) |
|
1600 |
(MenuItem |
|
1601 |
label: '-' |
|
1602 |
) |
|
1603 |
(MenuItem |
|
1604 |
enabled: enableMakeCurrentDirectory |
|
1605 |
label: 'Make this the Default (Current) Directory' |
|
1606 |
itemValue: doMakeCurrentDirectory |
|
1607 |
) |
|
1608 |
) |
|
1609 |
nil |
|
1610 |
nil |
|
1611 |
) |
|
1612 |
! |
|
1613 |
||
1614 |
editMenu |
|
1615 |
"This resource specification was automatically generated |
|
1616 |
by the MenuEditor of ST/X." |
|
1617 |
||
1618 |
"Do not manually edit this!! If it is corrupted, |
|
1619 |
the MenuEditor may not be able to read the specification." |
|
1620 |
||
1621 |
" |
|
1622 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1623 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1624 |
" |
|
1625 |
||
1626 |
<resource: #menu> |
|
1627 |
||
1628 |
^ |
|
1629 |
#(Menu |
|
1630 |
( |
|
1631 |
(MenuItem |
|
1632 |
enabled: hasFileSelection |
|
1633 |
label: 'Copy Selected Filenames to Clipboard' |
|
1634 |
itemValue: copySelectedFilenames |
|
1635 |
translateLabel: true |
|
1636 |
) |
|
1637 |
(MenuItem |
|
1638 |
enabled: fileListIsNotEmpty |
|
1639 |
label: 'Copy all Filenames to Clipboard' |
|
1640 |
itemValue: copyFileList |
|
1641 |
translateLabel: true |
|
1642 |
) |
|
1643 |
) |
|
1644 |
nil |
|
1645 |
nil |
|
1646 |
) |
|
1647 |
! |
|
1648 |
||
1649 |
emptyMenuSpec |
|
1650 |
"This resource specification was automatically generated |
|
1651 |
by the MenuEditor of ST/X." |
|
1652 |
||
1653 |
"Do not manually edit this!! If it is corrupted, |
|
1654 |
the MenuEditor may not be able to read the specification." |
|
1655 |
||
1656 |
" |
|
1657 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1658 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1659 |
" |
|
1660 |
||
1661 |
<resource: #menu> |
|
1662 |
||
1663 |
^ |
|
1664 |
#(#Menu |
|
1665 |
#( |
|
1666 |
) |
|
1667 |
nil |
|
1668 |
nil |
|
1669 |
) |
|
1670 |
! |
|
1671 |
||
1672 |
extraMenu |
|
1673 |
"This resource specification was automatically generated |
|
1674 |
by the MenuEditor of ST/X." |
|
1675 |
||
1676 |
"Do not manually edit this!! If it is corrupted, |
|
1677 |
the MenuEditor may not be able to read the specification." |
|
1678 |
||
1679 |
||
1680 |
" |
|
1681 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1682 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1683 |
" |
|
1684 |
||
1685 |
<resource: #menu> |
|
1686 |
||
1687 |
^ |
|
1688 |
#(Menu |
|
1689 |
( |
|
1690 |
(MenuItem |
|
1691 |
label: 'Encoding...' |
|
1692 |
itemValue: fileEncodingDialog |
|
1693 |
translateLabel: true |
|
1694 |
) |
|
1695 |
(MenuItem |
|
1696 |
label: 'Line End Convention...' |
|
1697 |
itemValue: lineEndConventionDialog |
|
1698 |
translateLabel: true |
|
1699 |
) |
|
1700 |
(MenuItem |
|
1701 |
label: 'Tab Stop Conversion...' |
|
1702 |
itemValue: tabStopConversionDialog |
|
1703 |
translateLabel: true |
|
1704 |
) |
|
1705 |
(MenuItem |
|
1706 |
label: '-' |
|
1707 |
) |
|
1708 |
(MenuItem |
|
1709 |
label: 'Settings...' |
|
1710 |
itemValue: doOpenSettings |
|
1711 |
translateLabel: true |
|
1712 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1713 |
) |
|
1714 |
) |
|
1715 |
nil |
|
1716 |
nil |
|
1717 |
) |
|
1718 |
! |
|
1719 |
||
1720 |
fileMenu |
|
1721 |
"This resource specification was automatically generated |
|
1722 |
by the MenuEditor of ST/X." |
|
1723 |
||
1724 |
"Do not manually edit this!! If it is corrupted, |
|
1725 |
the MenuEditor may not be able to read the specification." |
|
1726 |
||
1727 |
||
1728 |
" |
|
1729 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1730 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1731 |
" |
|
1732 |
||
1733 |
<resource: #menu> |
|
1734 |
||
1735 |
^ |
|
1736 |
#(Menu |
|
1737 |
( |
|
1738 |
(MenuItem |
|
1739 |
enabled: enableFileHistory |
|
1740 |
label: 'File History' |
|
1741 |
submenuChannel: menuFileHistory |
|
1742 |
) |
|
1743 |
(MenuItem |
|
1744 |
label: '-' |
|
1745 |
) |
|
1746 |
(MenuItem |
|
1747 |
label: 'Open' |
|
1748 |
itemValue: doShowFileContents |
|
1749 |
) |
|
1750 |
(MenuItem |
|
1751 |
label: '-' |
|
1752 |
) |
|
1753 |
(MenuItem |
|
1754 |
enabled: hasFileSelection |
|
1755 |
label: 'FileIn' |
|
1756 |
itemValue: fileFileIn |
|
1757 |
) |
|
1758 |
(MenuItem |
|
1759 |
enabled: hasFileSelection |
|
1760 |
label: 'FileIn to Namespace...' |
|
1761 |
itemValue: fileFileInToNameSpace |
|
1762 |
) |
|
1763 |
(MenuItem |
|
1764 |
enabled: hasPackageDirectorySelected |
|
1765 |
label: 'Load Package from Here' |
|
1766 |
itemValue: fileFileInPackage |
|
1767 |
) |
|
1768 |
(MenuItem |
|
1769 |
label: '-' |
|
1770 |
) |
|
1771 |
(MenuItem |
|
1772 |
label: 'New' |
|
1773 |
submenuChannel: newMenu |
|
1774 |
keepLinkedMenu: true |
|
1775 |
) |
|
1776 |
(MenuItem |
|
1777 |
label: '-' |
|
1778 |
) |
|
1779 |
(MenuItem |
|
1780 |
enabled: hasSelection |
|
1781 |
label: 'Cut' |
|
1782 |
itemValue: cutFiles |
|
1783 |
) |
|
1784 |
(MenuItem |
|
1785 |
enabled: hasSelection |
|
1786 |
label: 'Copy' |
|
1787 |
itemValue: copyFiles |
|
1788 |
) |
|
1789 |
(MenuItem |
|
1790 |
enabled: canPaste |
|
1791 |
label: 'Paste' |
|
1792 |
itemValue: pasteFiles |
|
1793 |
) |
|
1794 |
(MenuItem |
|
1795 |
enabled: hasSelection |
|
1796 |
label: 'Delete' |
|
1797 |
itemValue: deleteFiles |
|
1798 |
) |
|
1799 |
(MenuItem |
|
1800 |
enabled: hasSelection |
|
1801 |
label: 'Erase' |
|
1802 |
itemValue: eraseFiles |
|
1803 |
) |
|
1804 |
(MenuItem |
|
1805 |
label: '-' |
|
1806 |
) |
|
1807 |
(MenuItem |
|
1808 |
enabled: hasSelection |
|
1809 |
label: 'Rename...' |
|
1810 |
itemValue: renameSelection |
|
1811 |
shortcutKey: Rename |
|
1812 |
) |
|
1813 |
(MenuItem |
|
1814 |
enabled: hasSelection |
|
1815 |
label: 'Move To...' |
|
1816 |
itemValue: moveSelectionTo |
|
1817 |
) |
|
1818 |
(MenuItem |
|
1819 |
enabled: hasSelection |
|
1820 |
label: 'Copy To...' |
|
1821 |
itemValue: copySelectionTo |
|
1822 |
) |
|
1823 |
(MenuItem |
|
1824 |
enabled: hasSelection |
|
1825 |
label: 'Properties...' |
|
1826 |
itemValue: doShowProperties |
|
1827 |
) |
|
1828 |
(MenuItem |
|
1829 |
label: '-' |
|
1830 |
isVisible: javaSupportLoaded |
|
1831 |
) |
|
1832 |
(MenuItem |
|
1833 |
enabled: canAddToClassPath |
|
1834 |
label: 'Add to Java Class Path' |
|
1835 |
isVisible: javaSupportLoaded |
|
1836 |
) |
|
1837 |
(MenuItem |
|
1838 |
enabled: canRemoveFromClassPath |
|
1839 |
label: 'Remove from Java Class Path' |
|
1840 |
isVisible: javaSupportLoaded |
|
1841 |
) |
|
1842 |
(MenuItem |
|
1843 |
enabled: canAddToSourcePath |
|
1844 |
label: 'Add to Java Source Path' |
|
1845 |
isVisible: javaSupportLoaded |
|
1846 |
) |
|
1847 |
(MenuItem |
|
1848 |
enabled: canRemoveFromSourcePath |
|
1849 |
label: 'Remove from Java Source Path' |
|
1850 |
isVisible: javaSupportLoaded |
|
1851 |
) |
|
1852 |
) |
|
1853 |
nil |
|
1854 |
nil |
|
1855 |
) |
|
1856 |
! |
|
1857 |
||
1858 |
fileOpMenu |
|
1859 |
"This resource specification was automatically generated |
|
1860 |
by the MenuEditor of ST/X." |
|
1861 |
||
1862 |
"Do not manually edit this!! If it is corrupted, |
|
1863 |
the MenuEditor may not be able to read the specification." |
|
1864 |
||
1865 |
||
1866 |
" |
|
1867 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1868 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1869 |
" |
|
1870 |
||
1871 |
<resource: #menu> |
|
1872 |
||
1873 |
^ |
|
1874 |
#(Menu |
|
1875 |
( |
|
1876 |
(MenuItem |
|
1877 |
enabled: hasFileSelection |
|
15906 | 1878 |
label: 'Split (by size)...' |
15211 | 1879 |
itemValue: splitSelectedFiles |
1880 |
) |
|
1881 |
(MenuItem |
|
1882 |
enabled: hasFileSelection |
|
15906 | 1883 |
label: 'Split (by #lines)...' |
1884 |
itemValue: splitSelectedFilesByLines |
|
1885 |
) |
|
1886 |
(MenuItem |
|
1887 |
enabled: hasFileSelection |
|
15211 | 1888 |
label: 'Join...' |
1889 |
itemValue: joinSelectedFiles |
|
1890 |
) |
|
1891 |
(MenuItem |
|
1892 |
enabled: hasFileSelection |
|
1893 |
label: 'Copy Corrupted File To...' |
|
1894 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1895 |
) |
|
1896 |
(MenuItem |
|
15569 | 1897 |
label: 'Copy Corrupted File From -> To...' |
1898 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1899 |
) |
|
1900 |
(MenuItem |
|
15211 | 1901 |
label: '-' |
1902 |
) |
|
1903 |
(MenuItem |
|
1904 |
enabled: hasFileSelection |
|
1905 |
label: 'Rot13...' |
|
1906 |
itemValue: filterSelectedFiles: |
|
1907 |
argument: rot13 |
|
1908 |
) |
|
1909 |
(MenuItem |
|
1910 |
label: '-' |
|
1911 |
) |
|
1912 |
(MenuItem |
|
1913 |
enabled: hasFileSelection |
|
1914 |
label: 'Truncate...' |
|
1915 |
itemValue: truncateSelectedFilesToZeroSize |
|
1916 |
) |
|
1917 |
(MenuItem |
|
1918 |
label: '-' |
|
1919 |
) |
|
1920 |
(MenuItem |
|
1921 |
label: 'Load Signature Support Package' |
|
1922 |
itemValue: loadSignatureSupport |
|
1923 |
isVisible: cannotGenerateSignatureFiles |
|
1924 |
) |
|
1925 |
(MenuItem |
|
1926 |
enabled: canGenerateSignatureFiles |
|
1927 |
label: 'Generate Signed Files' |
|
1928 |
itemValue: generateSignaturesForSelectedFiles |
|
1929 |
) |
|
1930 |
(MenuItem |
|
1931 |
enabled: canGenerateSignatureFiles |
|
1932 |
label: 'Generate Detached Signature Files (use for dll)' |
|
1933 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
1934 |
) |
|
1935 |
(MenuItem |
|
1936 |
enabled: canGenerateSignatureFiles |
|
1937 |
label: 'Generate Patch Installer for File(s)' |
|
1938 |
itemValue: generatePatchInstallerForSelectedFiles |
|
1939 |
) |
|
1940 |
(MenuItem |
|
1941 |
label: '-' |
|
1942 |
) |
|
1943 |
(MenuItem |
|
1944 |
enabled: hasFileSelection |
|
1945 |
label: 'File Differences' |
|
1946 |
itemValue: openDiffView |
|
1947 |
isVisible: hasTwoFilesSelectedHolder |
|
1948 |
) |
|
1949 |
(MenuItem |
|
1950 |
enabled: hasFileSelection |
|
1951 |
label: 'File Differences...' |
|
1952 |
itemValue: openDiffView |
|
1953 |
isVisible: hasNotTwoFilesSelectedHolder |
|
1954 |
) |
|
1955 |
(MenuItem |
|
1956 |
enabled: hasSelection |
|
1957 |
label: 'Directory Differences' |
|
1958 |
itemValue: openDirectoryDiffView |
|
1959 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
1960 |
) |
|
1961 |
(MenuItem |
|
1962 |
enabled: hasSelection |
|
1963 |
label: 'Directory Differences...' |
|
1964 |
itemValue: openDirectoryDiffView |
|
1965 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
1966 |
) |
|
1967 |
) |
|
1968 |
nil |
|
1969 |
nil |
|
1970 |
) |
|
1971 |
! |
|
1972 |
||
1973 |
newMenu |
|
1974 |
"This resource specification was automatically generated |
|
1975 |
by the MenuEditor of ST/X." |
|
1976 |
||
1977 |
"Do not manually edit this!! If it is corrupted, |
|
1978 |
the MenuEditor may not be able to read the specification." |
|
1979 |
||
1980 |
" |
|
1981 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
1982 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
1983 |
" |
|
1984 |
||
1985 |
<resource: #menu> |
|
1986 |
||
1987 |
^ |
|
1988 |
#(#Menu |
|
1989 |
#( |
|
1990 |
#(#MenuItem |
|
1991 |
#label: 'Directory...' |
|
1992 |
#translateLabel: true |
|
1993 |
#value: #newDirectory |
|
1994 |
) |
|
1995 |
#(#MenuItem |
|
1996 |
#label: 'File...' |
|
1997 |
#translateLabel: true |
|
1998 |
#value: #newFile |
|
1999 |
) |
|
2000 |
#(#MenuItem |
|
2001 |
#label: 'Hard Link...' |
|
2002 |
#translateLabel: true |
|
2003 |
#value: #newHardLink |
|
2004 |
) |
|
2005 |
#(#MenuItem |
|
2006 |
#label: 'Symbolic Link...' |
|
2007 |
#translateLabel: true |
|
2008 |
#value: #newSoftLink |
|
2009 |
) |
|
2010 |
) |
|
2011 |
nil |
|
2012 |
nil |
|
2013 |
) |
|
2014 |
! |
|
2015 |
||
2016 |
scmMenuSlice |
|
2017 |
"This resource specification was automatically generated |
|
2018 |
by the MenuEditor of ST/X." |
|
2019 |
||
2020 |
"Do not manually edit this!! If it is corrupted, |
|
2021 |
the MenuEditor may not be able to read the specification." |
|
2022 |
||
2023 |
||
2024 |
" |
|
2025 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2026 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2027 |
" |
|
2028 |
||
2029 |
<resource: #menu> |
|
2030 |
||
2031 |
^ |
|
2032 |
#(Menu |
|
2033 |
( |
|
2034 |
(MenuItem |
|
2035 |
label: 'CVS' |
|
2036 |
isVisible: cvsMenusAreShown |
|
2037 |
submenuChannel: cvsMenu |
|
2038 |
) |
|
2039 |
(MenuItem |
|
2040 |
label: 'SVN' |
|
2041 |
isVisible: svnMenusAreShown |
|
2042 |
submenuChannel: svnMenu |
|
2043 |
) |
|
2044 |
(MenuItem |
|
2045 |
label: 'Mercurial' |
|
2046 |
isVisible: mercurialMenusAreShown |
|
2047 |
submenuChannel: mercurialMenu |
|
2048 |
) |
|
2049 |
(MenuItem |
|
2050 |
label: 'HG' |
|
2051 |
isVisible: hgMenusAreShown |
|
2052 |
submenuChannel: hgMenu |
|
2053 |
) |
|
2054 |
(MenuItem |
|
2055 |
label: 'Perforce' |
|
2056 |
isVisible: perforceMenusAreShown |
|
2057 |
submenuChannel: perforceMenu |
|
2058 |
) |
|
2059 |
) |
|
2060 |
nil |
|
2061 |
nil |
|
2062 |
) |
|
2063 |
! |
|
2064 |
||
2065 |
showMenuSpec |
|
2066 |
"This resource specification was automatically generated |
|
2067 |
by the MenuEditor of ST/X." |
|
2068 |
||
2069 |
"Do not manually edit this!! If it is corrupted, |
|
2070 |
the MenuEditor may not be able to read the specification." |
|
2071 |
||
2072 |
" |
|
2073 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2074 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2075 |
" |
|
2076 |
||
2077 |
<resource: #menu> |
|
2078 |
||
2079 |
^ |
|
2080 |
#(Menu |
|
2081 |
( |
|
2082 |
(MenuItem |
|
2083 |
label: 'Hidden Files' |
|
2084 |
translateLabel: true |
|
2085 |
hideMenuOnActivated: false |
|
2086 |
indication: showHiddenFiles |
|
2087 |
) |
|
2088 |
(MenuItem |
|
2089 |
label: '-' |
|
2090 |
) |
|
2091 |
(MenuItem |
|
2092 |
label: 'Directory Tree' |
|
2093 |
translateLabel: true |
|
2094 |
hideMenuOnActivated: false |
|
2095 |
indication: showDirectoryTree |
|
2096 |
) |
|
2097 |
(MenuItem |
|
2098 |
label: 'Regular Files in TreeView (Left)' |
|
2099 |
translateLabel: true |
|
2100 |
hideMenuOnActivated: false |
|
2101 |
indication: viewFilesInDirectoryTree |
|
2102 |
) |
|
2103 |
(MenuItem |
|
2104 |
label: 'Directories in ContentsView (Right)' |
|
2105 |
translateLabel: true |
|
2106 |
hideMenuOnActivated: false |
|
2107 |
indication: viewDirsInContentsBrowser |
|
2108 |
) |
|
2109 |
(MenuItem |
|
2110 |
enabled: enableViewNoteBookApplication |
|
2111 |
label: 'File Applications' |
|
2112 |
translateLabel: true |
|
2113 |
hideMenuOnActivated: false |
|
2114 |
indication: viewNoteBookApplicationHolder |
|
2115 |
) |
|
2116 |
(MenuItem |
|
2117 |
label: '-' |
|
2118 |
) |
|
2119 |
(MenuItem |
|
2120 |
label: 'DiskUsage' |
|
2121 |
translateLabel: true |
|
2122 |
hideMenuOnActivated: false |
|
2123 |
indication: showDiskUsageHolder |
|
2124 |
) |
|
2125 |
) |
|
2126 |
nil |
|
2127 |
nil |
|
2128 |
) |
|
2129 |
! |
|
2130 |
||
2131 |
showMenuSpecForDialog |
|
2132 |
"This resource specification was automatically generated |
|
2133 |
by the MenuEditor of ST/X." |
|
2134 |
||
2135 |
"Do not manually edit this!! If it is corrupted, |
|
2136 |
the MenuEditor may not be able to read the specification." |
|
2137 |
||
2138 |
" |
|
2139 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2140 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2141 |
" |
|
2142 |
||
2143 |
<resource: #menu> |
|
2144 |
||
2145 |
^ |
|
2146 |
#(Menu |
|
2147 |
( |
|
2148 |
(MenuItem |
|
2149 |
label: 'Hidden Files' |
|
2150 |
translateLabel: true |
|
2151 |
hideMenuOnActivated: false |
|
2152 |
indication: showHiddenFiles |
|
2153 |
) |
|
2154 |
) |
|
2155 |
nil |
|
2156 |
nil |
|
2157 |
) |
|
2158 |
! |
|
2159 |
||
2160 |
sortMenu |
|
2161 |
"This resource specification was automatically generated |
|
2162 |
by the MenuEditor of ST/X." |
|
2163 |
||
2164 |
"Do not manually edit this!! If it is corrupted, |
|
2165 |
the MenuEditor may not be able to read the specification." |
|
2166 |
||
2167 |
" |
|
2168 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2169 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2170 |
" |
|
2171 |
||
2172 |
<resource: #menu> |
|
2173 |
||
2174 |
^ |
|
2175 |
#(#Menu |
|
2176 |
#( |
|
2177 |
#(#MenuItem |
|
2178 |
#label: 'By Filename' |
|
2179 |
#translateLabel: true |
|
2180 |
#hideMenuOnActivated: false |
|
2181 |
#choice: #sortBlockProperty |
|
2182 |
#choiceValue: #baseName |
|
2183 |
) |
|
2184 |
#(#MenuItem |
|
2185 |
#label: 'By Extension' |
|
2186 |
#translateLabel: true |
|
2187 |
#hideMenuOnActivated: false |
|
2188 |
#choice: #sortBlockProperty |
|
2189 |
#choiceValue: #suffix |
|
2190 |
) |
|
2191 |
#(#MenuItem |
|
2192 |
#label: 'By Permissions' |
|
2193 |
#translateLabel: true |
|
2194 |
#hideMenuOnActivated: false |
|
2195 |
#choice: #sortBlockProperty |
|
2196 |
#choiceValue: #permissions |
|
2197 |
) |
|
2198 |
#(#MenuItem |
|
2199 |
#label: 'By Owner' |
|
2200 |
#translateLabel: true |
|
2201 |
#isVisible: #viewOwner |
|
2202 |
#hideMenuOnActivated: false |
|
2203 |
#choice: #sortBlockProperty |
|
2204 |
#choiceValue: #owner |
|
2205 |
) |
|
2206 |
#(#MenuItem |
|
2207 |
#label: 'By Group' |
|
2208 |
#translateLabel: true |
|
2209 |
#isVisible: #viewOwner |
|
2210 |
#hideMenuOnActivated: false |
|
2211 |
#choice: #sortBlockProperty |
|
2212 |
#choiceValue: #group |
|
2213 |
) |
|
2214 |
#(#MenuItem |
|
2215 |
#label: 'By Size' |
|
2216 |
#translateLabel: true |
|
2217 |
#hideMenuOnActivated: false |
|
2218 |
#choice: #sortBlockProperty |
|
2219 |
#choiceValue: #fileSize |
|
2220 |
) |
|
2221 |
#(#MenuItem |
|
2222 |
#label: 'By Date && Time' |
|
2223 |
#translateLabel: true |
|
2224 |
#hideMenuOnActivated: false |
|
2225 |
#choice: #sortBlockProperty |
|
2226 |
#choiceValue: #modificationTime |
|
2227 |
) |
|
2228 |
#(#MenuItem |
|
2229 |
#label: '-' |
|
2230 |
) |
|
2231 |
#(#MenuItem |
|
2232 |
#label: 'Ignore Case in Sort' |
|
2233 |
#translateLabel: true |
|
2234 |
#hideMenuOnActivated: false |
|
2235 |
#indication: #sortCaseless |
|
2236 |
) |
|
2237 |
#(#MenuItem |
|
2238 |
#label: 'Directories before Files' |
|
2239 |
#translateLabel: true |
|
2240 |
#hideMenuOnActivated: false |
|
2241 |
#indication: #sortDirectoriesBeforeFiles |
|
2242 |
) |
|
2243 |
) |
|
2244 |
nil |
|
2245 |
nil |
|
2246 |
) |
|
2247 |
! |
|
2248 |
||
2249 |
toolsMenuSpec |
|
2250 |
"This resource specification was automatically generated |
|
2251 |
by the MenuEditor of ST/X." |
|
2252 |
||
2253 |
"Do not manually edit this!! If it is corrupted, |
|
2254 |
the MenuEditor may not be able to read the specification." |
|
2255 |
||
2256 |
||
2257 |
" |
|
2258 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2259 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2260 |
" |
|
2261 |
||
2262 |
<resource: #menu> |
|
2263 |
||
2264 |
^ |
|
2265 |
#(Menu |
|
2266 |
( |
|
2267 |
(MenuItem |
|
2268 |
label: 'Open (Win32-Shell)' |
|
2269 |
itemValue: doOpenWithShellCommand |
|
2270 |
isVisible: systemIsDOS |
|
2271 |
) |
|
2272 |
(MenuItem |
|
2273 |
label: 'Execute UNIX Command...' |
|
2274 |
itemValue: doExecuteCommand |
|
2275 |
isVisible: systemIsUnix |
|
2276 |
) |
|
2277 |
(MenuItem |
|
2278 |
label: 'Execute DOS Command...' |
|
2279 |
itemValue: doExecuteCommand |
|
2280 |
isVisible: systemIsDOS |
|
2281 |
) |
|
2282 |
(MenuItem |
|
2283 |
label: 'Execute Script...' |
|
2284 |
itemValue: doExecuteScript |
|
2285 |
) |
|
2286 |
(MenuItem |
|
2287 |
enabled: canDoTerminal |
|
2288 |
label: 'Shell Terminal' |
|
2289 |
itemValue: openTerminal |
|
2290 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2291 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2292 |
) |
|
2293 |
(MenuItem |
|
2294 |
enabled: canDoTerminal |
|
2295 |
label: 'DOS Terminal' |
|
2296 |
itemValue: openTerminal |
|
2297 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2298 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2299 |
) |
|
2300 |
(MenuItem |
|
2301 |
label: '-' |
|
2302 |
) |
|
2303 |
(MenuItem |
|
2304 |
enabled: hasFileSelection |
|
2305 |
label: 'Changes Browser' |
|
2306 |
itemValue: openChangesBrowser |
|
2307 |
) |
|
2308 |
(MenuItem |
|
2309 |
enabled: hasFileSelection |
|
2310 |
label: 'ChangeSet Browser' |
|
2311 |
itemValue: openChangeSetBrowser |
|
2312 |
isVisible: changeSetBrowserItemVisible |
|
2313 |
) |
|
2314 |
(MenuItem |
|
2315 |
enabled: hasFileSelection |
|
2316 |
label: 'Workspace' |
|
2317 |
itemValue: openWorkspace |
|
2318 |
) |
|
2319 |
(MenuItem |
|
2320 |
label: '-' |
|
2321 |
) |
|
2322 |
(MenuItem |
|
2323 |
enabled: canReadAbbrevFile |
|
2324 |
label: 'Install Autoloaded' |
|
2325 |
itemValue: readAbbrevFile |
|
2326 |
) |
|
2327 |
(MenuItem |
|
2328 |
enabled: anySTFilesPresent |
|
2329 |
label: 'Install all ST-Files as Autoloaded' |
|
2330 |
itemValue: installAllAsAutoloaded |
|
2331 |
) |
|
2332 |
(MenuItem |
|
2333 |
enabled: recursiveAnySTFilesPresent |
|
2334 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2335 |
itemValue: installAllAsAutoloadedRecursive |
|
2336 |
) |
|
2337 |
(MenuItem |
|
2338 |
label: '-' |
|
2339 |
) |
|
2340 |
(MenuItem |
|
2341 |
enabled: hasJava |
|
2342 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2343 |
itemValue: addDirToJavaSourcePath |
|
2344 |
) |
|
2345 |
(MenuItem |
|
2346 |
enabled: hasJava |
|
2347 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2348 |
itemValue: fileAddToJavaSourcePath |
|
2349 |
) |
|
2350 |
(MenuItem |
|
2351 |
label: '-' |
|
2352 |
) |
|
2353 |
(MenuItem |
|
2354 |
label: 'File Operations' |
|
2355 |
submenuChannel: fileOpMenu |
|
2356 |
) |
|
2357 |
(MenuItem |
|
2358 |
label: 'File Utilities' |
|
2359 |
submenu: |
|
2360 |
(Menu |
|
2361 |
( |
|
2362 |
(MenuItem |
|
2363 |
enabled: hasFileSelection |
|
2364 |
label: 'Editor' |
|
2365 |
itemValue: openEditor |
|
2366 |
) |
|
2367 |
(MenuItem |
|
2368 |
enabled: hasFileSelection |
|
2369 |
label: 'HTML Reader' |
|
2370 |
itemValue: openHTMLReader |
|
2371 |
) |
|
2372 |
(MenuItem |
|
2373 |
enabled: hasFileSelection |
|
2374 |
label: 'Web Browser' |
|
2375 |
itemValue: openWebBrowser |
|
2376 |
) |
|
2377 |
(MenuItem |
|
2378 |
label: 'XML Inspector' |
|
2379 |
itemValue: inspectXmlFile |
|
2380 |
isVisible: hasXml |
|
2381 |
showBusyCursorWhilePerforming: true |
|
2382 |
) |
|
2383 |
(MenuItem |
|
2384 |
enabled: hasFileSelection |
|
2385 |
label: 'Acroread (PDF Viewer)' |
|
2386 |
itemValue: openPDFViewer |
|
2387 |
) |
|
2388 |
(MenuItem |
|
2389 |
enabled: hasASN1AndSelection |
|
2390 |
label: 'ASN1 Browser' |
|
2391 |
itemValue: openASN1Browser |
|
2392 |
isVisible: hasASN1 |
|
2393 |
) |
|
2394 |
(MenuItem |
|
2395 |
enabled: hasCBrowser |
|
2396 |
label: 'C Browser' |
|
2397 |
itemValue: openCBrowser |
|
2398 |
isVisible: hasCBrowser |
|
2399 |
) |
|
2400 |
(MenuItem |
|
2401 |
enabled: canOpenMonticelloBrowser |
|
2402 |
label: 'Monticello Browser' |
|
2403 |
itemValue: doOpenMonticelloBrowser |
|
2404 |
) |
|
2405 |
(MenuItem |
|
2406 |
enabled: hasJavaAndSelection |
|
2407 |
label: 'Applet Viewer' |
|
2408 |
itemValue: openAppletViewer |
|
2409 |
isVisible: hasJava |
|
2410 |
) |
|
2411 |
(MenuItem |
|
2412 |
enabled: hasMP3PlayerAndSelection |
|
2413 |
label: 'MP3 Player' |
|
2414 |
itemValue: openMP3Player |
|
2415 |
isVisible: hasMP3Player |
|
2416 |
) |
|
2417 |
(MenuItem |
|
2418 |
enabled: hasFileSelection |
|
2419 |
label: 'xv (Image Viewer)' |
|
2420 |
itemValue: openXV |
|
2421 |
isVisible: systemIsUnix |
|
2422 |
) |
|
2423 |
(MenuItem |
|
2424 |
enabled: currentFilesAreInSameDirectory |
|
2425 |
label: 'Slide Show' |
|
2426 |
itemValue: openSlideShow |
|
2427 |
isVisible: hasSlideShow |
|
2428 |
) |
|
2429 |
(MenuItem |
|
2430 |
enabled: hasFileSelection |
|
2431 |
label: 'gv (Postscript Viewer)' |
|
2432 |
itemValue: openGV |
|
2433 |
isVisible: systemIsUnix |
|
2434 |
) |
|
2435 |
(MenuItem |
|
2436 |
enabled: hasMP3PlayerAndSelection |
|
2437 |
label: 'MP3 Player' |
|
2438 |
itemValue: openMP3Player |
|
2439 |
isVisible: hasMP3Player |
|
2440 |
) |
|
2441 |
(MenuItem |
|
2442 |
enabled: hasFileSelection |
|
2443 |
label: 'Realplay (avi viewer)' |
|
2444 |
itemValue: openRP |
|
2445 |
isVisible: systemIsUnix |
|
2446 |
) |
|
2447 |
(MenuItem |
|
2448 |
label: '-' |
|
2449 |
) |
|
2450 |
(MenuItem |
|
2451 |
label: 'Smalltalk' |
|
2452 |
submenu: |
|
2453 |
(Menu |
|
2454 |
( |
|
2455 |
(MenuItem |
|
2456 |
enabled: hasSnapshotSelection |
|
2457 |
label: 'Snapshot Image Browser' |
|
2458 |
itemValue: openSnapshotImageBrowser |
|
2459 |
) |
|
2460 |
(MenuItem |
|
2461 |
enabled: canCreateNewProject |
|
2462 |
label: 'Create Smalltalk Project' |
|
2463 |
itemValue: createProjectAndOpenProjectBrowser |
|
2464 |
) |
|
2465 |
(MenuItem |
|
2466 |
label: '-' |
|
2467 |
) |
|
2468 |
(MenuItem |
|
2469 |
enabled: hasResourceFileSelected |
|
2470 |
label: 'Show Contents of Resourcefile' |
|
2471 |
itemValue: readAndShowResources |
|
2472 |
) |
|
2473 |
(MenuItem |
|
2474 |
enabled: hasResourceFileSelected |
|
2475 |
label: 'Resource File Editor' |
|
2476 |
itemValue: openResourceFileEditor |
|
2477 |
showBusyCursorWhilePerforming: true |
|
2478 |
) |
|
2479 |
(MenuItem |
|
2480 |
label: '-' |
|
2481 |
) |
|
2482 |
(MenuItem |
|
2483 |
enabled: hasFileSelection |
|
2484 |
label: 'Contents as ByteArray' |
|
2485 |
itemValue: fileContentsAsByteArray |
|
2486 |
) |
|
2487 |
) |
|
2488 |
nil |
|
2489 |
nil |
|
2490 |
) |
|
2491 |
) |
|
2492 |
(MenuItem |
|
2493 |
label: 'Image' |
|
2494 |
submenu: |
|
2495 |
(Menu |
|
2496 |
( |
|
2497 |
(MenuItem |
|
2498 |
enabled: hasFileSelection |
|
2499 |
label: 'Image Editor' |
|
2500 |
itemValue: openImageEditor |
|
2501 |
) |
|
2502 |
(MenuItem |
|
2503 |
enabled: hasFileSelection |
|
2504 |
label: 'Image Preview' |
|
2505 |
itemValue: openImagePreview |
|
2506 |
) |
|
2507 |
(MenuItem |
|
2508 |
enabled: hasFileSelection |
|
2509 |
label: 'Image Inspector' |
|
2510 |
itemValue: openImageInspector |
|
2511 |
) |
|
2512 |
(MenuItem |
|
2513 |
label: '-' |
|
2514 |
) |
|
2515 |
(MenuItem |
|
2516 |
enabled: hasFileSelection |
|
2517 |
label: 'Convert to GIF' |
|
2518 |
itemValue: convertImageToGIF |
|
2519 |
) |
|
2520 |
(MenuItem |
|
2521 |
enabled: hasFileSelection |
|
2522 |
label: 'Convert to PNG' |
|
2523 |
itemValue: convertImageToPNG |
|
2524 |
) |
|
2525 |
(MenuItem |
|
2526 |
enabled: hasFileSelection |
|
2527 |
label: 'Convert to XPM' |
|
2528 |
itemValue: convertImageToXPM |
|
2529 |
) |
|
2530 |
(MenuItem |
|
2531 |
enabled: hasFileSelection |
|
2532 |
label: 'Convert to JPG' |
|
2533 |
itemValue: convertImageToJPG |
|
2534 |
) |
|
2535 |
) |
|
2536 |
nil |
|
2537 |
nil |
|
2538 |
) |
|
2539 |
) |
|
2540 |
(MenuItem |
|
15528 | 2541 |
label: 'Web' |
2542 |
submenu: |
|
2543 |
(Menu |
|
2544 |
( |
|
2545 |
(MenuItem |
|
2546 |
label: 'Fetch File by URL...' |
|
2547 |
itemValue: fetchFileByURL |
|
2548 |
) |
|
2549 |
) |
|
2550 |
nil |
|
2551 |
nil |
|
2552 |
) |
|
2553 |
) |
|
2554 |
(MenuItem |
|
15211 | 2555 |
enabled: hasZipFileSelectedHolder |
2556 |
label: 'ZipFile Tool' |
|
2557 |
itemValue: openZipTool |
|
2558 |
) |
|
2559 |
(MenuItem |
|
2560 |
enabled: hasFileSelection |
|
2561 |
label: 'Hex Dump' |
|
2562 |
itemValue: fileHexDump |
|
2563 |
) |
|
2564 |
) |
|
2565 |
nil |
|
2566 |
nil |
|
2567 |
) |
|
2568 |
) |
|
2569 |
(MenuItem |
|
2570 |
label: 'Find' |
|
2571 |
submenu: |
|
2572 |
(Menu |
|
2573 |
( |
|
2574 |
(MenuItem |
|
2575 |
label: 'File...' |
|
2576 |
itemValue: fileFindFile |
|
2577 |
) |
|
2578 |
(MenuItem |
|
2579 |
enabled: hasFileSelection |
|
2580 |
label: 'Same Contents as Selected...' |
|
2581 |
itemValue: fileFindDuplicateFile |
|
2582 |
) |
|
2583 |
(MenuItem |
|
2584 |
label: 'Duplicate Files' |
|
2585 |
itemValue: fileFindDuplicates |
|
2586 |
) |
|
2587 |
(MenuItem |
|
2588 |
enabled: hasSelection |
|
2589 |
label: 'All Duplicate Files (Recursive)' |
|
2590 |
itemValue: fileFindAllDuplicates |
|
2591 |
) |
|
2592 |
(MenuItem |
|
2593 |
label: 'Similar Image Files' |
|
2594 |
itemValue: fileFindSimilarImages |
|
2595 |
isVisible: hasImageColorHistogram |
|
2596 |
) |
|
2597 |
) |
|
2598 |
nil |
|
2599 |
nil |
|
2600 |
) |
|
2601 |
) |
|
2602 |
) |
|
2603 |
nil |
|
2604 |
nil |
|
2605 |
) |
|
2606 |
! |
|
2607 |
||
2608 |
viewDetailsMenuSpec |
|
2609 |
"This resource specification was automatically generated |
|
2610 |
by the MenuEditor of ST/X." |
|
2611 |
||
2612 |
"Do not manually edit this!! If it is corrupted, |
|
2613 |
the MenuEditor may not be able to read the specification." |
|
2614 |
||
2615 |
" |
|
2616 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2617 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2618 |
" |
|
2619 |
||
2620 |
<resource: #menu> |
|
2621 |
||
2622 |
^ |
|
2623 |
#(#Menu |
|
2624 |
#( |
|
2625 |
#(#MenuItem |
|
2626 |
#label: '-' |
|
2627 |
) |
|
2628 |
#(#MenuItem |
|
2629 |
#label: 'Hidden Files' |
|
2630 |
#translateLabel: true |
|
2631 |
#indication: #showHiddenFiles |
|
2632 |
) |
|
2633 |
) |
|
2634 |
nil |
|
2635 |
nil |
|
2636 |
) |
|
2637 |
! ! |
|
3892 | 2638 |
|
11144 | 2639 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2640 |
||
15211 | 2641 |
cvsMenu |
2642 |
"This resource specification was automatically generated |
|
2643 |
by the MenuEditor of ST/X." |
|
2644 |
||
2645 |
"Do not manually edit this!! If it is corrupted, |
|
2646 |
the MenuEditor may not be able to read the specification." |
|
2647 |
||
2648 |
||
2649 |
" |
|
2650 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2651 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2652 |
" |
|
2653 |
||
2654 |
<resource: #menu> |
|
2655 |
||
2656 |
^ |
|
2657 |
#(Menu |
|
2658 |
( |
|
2659 |
(MenuItem |
|
2660 |
label: 'Commit (CVS)...' |
|
2661 |
itemValue: cvsCommit |
|
2662 |
translateLabel: true |
|
2663 |
) |
|
2664 |
(MenuItem |
|
2665 |
enabled: canCvsAddAndCommit |
|
2666 |
label: 'Add && Commit...' |
|
2667 |
itemValue: cvsAddAndCommit |
|
2668 |
translateLabel: true |
|
2669 |
) |
|
2670 |
(MenuItem |
|
2671 |
enabled: canCvsAddAndCommit |
|
2672 |
label: 'Add as Binary && Commit...' |
|
2673 |
itemValue: cvsAddBinaryAndCommit |
|
2674 |
translateLabel: true |
|
2675 |
) |
|
2676 |
(MenuItem |
|
2677 |
label: 'Commit Folder (CVS)...' |
|
2678 |
itemValue: cvsCommitFolder |
|
2679 |
translateLabel: true |
|
2680 |
) |
|
2681 |
(MenuItem |
|
2682 |
label: '-' |
|
2683 |
) |
|
2684 |
(MenuItem |
|
2685 |
enabled: hasSelection |
|
2686 |
label: 'Update selected Files/Directories' |
|
2687 |
itemValue: cvsUpdateSelection |
|
2688 |
translateLabel: true |
|
2689 |
) |
|
2690 |
(MenuItem |
|
2691 |
label: 'Update Directory Local' |
|
2692 |
itemValue: cvsUpdateAll |
|
2693 |
translateLabel: true |
|
2694 |
) |
|
2695 |
(MenuItem |
|
2696 |
label: 'Update Directory Recursive' |
|
2697 |
itemValue: cvsUpdateAllRecursive |
|
2698 |
translateLabel: true |
|
2699 |
) |
|
2700 |
(MenuItem |
|
2701 |
label: '-' |
|
2702 |
) |
|
2703 |
(MenuItem |
|
2704 |
enabled: hasSelection |
|
2705 |
label: 'Tag...' |
|
2706 |
itemValue: cvsTagSelection |
|
2707 |
translateLabel: true |
|
2708 |
) |
|
2709 |
(MenuItem |
|
2710 |
enabled: hasSelection |
|
2711 |
label: 'Revision Log' |
|
2712 |
itemValue: cvsRevisionLog |
|
2713 |
translateLabel: true |
|
2714 |
) |
|
2715 |
(MenuItem |
|
2716 |
enabled: hasSelection |
|
2717 |
label: 'Compare with newest in Repository' |
|
2718 |
itemValue: cvsCompareWithNewest |
|
2719 |
translateLabel: true |
|
2720 |
) |
|
2721 |
(MenuItem |
|
2722 |
label: '-' |
|
2723 |
) |
|
2724 |
(MenuItem |
|
2725 |
enabled: canRemoveCVSContainer |
|
2726 |
label: 'Remove File && CVS Container...' |
|
2727 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2728 |
translateLabel: true |
|
2729 |
) |
|
2730 |
) |
|
2731 |
nil |
|
2732 |
nil |
|
2733 |
) |
|
2734 |
! |
|
2735 |
||
2736 |
mercurialMenu |
|
2737 |
"This resource specification was automatically generated |
|
2738 |
by the MenuEditor of ST/X." |
|
2739 |
||
2740 |
"Do not manually edit this!! If it is corrupted, |
|
2741 |
the MenuEditor may not be able to read the specification." |
|
2742 |
||
2743 |
||
2744 |
" |
|
2745 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2746 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2747 |
" |
|
2748 |
||
2749 |
<resource: #menu> |
|
2750 |
||
2751 |
^ |
|
2752 |
#(Menu |
|
2753 |
( |
|
2754 |
(MenuItem |
|
2755 |
label: 'Add' |
|
2756 |
itemValue: mercurialAdd |
|
2757 |
translateLabel: true |
|
2758 |
) |
|
2759 |
(MenuItem |
|
2760 |
label: 'Commit Changes' |
|
2761 |
itemValue: mercurialCommit |
|
2762 |
translateLabel: true |
|
2763 |
) |
|
2764 |
(MenuItem |
|
2765 |
label: 'Push...' |
|
2766 |
itemValue: mercurialPush |
|
2767 |
translateLabel: true |
|
2768 |
) |
|
2769 |
(MenuItem |
|
2770 |
label: 'Status' |
|
2771 |
itemValue: mercurialStatus |
|
2772 |
translateLabel: true |
|
2773 |
) |
|
2774 |
(MenuItem |
|
2775 |
label: '-' |
|
2776 |
) |
|
2777 |
(MenuItem |
|
2778 |
label: 'Init' |
|
2779 |
itemValue: mercurialInit |
|
2780 |
translateLabel: true |
|
2781 |
) |
|
2782 |
) |
|
2783 |
nil |
|
2784 |
nil |
|
2785 |
) |
|
2786 |
||
2787 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2788 |
! |
|
2789 |
||
2790 |
perforceMenu |
|
2791 |
"This resource specification was automatically generated |
|
2792 |
by the MenuEditor of ST/X." |
|
2793 |
||
2794 |
"Do not manually edit this!! If it is corrupted, |
|
2795 |
the MenuEditor may not be able to read the specification." |
|
2796 |
||
2797 |
||
2798 |
" |
|
2799 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2800 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2801 |
" |
|
2802 |
||
2803 |
<resource: #menu> |
|
2804 |
||
2805 |
^ |
|
2806 |
#(Menu |
|
2807 |
( |
|
2808 |
(MenuItem |
|
2809 |
label: 'Commit' |
|
2810 |
itemValue: perforceCommit |
|
2811 |
translateLabel: true |
|
2812 |
) |
|
2813 |
) |
|
2814 |
nil |
|
2815 |
nil |
|
2816 |
) |
|
2817 |
||
2818 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2819 |
! ! |
|
11144 | 2820 |
|
3892 | 2821 |
!AbstractFileBrowser class methodsFor:'misc'! |
2822 |
||
2823 |
newLock |
|
2824 |
^ CodeExecutionLock new |
|
2825 |
! ! |
|
2826 |
||
17288 | 2827 |
!AbstractFileBrowser class methodsFor:'queries'! |
2828 |
||
2829 |
isAbstract |
|
2830 |
^ self == AbstractFileBrowser |
|
2831 |
! ! |
|
2832 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2833 |
!AbstractFileBrowser class methodsFor:'resources'! |
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 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2836 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2837 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2838 |
|
4610 | 2839 |
!AbstractFileBrowser class methodsFor:'utilities'! |
2840 |
||
11262 | 2841 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart |
2842 |
"utility helper: generate a hexDump with addresses" |
|
2843 |
||
17252 | 2844 |
|lines nHexLines replacementForUnprintable| |
2845 |
||
2846 |
"/ used to be: |
|
2847 |
"/ replacementForUnprintable := $. |
|
2848 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2849 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2850 |
"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
|
2851 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2852 |
nHexLines := (data size + 15) // 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2853 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2854 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2855 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2856 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2857 |
generator:[:lineNr | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2858 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line| |
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 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2861 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2862 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2863 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2864 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2865 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2866 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2867 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2868 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2869 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2870 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2871 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2872 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2873 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2874 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2875 |
(startOffset + i) > data size ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2876 |
asciiLineStream nextPut:(Character space). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2877 |
lineStream nextPutAll:' '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2878 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2879 |
byte := data at:startOffset + i. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2880 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2881 |
lineStream nextPutAll:(byte hexPrintString:2). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2882 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2883 |
(byte between:32 and:127) ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2884 |
asciiLineStream nextPut:(Character value:byte) |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2885 |
] ifFalse:[ |
16188 | 2886 |
(byte between:0 and:31) ifTrue:[ |
2887 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
17252 | 2888 |
"/ are perfect here, but usually not available in the font |
2889 |
"/ and we have currently no way of knowing if they are... |
|
2890 |
"/ (could let the font draw into abitmap and check if there is something...) |
|
2891 |
"/ therefore, for now, write a dot.· |
|
16188 | 2892 |
"/ asciiLineStream nextPut:(Character value:(byte + 16r2400)) |
17252 | 2893 |
asciiLineStream nextPut:replacementForUnprintable. |
16188 | 2894 |
] ifFalse:[ |
17252 | 2895 |
asciiLineStream nextPut:replacementForUnprintable. |
16188 | 2896 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2897 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2898 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2899 |
]. |
12421 | 2900 |
line := (lineStream contents paddedTo:(addrDigits + 1 + (3*16)+ 8)) |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2901 |
, asciiLineStream contents. |
11262 | 2902 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2903 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2904 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2905 |
^ 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 |
"/ |offs |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2908 |
"/ col line lineStream asciiLineStream lines| |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2909 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2910 |
"/ col := 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2911 |
"/ offs := virtualStart. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2912 |
"/ lines := StringCollection new. |
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 := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2915 |
"/ asciiLineStream := String writeStream. |
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 |
"/ lineStream nextPutAll:(offs hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2918 |
"/ lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2919 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2920 |
"/ data do:[:byte | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2921 |
"/ lineStream nextPutAll:(byte hexPrintString:2). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2922 |
"/ (byte between:32 and:127) ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2923 |
"/ asciiLineStream nextPut:(Character value:byte) |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2924 |
"/ ] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2925 |
"/ asciiLineStream nextPut:$. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2926 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2927 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2928 |
"/ offs := offs + 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2929 |
"/ col := col + 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2930 |
"/ col > 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2931 |
"/ lineStream nextPutAll:' '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2932 |
"/ lineStream nextPutAll:asciiLineStream contents. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2933 |
"/ lines add:(lineStream contents). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2934 |
"/ (offs bitAnd:16rFF) == 0 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2935 |
"/ lines add:nil |
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 reset. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2938 |
"/ asciiLineStream reset. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2939 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2940 |
"/ lineStream nextPutAll:(offs hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2941 |
"/ lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2942 |
"/ col := 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2943 |
"/ ] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2944 |
"/ lineStream space |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2945 |
"/ ] |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2946 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2947 |
"/ line := lineStream contents paddedTo:(3*16 + addrDigits + 1). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2948 |
"/ lines add:(line , ' ' , asciiLineStream contents). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2949 |
"/ ^ lines |
11262 | 2950 |
|
2951 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
2952 |
! |
|
2953 |
||
4610 | 2954 |
contentsOfFileAsHexDump:f |
8472 | 2955 |
^ self contentsOfFileAsHexDump:f withLimit:nil lastPart:nil |
2956 |
! |
|
2957 |
||
2958 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
4610 | 2959 |
|resources fileName stream data offs |
11262 | 2960 |
addrDigits col lines answer sizeLimit showLastPart| |
4610 | 2961 |
|
2962 |
resources := self classResources. |
|
2963 |
||
2964 |
fileName := f baseName. |
|
2965 |
f isDirectory ifTrue:[ |
|
2966 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
2967 |
^ nil |
|
2968 |
]. |
|
2969 |
f exists ifFalse:[ |
|
2970 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2971 |
^ nil |
|
2972 |
]. |
|
2973 |
f isReadable ifFalse:[ |
|
2974 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
2975 |
^ nil |
|
2976 |
]. |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
2977 |
f fileSize > (1024*1024) ifTrue:[ |
8472 | 2978 |
limitOrNil notNil ifTrue:[ |
2979 |
sizeLimit := limitOrNil. |
|
2980 |
showLastPart := showLastPartOrNil |
|
2981 |
] ifFalse:[ |
|
2982 |
answer := Dialog |
|
2983 |
confirmWithCancel:(resources |
|
2984 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
2985 |
with:(fileName contractTo:40) allBold |
|
2986 |
with:(UnitConverter fileSizeStringFor:f fileSize)) |
|
2987 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
2988 |
||
2989 |
answer isNil ifTrue:[^ nil]. |
|
2990 |
answer ifTrue:[ |
|
2991 |
sizeLimit := 4 * 1024 * 1024 |
|
2992 |
]. |
|
8436 | 2993 |
]. |
4610 | 2994 |
]. |
2995 |
||
2996 |
stream := f readStream binary. |
|
8436 | 2997 |
sizeLimit notNil ifTrue:[ |
8472 | 2998 |
showLastPart == true ifTrue:[ |
2999 |
stream position:(f fileSize - sizeLimit). |
|
3000 |
]. |
|
8436 | 3001 |
data := stream nextBytes:sizeLimit. |
3002 |
] ifFalse:[ |
|
3003 |
data := stream contents. |
|
3004 |
]. |
|
4610 | 3005 |
stream close. |
3006 |
||
3007 |
col := 1. |
|
3008 |
offs := 0. |
|
3009 |
lines := StringCollection new. |
|
3010 |
||
3011 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3012 |
||
11262 | 3013 |
^ self |
3014 |
contentsOfBytesAsHexDump:data |
|
3015 |
numberOfAddressDigits:addrDigits |
|
3016 |
addressStart:0 |
|
3017 |
||
3018 |
"Modified: / 13-02-2012 / 15:01:19 / cg" |
|
4610 | 3019 |
! ! |
3020 |
||
3892 | 3021 |
!AbstractFileBrowser methodsFor:'actions'! |
3022 |
||
3023 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3024 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3025 |
Then evaluate aBlock passing the command-string as argument." |
3026 |
||
16160 | 3027 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3028 |
|
3029 |
osName := OperatingSystem platformName. |
|
3030 |
||
3031 |
box := FilenameEnterBox |
|
4414 | 3032 |
title:(resources string:'Execute %1 command:' with:osName) |
3033 |
okText:(resources string:'Execute') |
|
4523 | 3034 |
action:[:cmd | commandString := cmd]. |
3892 | 3035 |
|
3036 |
fileName notNil ifTrue:[ |
|
4414 | 3037 |
self initialCommandFor:fileName into:box. |
3892 | 3038 |
]. |
16160 | 3039 |
alwaysOpenLikeThisHolder := false asValue. |
3040 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3041 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3042 |
box open. |
3043 |
||
3044 |
"/ box destroy. |
|
3045 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3046 |
openCmd := commandString upTo:$". |
|
3047 |
suffix := fileName suffix. |
|
16306 | 3048 |
UserPreferences current |
3049 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3050 |
beModified. |
|
3051 |
self breakPoint:#cg. |
|
16160 | 3052 |
]. |
3053 |
||
4523 | 3054 |
commandString notNil ifTrue:[ |
3055 |
aBlock value:commandString |
|
3056 |
]. |
|
3057 |
||
3892 | 3058 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3059 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3060 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3061 |
! |
|
3062 |
||
3063 |
changeFileBrowserTitleTo:aString |
|
4774 | 3064 |
self |
3065 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3066 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3067 |
! |
3068 |
||
3069 |
copyFileList |
|
4774 | 3070 |
"copy the fileList to the clipBoard" |
3071 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3072 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3073 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3074 |
fileList := self |
4774 | 3075 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3076 |
ifPresentDo:[:app | app browserFileList]. |
3077 |
||
3078 |
fileList notNil ifTrue:[ |
|
3079 |
self copyFileListToClipBoard:fileList. |
|
3080 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3081 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3082 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3083 |
copyFileListToClipBoard:fileList |
4774 | 3084 |
"copy the itemList to the clipBoard" |
3085 |
||
3086 |
|stream| |
|
3087 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3088 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3089 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3090 |
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
|
3091 |
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
|
3092 |
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
|
3093 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3094 |
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
|
3095 |
(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
|
3096 |
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
|
3097 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3098 |
]. |
3892 | 3099 |
]. |
6034 | 3100 |
self window setClipboardText:stream contents. |
3892 | 3101 |
! |
3102 |
||
3103 |
copySelectedFilenames |
|
4774 | 3104 |
"copy the selected fileNames to the clipBoard" |
3105 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3106 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3107 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3108 |
fileList := self |
4774 | 3109 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3110 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3111 |
fileList notNil ifTrue:[ |
|
3112 |
self copyFileListToClipBoard:fileList. |
|
3113 |
]. |
|
3892 | 3114 |
! |
3115 |
||
10923 | 3116 |
doAddArchiver |
3117 |
|files| |
|
3118 |
||
3119 |
files := self currentSelectedFiles. |
|
3120 |
files size == 1 ifFalse:[ |
|
3121 |
Dialog information:'Select exactly one archive.'. |
|
3122 |
^ self |
|
3123 |
]. |
|
3124 |
||
3125 |
self |
|
3126 |
applicationNamed:#FileApplicationNoteBook |
|
3127 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3128 |
||
3129 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
3130 |
! |
|
3131 |
||
3892 | 3132 |
doAddTerminal |
5960 | 3133 |
|dir| |
3134 |
||
3135 |
dir := self currentDirectory. |
|
3892 | 3136 |
|
5960 | 3137 |
dir isNil ifTrue:[ |
4414 | 3138 |
dir := Filename homeDirectory |
3892 | 3139 |
]. |
4774 | 3140 |
|
5009 | 3141 |
self |
3142 |
applicationNamed:#FileApplicationNoteBook |
|
3143 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 3144 |
! |
3145 |
||
3146 |
doOpenSearchFile |
|
5961 | 3147 |
|item file| |
3148 |
||
3149 |
file := self firstSelectedFileName. |
|
3150 |
file isNil ifTrue:[ |
|
3151 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3152 |
]. |
|
3153 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3154 |
self openSearchFileOn:item. |
3155 |
! |
|
3156 |
||
3157 |
doShowFileContents |
|
5009 | 3158 |
self |
3159 |
applicationNamed:#DirectoryContentsBrowser |
|
3160 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3161 |
||
3162 |
^ nil |
|
3892 | 3163 |
! |
3164 |
||
3165 |
doShowProperties |
|
3166 |
"show long stat (file)-info" |
|
3167 |
||
3168 |
self fileGetInfo:true |
|
3169 |
! |
|
3170 |
||
14577 | 3171 |
enterAction |
3172 |
self |
|
3173 |
applicationNamed:#DirectoryContentsBrowser |
|
3174 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3175 |
! |
|
3176 |
||
5528 | 3177 |
fileEncodingDialog |
14497 | 3178 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3179 |
Files are converted to internal encoding when read, and converted back |
3180 |
to this encoding when saved. |
|
3181 |
Notice: currently, not too many encodings are supported by the system." |
|
3182 |
||
3183 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3184 |
||
3185 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3186 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3187 |
||
3188 |
bindings := IdentityDictionary new. |
|
3189 |
bindings at:#encodingList put:encodingDescr. |
|
3190 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3191 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3192 |
||
5528 | 3193 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3194 |
ifTrue:[ |
|
3195 |
idx := (bindings at:#selectedEncoding) value. |
|
3196 |
selectedEncoding := encodings at:idx. |
|
3197 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3198 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3199 |
]. |
5737 | 3200 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3201 |
]. |
3202 |
||
3203 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3204 |
! |
|
3205 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3206 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3207 |
"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
|
3208 |
|
5959 | 3209 |
|currentFileNameHolder currentSel| |
3210 |
||
3211 |
currentFileNameHolder := self currentFileNameHolder. |
|
3212 |
||
3213 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3214 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3215 |
self withWaitCursorDo:[ |
3216 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3217 |
] |
|
3218 |
]. |
|
3219 |
||
3220 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3221 |
! |
3222 |
||
11053 | 3223 |
lineEndConventionDialog |
3224 |
"open a dialog to allow change of the line end conventions |
|
3225 |
(when writing files)" |
|
3226 |
||
3227 |
|bindings| |
|
3228 |
||
3229 |
bindings := IdentityDictionary new. |
|
3230 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3231 |
||
3232 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3233 |
ifTrue:[ |
|
15208 | 3234 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3235 |
]. |
3236 |
||
3237 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3238 |
! |
|
3239 |
||
4392 | 3240 |
newTextEditor |
5009 | 3241 |
self |
3242 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3243 |
ifPresentDo:[:appl | |
3244 |
|editor files item| |
|
3245 |
||
3246 |
editor := appl newTextEditor. |
|
3247 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3248 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3249 |
editor item:item. |
|
3250 |
]. |
|
3251 |
^ editor |
|
3252 |
]. |
|
5009 | 3253 |
|
3254 |
^ nil. |
|
3255 |
! |
|
3256 |
||
3257 |
openApplByFileItem:anItem |
|
8490 | 3258 |
"/ q: is the following always wanted ? |
9267 | 3259 |
self window sensor shiftDown ifFalse:[ |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3260 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3261 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3262 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3263 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3264 |
"/ ]. |
9267 | 3265 |
|
8490 | 3266 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3267 |
"/ Error handle:[:ex | |
|
3268 |
"/ ] do:[ |
|
3269 |
"/ OperatingSystem |
|
3270 |
"/ shellExecute:nil |
|
3271 |
"/ lpOperation:'open' |
|
3272 |
"/ lpFile:(anItem fileName pathName) |
|
3273 |
"/ lpParameters:nil |
|
3274 |
"/ lpDirectory:(self directory pathName) |
|
3275 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3276 |
"/ ^ self. |
|
3277 |
"/ ] |
|
3278 |
"/ ] |
|
9267 | 3279 |
]. |
5306 | 3280 |
^ self |
5009 | 3281 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3282 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3283 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3284 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
3892 | 3285 |
! |
3286 |
||
4392 | 3287 |
openApplForFile:aFilename |
5306 | 3288 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3289 |
! |
3290 |
||
3892 | 3291 |
openCommandResultApplication |
3292 |
||
5009 | 3293 |
self |
3294 |
applicationNamed:#FileApplicationNoteBook |
|
3295 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3296 |
||
3297 |
^ nil |
|
3892 | 3298 |
! |
3299 |
||
5010 | 3300 |
openNewTextEditorOn:anItem |
5009 | 3301 |
self |
3302 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3303 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3304 |
|
3305 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3306 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3307 |
|
5010 | 3308 |
openSearchFileOn:anItem |
5009 | 3309 |
self |
3310 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3311 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3312 |
|
3313 |
^ nil. |
|
3892 | 3314 |
! |
3315 |
||
5162 | 3316 |
openTextEditorForFile:aFilename |
3317 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3318 |
! |
|
3319 |
||
5010 | 3320 |
openTextEditorOn:anItem |
5009 | 3321 |
self |
3322 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3323 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3324 |
|
3325 |
^ nil. |
|
3892 | 3326 |
! |
3327 |
||
5010 | 3328 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3329 |
self |
3330 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3331 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3332 |
|
3333 |
^ nil. |
|
4618 | 3334 |
! |
3335 |
||
5959 | 3336 |
setCurrentFileName:aFilename |
3337 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3338 |
! |
|
3339 |
||
3340 |
setCurrentFileNames:aCollectionOfFilenames |
|
3341 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3342 |
! |
|
3343 |
||
11053 | 3344 |
tabStopConversionDialog |
3345 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3346 |
||
3347 |
|bindings| |
|
3348 |
||
3349 |
bindings := IdentityDictionary new. |
|
3350 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3351 |
||
3352 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3353 |
ifTrue:[ |
|
3354 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3355 |
]. |
|
3356 |
||
3357 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3358 |
! |
|
3359 |
||
3892 | 3360 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3361 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3362 |
aColOfFiles notNil ifTrue:[ |
5959 | 3363 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3364 |
]. |
3892 | 3365 |
! |
3366 |
||
3367 |
updateCurrentDirectory |
|
5739 | 3368 |
self updateCurrentDirectory:false |
3369 |
! |
|
3370 |
||
3371 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3372 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3373 |
|
5009 | 3374 |
self |
3375 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3376 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3377 |
self |
3378 |
applicationNamed:#DirectoryTreeBrowser |
|
3379 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3380 |
! |
3381 |
||
5739 | 3382 |
updateCurrentDirectoryWithReread |
3383 |
self updateCurrentDirectory:true |
|
3384 |
! |
|
3385 |
||
4345 | 3386 |
withActivityIndicationDo:aBlock |
3387 |
||
3388 |
self activityVisibilityChannel value:true. |
|
3389 |
[ |
|
9361 | 3390 |
self withWaitCursorDo:[ |
3391 |
aBlock value. |
|
3392 |
] |
|
4345 | 3393 |
] ensure:[ |
3394 |
self activityVisibilityChannel value:false. |
|
3395 |
] |
|
3892 | 3396 |
! ! |
3397 |
||
3398 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3399 |
||
3400 |
addBookmark |
|
3401 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3402 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3403 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3404 |
! |
3405 |
||
3406 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3407 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3408 |
self class addBookmark:path |
3892 | 3409 |
]. |
3410 |
! |
|
3411 |
||
8013 | 3412 |
editBookmarks |
3413 |
||
3414 |
| default selectedDirectories | |
|
3415 |
||
3416 |
selectedDirectories := self currentSelectedDirectories. |
|
3417 |
selectedDirectories notEmpty ifTrue:[default := selectedDirectories first]. |
|
3418 |
self class editBookmarksWithDefault: default. |
|
3419 |
! |
|
3420 |
||
3892 | 3421 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3422 |
^ self class hasBookmarks |
3892 | 3423 |
! |
3424 |
||
3425 |
hasBookmarksToRemove |
|
3426 |
|bookmarks directories| |
|
3427 |
||
3982 | 3428 |
directories := self currentSelectedDirectories. |
3892 | 3429 |
bookmarks := self class directoryBookmarks. |
17416 | 3430 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3431 |
||
3432 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3433 |
! |
3434 |
||
3435 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3436 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3437 |
self class removeBookmark:dir |
3892 | 3438 |
]. |
4679 | 3439 |
! |
3440 |
||
3441 |
saveBookmarks |
|
3442 |
self class saveBookmarks |
|
3892 | 3443 |
! ! |
3444 |
||
3445 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3446 |
||
3447 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3448 |
|cmd suffix cmdHist historySize| |
3892 | 3449 |
|
3450 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3451 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3452 |
cmdHist notNil ifTrue:[ |
3453 |
cmdHist addFirst:aCommandString. |
|
6369 | 3454 |
historySize := self class commandHistorySize. |
3455 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3456 |
cmdHist removeLast |
3457 |
] |
|
3458 |
]. |
|
3459 |
aFilename notNil ifTrue:[ |
|
3460 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3461 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3462 |
DefaultCommandPerSuffix := Dictionary new. |
|
3463 |
]. |
|
3464 |
suffix := aFilename asFilename suffix. |
|
3465 |
suffix notNil ifTrue:[ |
|
3466 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3467 |
] |
|
3468 |
] |
|
3892 | 3469 |
] |
3470 |
! |
|
3471 |
||
3472 |
doBack |
|
6286 | 3473 |
"go backward in the history" |
3892 | 3474 |
|
4022 | 3475 |
| fileName| |
3476 |
||
6369 | 3477 |
fileName := self directoryHistory goBackward. |
3892 | 3478 |
fileName notNil ifTrue:[ |
4347 | 3479 |
self gotoFile:(fileName asFilename). |
3892 | 3480 |
] |
3481 |
! |
|
3482 |
||
3483 |
doForward |
|
6286 | 3484 |
"go forward in the history" |
3892 | 3485 |
|
3964 | 3486 |
| fileName| |
3487 |
||
6369 | 3488 |
fileName := self directoryHistory goForward. |
3892 | 3489 |
fileName notNil ifTrue:[ |
4414 | 3490 |
self gotoFile:(fileName asFilename). |
4022 | 3491 |
] ifFalse:[ |
4414 | 3492 |
self enableForward value:false. |
4022 | 3493 |
|
3494 |
]. |
|
3892 | 3495 |
! ! |
3496 |
||
3497 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3498 |
||
5009 | 3499 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3500 |
|appl| |
|
3501 |
||
3502 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3503 |
appl notNil ifTrue:[ |
|
3504 |
^ aBlock value:appl |
|
3505 |
]. |
|
3506 |
^ nil. |
|
3507 |
! |
|
3508 |
||
4004 | 3509 |
directoryContentsBrowser |
3510 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3511 |
! ! |
3512 |
||
3513 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3514 |
||
3515 |
applications |
|
3516 |
^ aspects at:#applications |
|
3517 |
! |
|
3518 |
||
3519 |
backgroundProcesses |
|
3520 |
||
3521 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3522 |
! |
|
3523 |
||
4230 | 3524 |
canMake |
15259 | 3525 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3526 |
! |
3527 |
||
3892 | 3528 |
currentDirectories |
6725 | 3529 |
" returns a holder on a Collection of all currently selected directories |
3530 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3531 |
" |
3532 |
||
3533 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3534 |
! |
|
3535 |
||
6725 | 3536 |
currentDirectoriesValue |
3537 |
" returns a Collection of all currently selected directories |
|
3538 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3539 |
" |
|
3540 |
||
3541 |
^ self currentDirectories value |
|
3542 |
! |
|
3543 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3544 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3545 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3546 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3547 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3548 |
|
6725 | 3549 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3550 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3551 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3552 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3553 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3554 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3555 |
|
13856 | 3556 |
currentDirectoryDisplayed |
3557 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3558 |
||
3559 |
^self subclassResponsibility |
|
3560 |
||
3561 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3562 |
! |
|
3563 |
||
3892 | 3564 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3565 |
"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
|
3566 |
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
|
3567 |
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
|
3568 |
|
6589 | 3569 |
^ self aspectFor:#currentFileNameHolder |
3570 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3571 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3572 |
|
4692 | 3573 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3574 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3575 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3576 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3577 |
currentSel asValue |
6589 | 3578 |
] |
3579 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3580 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3581 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3582 |
newFilenames := Set new. |
6589 | 3583 |
filenames do:[:eachFilename| |
3584 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3585 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3586 |
existingFilename notNil ifTrue:[ |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3587 |
[existingFilename isRootDirectory or:[existingFilename exists]] whileFalse:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3588 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3589 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3590 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3591 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3592 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3593 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3594 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3595 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3596 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3597 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3598 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
3892 | 3599 |
! |
3600 |
||
5528 | 3601 |
defaultFileEncoding |
3602 |
^ #'iso8859-1' "/ #'utf-8' |
|
3603 |
! |
|
3604 |
||
3892 | 3605 |
enableDirectoryUp |
3606 |
||
15259 | 3607 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3608 |
! |
3609 |
||
6456 | 3610 |
enableGotoDefaultDirectory |
15259 | 3611 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3612 |
! |
3613 |
||
8168 | 3614 |
enableGotoDesktop |
14308 | 3615 |
"/ backward compatibility |
3616 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3617 |
! |
3618 |
||
9572 | 3619 |
enableGotoDesktopDirectory |
15259 | 3620 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3621 |
|
3622 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3623 |
! |
|
3624 |
||
6434 | 3625 |
enableGotoSmalltalkDirectory |
6456 | 3626 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3627 |
! |
3628 |
||
17187 | 3629 |
enableGotoSmalltalkWorkspaceDirectory |
3630 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3631 |
! |
|
3632 |
||
9677 | 3633 |
enableGotoTempDirectory |
3634 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3635 |
||
3636 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3637 |
! |
|
3638 |
||
3892 | 3639 |
enableHome |
3640 |
||
3641 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3642 |
! |
|
3643 |
||
9596 | 3644 |
enableMakeCurrentDirectory |
3645 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3646 |
||
3647 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3648 |
! |
|
3649 |
||
3892 | 3650 |
enableViewNoteBookApplication |
3651 |
||
3652 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3653 |
! |
|
3654 |
||
5528 | 3655 |
fileEncoding |
3656 |
^ self fileEncodingHolder value |
|
3657 |
! |
|
3658 |
||
3659 |
fileEncoding:newEncoding |
|
5533 | 3660 |
self fileEncodingHolder value:newEncoding. |
3661 |
||
3662 |
self |
|
3663 |
applicationNamed:#FileApplicationNoteBook |
|
3664 |
ifPresentDo:[:nb | |
|
3665 |
|appl| |
|
3666 |
||
3667 |
appl := nb selectedApplication. |
|
5535 | 3668 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 3669 |
appl fileEncoding:newEncoding |
3670 |
] |
|
3671 |
]. |
|
5528 | 3672 |
! |
3673 |
||
5737 | 3674 |
fileEncodingHolder |
3675 |
^ self |
|
3676 |
aspectFor:#fileEncodingHolder |
|
3677 |
ifAbsent:[ |
|
3678 |
self |
|
3679 |
applicationNamed:#FileApplicationNoteBook |
|
3680 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
3681 |
] |
|
3682 |
! |
|
3683 |
||
17485 | 3684 |
fileEntryFieldHolder |
3685 |
^ self subclassResponsibility. |
|
3686 |
||
3687 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
3688 |
! |
|
3689 |
||
5961 | 3690 |
firstSelectedFileName |
3691 |
|files| |
|
3692 |
||
7560 | 3693 |
files := self currentSelectedObjects. |
5961 | 3694 |
files notEmpty ifTrue:[ |
3695 |
^ files first |
|
3696 |
]. |
|
3697 |
^ nil |
|
7560 | 3698 |
|
3699 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 3700 |
! |
3701 |
||
6456 | 3702 |
gotoDefaultDirectoryIsVisible |
9596 | 3703 |
^ true. |
3704 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3705 |
||
3706 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 3707 |
! |
3708 |
||
9572 | 3709 |
gotoDesktopDirectoryIsVisible |
3710 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
3711 |
||
3712 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3713 |
||
3714 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
3715 |
! |
|
3716 |
||
4618 | 3717 |
hasFileSelection |
3718 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
3719 |
! |
|
3720 |
||
9490 | 3721 |
hasNotTwoDirectoriesSelectedHolder |
3722 |
^ self |
|
3723 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
3724 |
ifAbsent:[ |
|
3725 |
BlockValue |
|
3726 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
3727 |
argument:self currentFileNameHolder |
|
3728 |
]. |
|
3729 |
||
3730 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
3731 |
! |
|
3732 |
||
5830 | 3733 |
hasNotTwoFilesSelectedHolder |
9490 | 3734 |
^ self |
3735 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 3736 |
ifAbsent:[ |
3737 |
BlockValue |
|
3738 |
with:[:m | self hasTwoFilesSelected not] |
|
3739 |
argument:self currentFileNameHolder |
|
3740 |
]. |
|
9490 | 3741 |
|
3742 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 3743 |
! |
3744 |
||
3892 | 3745 |
hasSelection |
3746 |
||
3747 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
3748 |
! |
|
3749 |
||
9490 | 3750 |
hasTwoDirectoriesSelectedHolder |
3751 |
^ self |
|
3752 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
3753 |
ifAbsent:[ |
|
3754 |
BlockValue |
|
3755 |
with:[:m | self hasTwoDirectoriesSelected] |
|
3756 |
argument:self currentFileNameHolder |
|
3757 |
]. |
|
3758 |
||
3759 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
3760 |
! |
|
3761 |
||
4414 | 3762 |
hasTwoFilesSelectedHolder |
9490 | 3763 |
^ self |
3764 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3765 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3766 |
BlockValue |
5830 | 3767 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3768 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3769 |
]. |
9490 | 3770 |
|
3771 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 3772 |
! |
3773 |
||
11053 | 3774 |
inputTabColumnConversion |
3775 |
^ self inputTabColumnConversionHolder value |
|
3776 |
||
3777 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
3778 |
! |
|
3779 |
||
3780 |
inputTabColumnConversionHolder |
|
3781 |
^ self |
|
3782 |
aspectFor:#inputTabColumnConversionHolder |
|
3783 |
ifAbsent:[ |
|
3784 |
self |
|
3785 |
applicationNamed:#FileApplicationNoteBook |
|
3786 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
3787 |
] |
|
3788 |
||
3789 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
3790 |
! |
|
3791 |
||
3792 |
lineEndConvention |
|
15208 | 3793 |
^ self lineEndConventionHolder value asSymbol |
11053 | 3794 |
|
3795 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
3796 |
! |
|
3797 |
||
11591 | 3798 |
lineEndConvention: aSymbol |
15208 | 3799 |
self lineEndConventionHolder value: aSymbol asSymbol |
11591 | 3800 |
|
3801 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
3802 |
! |
|
3803 |
||
11053 | 3804 |
lineEndConventionHolder |
3805 |
^ self |
|
3806 |
aspectFor:#lineEndConventionHolder |
|
3807 |
ifAbsent:[ |
|
3808 |
self |
|
3809 |
applicationNamed:#FileApplicationNoteBook |
|
3810 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
3811 |
] |
|
3812 |
||
3813 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
3814 |
! |
|
3815 |
||
5737 | 3816 |
lockFileEncoding:aBoolean |
3817 |
self lockFileEncodingHolder value:aBoolean. |
|
3818 |
||
3819 |
self |
|
3820 |
applicationNamed:#FileApplicationNoteBook |
|
3821 |
ifPresentDo:[:nb | |
|
3822 |
|appl| |
|
3823 |
||
3824 |
appl := nb selectedApplication. |
|
3825 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
3826 |
appl lockFileEncoding:aBoolean |
|
3827 |
] |
|
3828 |
]. |
|
3829 |
! |
|
3830 |
||
3831 |
lockFileEncodingHolder |
|
3832 |
^ self |
|
3833 |
aspectFor:#lockFileEncodingHolder |
|
3834 |
ifAbsent:[ |
|
3835 |
self |
|
3836 |
applicationNamed:#FileApplicationNoteBook |
|
3837 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
3838 |
] |
|
3839 |
! |
|
3840 |
||
13856 | 3841 |
makeCommandHolder |
3842 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
3843 |
||
3844 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3845 |
! |
|
3846 |
||
4523 | 3847 |
notify:aString |
11108 | 3848 |
"aString is shown in the lower pane" |
3849 |
||
4523 | 3850 |
self notifyChannel value:aString |
11108 | 3851 |
|
3852 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 3853 |
! |
3854 |
||
3892 | 3855 |
notifyChannel |
3856 |
||
3857 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 3858 |
! |
3859 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3860 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3861 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3862 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3863 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3864 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3865 |
|
4071 | 3866 |
rootHolder |
3867 |
"holder, which keeps the rootHolder of the treeView |
|
3868 |
" |
|
3869 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3870 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3871 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3872 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3873 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3874 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3875 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3876 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3877 |
self aspectFor:#rootHolder put:aHolder |
3892 | 3878 |
! ! |
3879 |
||
3880 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
3881 |
||
3882 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 3883 |
"returns the model for an aspect; these are stored in a common dictionary" |
3884 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3885 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 3886 |
! |
3887 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3888 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 3889 |
"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
|
3890 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3891 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3892 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3893 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3894 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3895 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3896 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3897 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3898 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3899 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3900 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3901 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3902 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3903 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3904 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3905 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3906 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3907 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3908 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3909 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3910 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3911 |
] |
4213
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 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3914 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3915 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3916 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3917 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3918 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3919 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3920 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3921 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3922 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3923 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3924 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3925 |
aspectFor:something put:aValueHolder |
6284 | 3926 |
"stores the model for an aspect; these are stored in a common dictionary" |
3927 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3928 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3929 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3930 |
|
3892 | 3931 |
aspects |
6284 | 3932 |
"returns the common aspect dictionary" |
3933 |
||
3892 | 3934 |
^ aspects |
3935 |
! |
|
3936 |
||
3937 |
runtimeAspectValueFor:something |
|
3938 |
"returns the default aspect item from the class variable RuntimeAspects |
|
3939 |
" |
|
3940 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
3941 |
! |
|
3942 |
||
4201 | 3943 |
saveAspectValues |
16306 | 3944 |
|prefs saveAspects aspectValue| |
3945 |
||
3946 |
prefs := UserPreferences current. |
|
3947 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3948 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3949 |
saveAspects do:[ :aspectKey | |
4201 | 3950 |
aspectValue := (self perform:aspectKey) value. |
16306 | 3951 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3952 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3953 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3954 |
]. |
16306 | 3955 |
prefs beModified. |
3956 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3957 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 3958 |
! |
3959 |
||
3892 | 3960 |
saveRuntimeAspectValues |
3961 |
|savedAspects dictionary value isHolder aspect| |
|
3962 |
||
5941 | 3963 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 3964 |
dictionary := Dictionary new. |
5941 | 3965 |
savedAspects do:[:aspectKey | |
4414 | 3966 |
aspect := self perform:aspectKey. |
3967 |
isHolder := aspect isValueModel. |
|
5941 | 3968 |
isHolder ifTrue:[ |
3969 |
value := aspect value |
|
3970 |
] ifFalse:[ |
|
3971 |
value := aspect |
|
3972 |
]. |
|
3973 |
dictionary at:aspectKey |
|
3974 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
3975 |
]. |
|
3976 |
RuntimeAspects := dictionary. |
|
3892 | 3977 |
! |
3978 |
||
4201 | 3979 |
userPreferencesAspectValueFor:something |
3980 |
"returns the default aspect from the Userpreferences |
|
3892 | 3981 |
" |
4201 | 3982 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3983 |
(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
|
3984 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3985 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3986 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3987 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3988 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 3989 |
! ! |
3990 |
||
4011 | 3991 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
3992 |
||
9015 | 3993 |
filter:aString |
3994 |
self filterModel value:aString |
|
3995 |
! |
|
3996 |
||
4018 | 3997 |
filterBackgroundColor |
3998 |
||
3999 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4000 |
! |
|
4001 |
||
4011 | 4002 |
filterBlockHolder |
4003 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4004 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4005 |
! |
4006 |
||
4007 |
filterListModel |
|
4008 |
||
4009 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4010 |
! |
|
4011 |
||
4012 |
filterModel |
|
5941 | 4013 |
|m| |
4014 |
||
4015 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4016 |
^ m |
|
4011 | 4017 |
! |
4018 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4019 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4020 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4021 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4022 |
|
4018 | 4023 |
filterValueBox |
4024 |
||
4025 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4026 |
! |
|
4027 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4028 |
makeFilterBlock |
14497 | 4029 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4030 |
to be shown" |
4031 |
||
17481 | 4032 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4033 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4034 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4035 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4036 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4037 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4038 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4039 |
filterStrings := filterStrings |
4040 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4041 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4042 |
filters := filterStrings |
12760 | 4043 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4044 |
thenCollect: |
|
4045 |
[:eachPattern | |
|
4046 |
|pattern| |
|
4047 |
||
4048 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4049 |
pattern includesMatchCharacters ifFalse:[ |
4050 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4051 |
that's how most of the other applications behave - do what most users expect" |
|
4052 |
pattern first == $* ifFalse:[pattern := '*' , pattern]. |
|
4053 |
pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4054 |
]. |
|
13856 | 4055 |
|
17481 | 4056 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
12760 | 4057 |
]. |
4058 |
||
4059 |
notFilters := filterStrings |
|
4060 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4061 |
thenCollect: |
|
4062 |
[:eachPattern | |
|
9296 | 4063 |
|pattern| |
4064 |
||
4065 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4066 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4067 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4068 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4069 |
|
12760 | 4070 |
|
4071 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4072 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4073 |
] ifFalse:[ |
12760 | 4074 |
filters isEmpty ifTrue:[ |
4075 |
filterBlock := [:name :baseName | |
|
4076 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4077 |
]. |
|
4078 |
] ifFalse:[ |
|
4079 |
notFilters isEmpty ifTrue:[ |
|
4080 |
filterBlock := [:name :baseName | |
|
4081 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4082 |
]. |
|
4083 |
] ifFalse:[ |
|
4084 |
filterBlock := [:name :baseName | |
|
4085 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4086 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4087 |
]. |
|
4088 |
] |
|
4089 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4090 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4091 |
|
4011 | 4092 |
showHidden := self showHiddenFiles value. |
4093 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4094 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4095 |
]. |
9296 | 4096 |
^ [:name :baseName | |
4097 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4098 |
|
4099 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4100 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
4018 | 4101 |
! |
4102 |
||
4103 |
shownFiles |
|
4104 |
||
4105 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4106 |
! ! |
4107 |
||
14126 | 4108 |
|
3892 | 4109 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4110 |
||
4111 |
dirHistory |
|
6369 | 4112 |
"obsolete" |
4113 |
^ self directoryHistory |
|
4114 |
! |
|
4115 |
||
4116 |
directoryHistory |
|
3952 | 4117 |
^ self class directoryHistory |
3892 | 4118 |
! |
4119 |
||
4120 |
enableBack |
|
4121 |
||
15259 | 4122 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4123 |
! |
4124 |
||
4125 |
enableFileHistory |
|
4126 |
||
15259 | 4127 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4128 |
! |
4129 |
||
4130 |
enableForward |
|
4131 |
||
15259 | 4132 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4133 |
! |
4134 |
||
4135 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4136 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4137 |
! ! |
4138 |
||
4139 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4140 |
||
4345 | 4141 |
activityVisibilityChannel |
6284 | 4142 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4143 |
|
15259 | 4144 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4145 |
! |
4146 |
||
15111 | 4147 |
alwaysUseSmalltalkTools |
4148 |
" aspect to prevent os tools to be opened on double click" |
|
4149 |
||
15259 | 4150 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4151 |
! |
4152 |
||
6602 | 4153 |
changeSetBrowserItemVisible |
4154 |
^ Screen current ctrlDown. |
|
4155 |
! |
|
4156 |
||
11135 | 4157 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4158 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4159 |
|
4160 |
"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
|
4161 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4162 |
! |
4163 |
||
13856 | 4164 |
hgMenusAreShown |
4165 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4166 |
||
4167 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4168 |
! |
|
4169 |
||
11135 | 4170 |
mercurialMenusAreShown |
11147 | 4171 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4172 |
|
4173 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4174 |
! |
|
4175 |
||
4110 | 4176 |
openAlwaysInTextEditor |
17024 | 4177 |
" aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4178 |
|
15111 | 4179 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
4110 | 4180 |
! |
4181 |
||
3892 | 4182 |
openMultipleApplicationsForType |
4183 |
||
4201 | 4184 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4185 |
open TextEditor " |
|
4186 |
||
3892 | 4187 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4188 |
! |
|
4189 |
||
11137 | 4190 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4191 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4192 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4193 |
|
4194 |
"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
|
4195 |
"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
|
4196 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4197 |
! |
4198 |
||
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
|
4199 |
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
|
4200 |
|
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
|
4201 |
^ 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
|
4202 |
|
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
|
4203 |
"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
|
4204 |
! |
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
|
4205 |
|
4201 | 4206 |
showDirectoryTree |
4207 |
||
4208 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4209 |
! |
4210 |
||
4554 | 4211 |
showDiskUsageHolder |
4212 |
|holder| |
|
4213 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4214 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4215 |
holder addDependent:self. |
4554 | 4216 |
^ holder |
4217 |
! |
|
4218 |
||
3892 | 4219 |
showHiddenFiles |
4220 |
||
9582 | 4221 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4222 |
||
4223 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4224 |
! |
4225 |
||
9108 | 4226 |
showHiddenFiles:aHolder |
4227 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4228 |
! |
|
4229 |
||
4230 |
shownFiles:aHolder |
|
4231 |
self aspectFor:#shownFiles put:aHolder. |
|
4232 |
! |
|
4233 |
||
11135 | 4234 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4235 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4236 |
|
4237 |
"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
|
4238 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4239 |
! |
4240 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4241 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4242 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4243 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4244 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4245 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4246 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4247 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4248 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4249 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4250 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4251 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4252 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4253 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4254 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4255 |
|
4648 | 4256 |
userContextAvailable |
4257 |
||
4258 |
" aspect for show group and user columns in contents view |
|
4259 |
windows provides no user context" |
|
4260 |
||
4261 |
^ OperatingSystem isMSWINDOWSlike not |
|
4262 |
! |
|
4263 |
||
3892 | 4264 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4265 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4266 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4267 |
^ self directoryContentsBrowser viewDescription |
3892 | 4268 |
! |
4269 |
||
4270 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4271 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4272 |
" |
3892 | 4273 |
|
6121 | 4274 |
|directoryContentsBrowser| |
4275 |
||
4276 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4277 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4278 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4279 |
! |
4280 |
||
4281 |
viewDirectoryDescription |
|
4282 |
||
4201 | 4283 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4284 |
on change directory " |
|
4285 |
||
3892 | 4286 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4287 |
! |
|
4288 |
||
4201 | 4289 |
viewDirsInContentsBrowser |
4290 |
||
4291 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4292 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4293 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4294 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4295 |
" |
4201 | 4296 |
! |
4297 |
||
5870 | 4298 |
viewFilesInContentsBrowser |
4299 |
||
4300 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4301 |
! |
|
4302 |
||
3892 | 4303 |
viewFilesInDirectoryTree |
4304 |
||
4201 | 4305 |
" aspect for view files in tree view (not only directories) " |
4306 |
||
3892 | 4307 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4308 |
! |
|
4309 |
||
4310 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4311 |
" aspect for show group information 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 viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4314 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4315 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4316 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4317 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4318 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4319 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4320 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4321 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4322 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4323 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4324 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4325 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4326 |
! |
4327 |
||
4328 |
viewNoteBookApplicationHolder |
|
4329 |
||
4330 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4331 |
! |
|
4332 |
||
4333 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4334 |
" aspect for show owner information 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 viewOwner |
3892 | 4337 |
! |
4338 |
||
4339 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4340 |
" aspect for show permission 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 viewPermissions |
3892 | 4343 |
! |
4344 |
||
4345 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4346 |
" aspect for show image previev 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 viewPreview |
3892 | 4349 |
! |
4350 |
||
4351 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4352 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4353 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4354 |
^ self directoryContentsBrowser viewSize |
3892 | 4355 |
! |
4356 |
||
4974 | 4357 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4358 |
" aspect for show size-in-bytes 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 viewSizeInBytes |
4974 | 4361 |
! |
4362 |
||
5312 | 4363 |
viewSizeInKiloBytes |
4364 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4365 |
||
4366 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4367 |
! |
|
4368 |
||
3892 | 4369 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4370 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4371 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4372 |
^ self directoryContentsBrowser viewTime |
3892 | 4373 |
! |
4374 |
||
4375 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4376 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4377 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4378 |
^ self directoryContentsBrowser viewType |
3892 | 4379 |
! ! |
4380 |
||
4381 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4382 |
||
4383 |
executeCommand:cmd |
|
4384 |
||
4385 |
self executeCommand:cmd inDirectory:nil |
|
4386 |
! |
|
4387 |
||
5880 | 4388 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4389 |
| nameString executionBlock| |
4390 |
||
5880 | 4391 |
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
|
4392 |
nameString := 'Execute: ', cmd. |
3892 | 4393 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4394 |
! |
|
4395 |
||
4396 |
getExecutionBlockForCommand:cmd |
|
4397 |
||
4398 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4399 |
! |
|
4400 |
||
5880 | 4401 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4402 |
| dir| |
|
4403 |
||
4404 |
dir := directoryOrNil. |
|
4405 |
directoryOrNil isNil ifTrue:[ |
|
4406 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4407 |
dir isNil ifTrue:[ |
12493 | 4408 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4409 |
AbortOperationRequest raise. |
6671 | 4410 |
^ nil |
4411 |
]. |
|
3892 | 4412 |
]. |
4523 | 4413 |
|
4414 |
^ [:stream| |
|
4415 |
stream notNil ifTrue:[ |
|
4414 | 4416 |
OperatingSystem |
4417 |
executeCommand:cmd |
|
4418 |
inputFrom:nil |
|
4419 |
outputTo:stream |
|
4420 |
errorTo:stream |
|
4421 |
inDirectory:dir |
|
16732 | 4422 |
lineWise:true |
16825 | 4423 |
showWindow:false |
4414 | 4424 |
onError:[:status| false]. |
4425 |
] |
|
4523 | 4426 |
]. |
3892 | 4427 |
! |
4428 |
||
4429 |
killAllRunningBackgroundProcesses |
|
4430 |
||
4431 |
self backgroundProcesses do:[ : process | |
|
4523 | 4432 |
self notify:'kill ', process name. |
4414 | 4433 |
process terminate. |
3892 | 4434 |
]. |
4435 |
! |
|
4436 |
||
4437 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4438 |
| stream process appl nameString| |
|
4439 |
||
4440 |
appl := self openCommandResultApplication. |
|
4441 |
stream := appl resultStream. |
|
4442 |
nameString := aString ? 'Execution Result'. |
|
4443 |
appl changeTabTo:nameString. |
|
4523 | 4444 |
|
16102 | 4445 |
process := |
4446 |
[ |
|
4447 |
[aBlock value:stream] |
|
4448 |
ensure:[ |
|
4449 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4450 |
appl process value:nil. |
|
4451 |
||
4452 |
"/ close automatically, if there was no output. |
|
4571 | 4453 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4454 |
"/ appl doClose. |
|
4455 |
"/ ] |
|
16102 | 4456 |
stream nextPutLine:'Done.'. |
4457 |
self enqueueMessage:#updateCurrentDirectory. |
|
4458 |
] |
|
4459 |
] newProcess. |
|
3892 | 4460 |
process priority:(Processor userBackgroundPriority). |
4461 |
process name:nameString. |
|
4462 |
self backgroundProcesses add:process. |
|
4463 |
appl process value:process. |
|
4464 |
process resume. |
|
4465 |
! ! |
|
4466 |
||
4467 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4468 |
||
4915 | 4469 |
currentFileNameHolderChanged |
4470 |
"/ self currentFileNameHolderChangedForCommon |
|
4471 |
! |
|
4472 |
||
4577 | 4473 |
currentFileNameHolderChangedForCommon |
5476 | 4474 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4475 |
|
7560 | 4476 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4477 |
self class currentSelection:selection. |
4734 | 4478 |
|
13521 | 4479 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4480 |
self hasSelection value:selectionNotEmpty. |
4481 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 4482 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4483 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4484 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4485 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4486 |
self currentDirectories value:newDirectories. |
4487 |
size := newDirectories size. |
|
4774 | 4488 |
rootInTreeView := self |
4489 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4490 |
ifPresentDo:[:appl | appl rootHolder]. |
4491 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4492 |
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
|
4493 |
|
4347 | 4494 |
newDirectories notEmpty ifTrue:[ |
6369 | 4495 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4496 |
]. |
5074 | 4497 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
14308 | 4498 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
6456 | 4499 |
self enableGotoDefaultDirectory value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
4500 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(self smalltalkDirectory asAbsoluteFilename))not). |
|
9572 | 4501 |
self enableGotoDesktopDirectory value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
9677 | 4502 |
self enableGotoTempDirectory value:((newDirectories includes:(self tempDirectory asAbsoluteFilename))not). |
4011 | 4503 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4504 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4505 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4506 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4507 |
self enableForward value:self canForward. |
4734 | 4508 |
self enableBack value:self canBackward. |
6095 | 4509 |
|
13856 | 4510 |
self updateCanMake. |
7560 | 4511 |
|
9677 | 4512 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4513 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4011 | 4514 |
! |
4515 |
||
4516 |
filterModelChanged |
|
4517 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4518 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4519 |
! |
4520 |
||
3892 | 4521 |
update:something with:aParameter from:changedObject |
4522 |
||
4523 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4524 |
and the things that have to be done if it runs standalone " |
|
4525 |
||
4526 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4527 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4528 |
^ self |
3892 | 4529 |
]. |
3989 | 4530 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4531 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4532 |
^ self |
3989 | 4533 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4534 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4535 |
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
|
4536 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4537 |
]. |
4011 | 4538 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4539 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4540 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4541 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4542 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4543 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4544 |
^ self |
4004 | 4545 |
]. |
4781 | 4546 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4547 |
self notify:nil. |
4781 | 4548 |
^ self |
4549 |
]. |
|
3989 | 4550 |
|
3892 | 4551 |
super update:something with:aParameter from:changedObject |
5543 | 4552 |
! |
4553 |
||
6095 | 4554 |
updateCanMake |
4555 |
|dir can| |
|
4556 |
||
4557 |
can := false. |
|
4558 |
dir := self currentDirectory. |
|
4559 |
dir notNil ifTrue:[ |
|
13856 | 4560 |
"/ Check for make |
6095 | 4561 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4562 |
can ifFalse:[ |
4563 |
can := (dir asFilename construct:'makefile') exists. |
|
4564 |
]. |
|
6095 | 4565 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4566 |
can ifFalse:[ |
|
13856 | 4567 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4568 |
] |
4569 |
]. |
|
13856 | 4570 |
can ifTrue:[ |
4571 |
self makeCommandHolder value: 'make'. |
|
4572 |
self canMake value: true. |
|
4573 |
^ self |
|
4574 |
]. |
|
4575 |
||
4576 |
"/Check for Apache ant |
|
4577 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4578 |
can := (dir asFilename construct:'build.xml') exists. |
|
4579 |
can ifTrue:[ |
|
4580 |
self makeCommandHolder value: 'ant'. |
|
4581 |
self canMake value: true. |
|
4582 |
^ self |
|
4583 |
]. |
|
4584 |
]. |
|
4585 |
||
4586 |
"/Add more here... |
|
4587 |
||
6095 | 4588 |
]. |
4589 |
self canMake value:can. |
|
13856 | 4590 |
|
4591 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4592 |
! |
4593 |
||
5543 | 4594 |
updateListAfterDelete:colOfFiles |
4595 |
self updateCurrentDirectory |
|
3892 | 4596 |
! ! |
4597 |
||
4598 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4599 |
||
4600 |
canPaste |
|
4601 |
||
15259 | 4602 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4603 |
! |
4604 |
||
4605 |
clipboard |
|
4606 |
||
4607 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4608 |
! |
|
4609 |
||
4610 |
copyFilesToClipBoard:colOfFiles |
|
4611 |
self putInClipBoard:colOfFiles as:#copy. |
|
4612 |
! |
|
4613 |
||
4614 |
cutFilesToClipBoard:colOfFiles |
|
4615 |
"defete current selected files/directories |
|
4616 |
" |
|
4617 |
self putInClipBoard:colOfFiles as:#cut. |
|
4618 |
! |
|
4619 |
||
4620 |
emptyClipBoard |
|
4621 |
||
4622 |
self clipboard files:nil. |
|
4623 |
self canPaste value:false. |
|
4624 |
! |
|
4625 |
||
4626 |
putInClipBoard:colOfFiles as:aSymbol |
|
4627 |
| stream clp| |
|
4628 |
||
4629 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4630 |
clp := self clipboard. |
|
4631 |
clp files:nil. |
|
4632 |
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
|
4633 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4634 |
stream := String writeStream. |
3892 | 4635 |
stream nextPutAll:aSymbol asString. |
4636 |
stream nextPutAll:' <'. |
|
4637 |
stream nextPutAll:colOfFiles first asString. |
|
4638 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4639 |
stream nextPutAll:' ...'. |
3892 | 4640 |
]. |
4641 |
stream nextPutAll:'> to clipboard'. |
|
4642 |
||
4523 | 4643 |
self notify:stream contents. |
3892 | 4644 |
clp files:colOfFiles. |
4645 |
self canPaste value:true. |
|
4646 |
! ! |
|
4647 |
||
4648 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
4649 |
||
4650 |
canDropFiles:dropedObjects for:filename |
|
6284 | 4651 |
|filenameDirString filenameDir| |
3892 | 4652 |
|
4653 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 4654 |
|
3892 | 4655 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 4656 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 4657 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 4658 |
|
3892 | 4659 |
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
|
4660 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
4661 |
dropedObjects do:[:aDropObject | |
6284 | 4662 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
4663 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
4664 |
"/ |
|
4665 |
"/ dropFileName := aDropObject theObject. |
|
4666 |
"/ dropFileNameString := dropFileName asString. |
|
4667 |
"/ dropFileName isDirectory ifTrue:[ |
|
4668 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4669 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
4670 |
"/ ^ false |
|
4671 |
"/ ] |
|
4672 |
"/ ] ifFalse:[ |
|
4673 |
"/ physicalPathName := dropFileName physicalPathName. |
|
4674 |
"/ (filenameDirString = dropFileName directory asString |
|
4675 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
4676 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
4677 |
"/ self notify:'Cannot drop a file into same directory'. |
|
4678 |
"/ ^ false |
|
4679 |
"/ ] |
|
4680 |
"/ ] |
|
4681 |
]. |
|
4682 |
self notify:nil. |
|
4683 |
^ true |
|
4684 |
! |
|
4685 |
||
4686 |
canDropObject:aDropObject into:aDirectory |
|
4687 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
4688 |
||
4689 |
dropFileName := aDropObject theObject. |
|
4690 |
dropFileNameString := dropFileName asString. |
|
4691 |
dropFileName isDirectory ifTrue:[ |
|
4692 |
filenameDirString := aDirectory asString. |
|
4693 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4694 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
4695 |
^ false |
|
4414 | 4696 |
] |
6284 | 4697 |
] ifFalse:[ |
4698 |
physicalPathName := dropFileName physicalPathName. |
|
4699 |
(aDirectory = dropFileName directory |
|
4700 |
or:[ aDropObject isFileInArchive not |
|
4701 |
and:[physicalPathName notNil |
|
4702 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
4703 |
self notify:'Cannot drop a file into same directory'. |
|
4704 |
^ false |
|
4705 |
] |
|
4706 |
]. |
|
4707 |
^ true. |
|
3892 | 4708 |
! |
4709 |
||
7406 | 4710 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
4711 |
^ aCollectionOfDropObjects contains:[:dropObject | dropObject isFileObject] |
|
4712 |
||
4713 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
4714 |
! |
|
4715 |
||
17202 | 4716 |
doStartDrag:arg1 in:arg2 |
4717 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 4718 |
! |
4719 |
||
7408 | 4720 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 4721 |
|fileEntryFieldHolder destDir dropObject fn d| |
4722 |
||
4723 |
fileEntryFieldHolder := self masterApplication notNil |
|
4724 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
4725 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
4726 |
||
4727 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4728 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4729 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4730 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4731 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4732 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4733 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4734 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4735 |
]. |
7990 | 4736 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4737 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4738 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4739 |
]. |
6479 | 4740 |
|
4741 |
destDir := self currentDirectory. |
|
4742 |
destDir isNil ifTrue:[^ self]. |
|
4743 |
||
8601 | 4744 |
self withWaitCursorDo:[ |
4745 |
aCollectionOfDropObjects do:[:dropObject | |
|
4746 |
|fn| |
|
4747 |
||
4748 |
dropObject isFileObject ifTrue:[ |
|
4749 |
fn := dropObject theObject asFilename. |
|
4750 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
4751 |
fn recursiveCopyTo:destDir |
8601 | 4752 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
4753 |
fn copyTo:(destDir / fn baseName ) |
8601 | 4754 |
] |
6479 | 4755 |
] |
8601 | 4756 |
]. |
4757 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4758 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4759 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4760 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4761 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4762 |
]. |
7408 | 4763 |
|
4764 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 4765 |
! ! |
4766 |
||
4767 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
4768 |
||
4769 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 4770 |
"copy to" |
4771 |
||
7635 | 4772 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
4773 |
||
4774 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
4775 |
! |
|
4776 |
||
4777 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
4778 |
"copy to" |
|
4779 |
||
4780 |
|copyOperation msg| |
|
4781 |
||
4782 |
repairCorruptedFiles ifTrue:[ |
|
4783 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
4784 |
] ifFalse:[ |
|
4785 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
4786 |
]. |
|
4787 |
copyOperation result ifTrue:[ |
|
6190 | 4788 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 4789 |
] ifFalse:[ |
7635 | 4790 |
msg := copyOperation errorString. |
6190 | 4791 |
]. |
4792 |
self notify:msg. |
|
7635 | 4793 |
^ copyOperation result |
4794 |
||
4795 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 4796 |
! |
4797 |
||
4798 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 4799 |
|copy result| |
3892 | 4800 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4801 |
self withActivityIndicationDo:[ |
5961 | 4802 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 4803 |
copy result ifTrue:[ |
4804 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
4805 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4806 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4807 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4808 |
self updateCurrentDirectory. |
3892 | 4809 |
]. |
6374 | 4810 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4811 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4812 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 4813 |
! |
4814 |
||
15569 | 4815 |
copyFromToRepairingCorruptedFiles |
4816 |
"ask for source and destination and copy the entered file. |
|
4817 |
Especially useful for raw devices to copy corrupted disks/files |
|
4818 |
" |
|
4819 |
||
4820 |
|source destination| |
|
4821 |
||
4822 |
source := Dialog |
|
4823 |
requestDirectoryName:(resources string:'Copy from:') |
|
4824 |
default:(LastMoveDestination ? self currentDirectory) |
|
4825 |
ok:(resources string:'Continue') |
|
4826 |
abort:nil. |
|
4827 |
||
4828 |
source isEmptyOrNil ifTrue:[^ self]. |
|
4829 |
source := source asFilename. |
|
4830 |
||
4831 |
destination := Dialog |
|
4832 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
4833 |
default:(LastMoveDestination ? self currentDirectory) |
|
4834 |
ok:(resources string:'Copy') |
|
4835 |
abort:nil. |
|
4836 |
||
4837 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
4838 |
destination := destination asFilename. |
|
4839 |
||
4840 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
4841 |
! |
|
4842 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4843 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 4844 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4845 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4846 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4847 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4848 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4849 |
"/ 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
|
4850 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4851 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4852 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4853 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4854 |
"/ 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
|
4855 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4856 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4857 |
"/ 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
|
4858 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4859 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4860 |
"/ 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
|
4861 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4862 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4863 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4864 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4865 |
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
|
4866 |
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
|
4867 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4868 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4869 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4870 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4871 |
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
|
4872 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4873 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 4874 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4875 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4876 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4877 |
request:msg |
8127 | 4878 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
4879 |
image:(WarningBox iconBitmap) |
8127 | 4880 |
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
|
4881 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4882 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4883 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4884 |
^ answer. |
3892 | 4885 |
! |
4886 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4887 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 4888 |
"copy or move aColOfSourceFiles to aDirectory. |
4889 |
Asks the used if a move or a copy is wanted. |
|
4890 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
4891 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4892 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4893 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4894 |
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
|
4895 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4896 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4897 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4898 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4899 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4900 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4901 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4902 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4903 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4904 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4905 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4906 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 4907 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4908 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4909 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4910 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4911 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4912 |
|
4745 | 4913 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4914 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4915 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4916 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4917 |
^ true. |
3892 | 4918 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4919 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4920 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4921 |
^ true. |
3892 | 4922 |
]. |
4745 | 4923 |
^ false. |
3892 | 4924 |
! |
4925 |
||
6107 | 4926 |
copySelectionTo |
4927 |
"copy the selected file(s) to another directory" |
|
4928 |
||
13704 | 4929 |
self copySelectionToRepairingCorruptedFiles:false. |
4930 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4931 |
|
4932 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
4933 |
! |
|
4934 |
||
4935 |
copySelectionToRepairingCorruptedFiles |
|
4936 |
"copy the selected file(s) to another directory" |
|
4937 |
||
13704 | 4938 |
self copySelectionToRepairingCorruptedFiles:true. |
4939 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4940 |
|
4941 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
4942 |
! |
|
4943 |
||
4944 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
4945 |
"copy the selected file(s) to another directory" |
|
4946 |
||
6299 | 4947 |
|selectedFiles msg destination directory| |
4948 |
||
7560 | 4949 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 4950 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
4951 |
||
4952 |
msg := (selectedFiles size > 1) |
|
14588 | 4953 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
4954 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 4955 |
|
4956 |
destination := Dialog |
|
14588 | 4957 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 4958 |
default:(LastMoveDestination ? self currentDirectory) |
4959 |
ok:(resources string:'Copy') |
|
4960 |
abort:nil. |
|
4961 |
||
6299 | 4962 |
destination isEmptyOrNil ifTrue:[^ self]. |
4963 |
destination := destination asFilename. |
|
4964 |
||
4965 |
destination isDirectory ifFalse:[ |
|
4966 |
selectedFiles size == 1 ifTrue:[ |
|
4967 |
directory := destination directory. |
|
4968 |
directory isDirectory ifTrue:[ |
|
4969 |
LastMoveDestination := directory. |
|
7635 | 4970 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 4971 |
^ self. |
4972 |
] |
|
4973 |
] |
|
4974 |
]. |
|
4975 |
||
4976 |
LastMoveDestination := destination. |
|
7635 | 4977 |
repairingCorruptedFiles ifTrue:[ |
4978 |
selectedFiles do:[:eachFile | |
|
4979 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
4980 |
]. |
|
4981 |
^ self. |
|
4982 |
] ifFalse:[ |
|
4983 |
self copyFiles:selectedFiles to:destination |
|
4984 |
] |
|
4985 |
||
4986 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 4987 |
! |
4988 |
||
3892 | 4989 |
deleteFile:aFile |
6373 | 4990 |
"delete the selected files/directories" |
3892 | 4991 |
|
4992 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
4993 |
! |
|
4994 |
||
4995 |
deleteFiles:colOfFiles |
|
6373 | 4996 |
"delete some files/directories" |
4997 |
||
5081 | 4998 |
^ self deleteFiles:colOfFiles confirm:true. |
4999 |
! |
|
5000 |
||
5001 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5002 |
"delete some files/directories" |
5003 |
||
5673 | 5004 |
|delete result| |
3892 | 5005 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5006 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5007 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5008 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5009 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5010 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5011 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5012 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5013 |
]. |
5673 | 5014 |
result notNil ifTrue:[ |
5015 |
result ifFalse:[ |
|
5016 |
self notify:delete errorString. |
|
5753 | 5017 |
] ifTrue:[ |
5018 |
self updateListAfterDelete:colOfFiles. |
|
5019 |
] |
|
4394 | 5020 |
]. |
5673 | 5021 |
]. |
5022 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5023 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5024 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5025 |
! |
5026 |
||
6169 | 5027 |
eraseFiles:colOfFiles |
6373 | 5028 |
"erase (clear and delete) some files/directories" |
5029 |
||
6169 | 5030 |
^ self eraseFiles:colOfFiles confirm:true. |
5031 |
! |
|
5032 |
||
5033 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5034 |
"erase (clear and delete) some files/directories" |
5035 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5036 |
|deleteOperation result fileSize| |
6169 | 5037 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5038 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5039 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5040 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5041 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5042 |
ifTrue:[ |
5043 |
result := deleteOperation result. |
|
5044 |
] ifFalse:[ |
|
5045 |
ProgressIndicator |
|
5046 |
displayProgressNotifications:'Erasing' |
|
5047 |
abortable:true |
|
5048 |
at:nil |
|
5049 |
during:[ |
|
5050 |
result := deleteOperation result. |
|
5051 |
]. |
|
5052 |
]. |
|
5053 |
||
6169 | 5054 |
result notNil ifTrue:[ |
5055 |
result ifFalse:[ |
|
8294 | 5056 |
self notify:deleteOperation errorString. |
6169 | 5057 |
] ifTrue:[ |
5058 |
self updateListAfterDelete:colOfFiles. |
|
5059 |
] |
|
5060 |
]. |
|
5061 |
]. |
|
5062 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5063 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5064 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5065 |
! |
5066 |
||
3892 | 5067 |
moveFile:aSourceFile to:aDestFile |
6373 | 5068 |
"move a file/directory" |
3892 | 5069 |
|
5070 |
|move| |
|
5071 |
||
5961 | 5072 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5073 |
move result ifTrue:[ |
15346 | 5074 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5075 |
] ifFalse:[ |
4523 | 5076 |
self notify:move errorString. |
3892 | 5077 |
]. |
5078 |
self updateCurrentDirectory. |
|
5079 |
^ move result |
|
5080 |
! |
|
5081 |
||
5082 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5083 |
"move some files to aDirectory" |
5084 |
||
3892 | 5085 |
|move| |
5086 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5087 |
self withActivityIndicationDo:[ |
5961 | 5088 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5089 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5090 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5091 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5092 |
self updateCurrentDirectory. |
3892 | 5093 |
]. |
6373 | 5094 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5095 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5096 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5097 |
! |
5098 |
||
6107 | 5099 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5100 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5101 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5102 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5103 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5104 |
destinationDirectory := Dialog |
14588 | 5105 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5106 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5107 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5108 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5109 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5110 |
|
5789 | 5111 |
LastMoveDestination := destinationDirectory. |
13704 | 5112 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5113 |
self updateCurrentDirectoryWithReread. |
|
5114 |
||
7560 | 5115 |
|
5116 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5117 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5118 |
|
3892 | 5119 |
newDirectory |
5120 |
"ask for and create a new directory" |
|
5121 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5122 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5123 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5124 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5125 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5126 |
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
|
5127 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5128 |
]. |
4521 | 5129 |
|
5130 |
"/ 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
|
5131 |
selectedFiles := self currentSelectedFiles. |
4521 | 5132 |
selectedFiles size == 1 ifTrue:[ |
5133 |
singleSelectedFile := selectedFiles first. |
|
5134 |
||
5135 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5136 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5137 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5138 |
||
5139 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5140 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5141 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5142 |
]. |
|
5143 |
]. |
|
5144 |
]. |
|
5145 |
||
5961 | 5146 |
|
4521 | 5147 |
defaultAnswer notNil ifTrue:[ |
5961 | 5148 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5149 |
] ifFalse:[ |
5961 | 5150 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5151 |
]. |
5152 |
createOp result ifFalse:[ ^ self]. |
|
5153 |
newFile := createOp createdFile. |
|
3892 | 5154 |
newFile notNil ifTrue:[ |
4414 | 5155 |
self updateCurrentDirectory. |
3892 | 5156 |
] |
5157 |
! |
|
5158 |
||
5159 |
newFile |
|
5160 |
"ask for and create a new file" |
|
5161 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5162 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5163 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5164 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5165 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5166 |
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
|
5167 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5168 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5169 |
|
3982 | 5170 |
curFile := self firstSelectedFile. |
3892 | 5171 |
curFile notNil ifTrue:[ |
4414 | 5172 |
file := curFile. |
3892 | 5173 |
] ifFalse:[ |
4414 | 5174 |
file := directory. |
3892 | 5175 |
]. |
5961 | 5176 |
create := FileOperation createFileIn:file. |
3892 | 5177 |
create result ifFalse:[ ^ self]. |
5178 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
5179 |
! |
|
5180 |
||
5181 |
newHardLink |
|
5182 |
"ask for and create a hard link (unix only)" |
|
5183 |
||
6151 | 5184 |
self newLink:#hard. |
5185 |
! |
|
5186 |
||
5187 |
newLink:typeOfLink |
|
3892 | 5188 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5189 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5190 |
| sel dir create createdFile| |
3892 | 5191 |
|
7560 | 5192 |
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
|
5193 |
(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
|
5194 |
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
|
5195 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5196 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5197 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5198 |
|
6151 | 5199 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5200 |
create result ifFalse:[ ^ self]. |
5201 |
createdFile := create createdFile. |
|
5202 |
createdFile notNil ifTrue:[ |
|
6151 | 5203 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5204 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5205 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5206 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5207 |
] |
3892 | 5208 |
]. |
7560 | 5209 |
|
5210 |
"Modified: / 04-12-2006 / 13:15:15 / cg" |
|
3892 | 5211 |
! |
5212 |
||
5213 |
newSoftLink |
|
5214 |
"ask for and create a soft link (unix only)" |
|
5215 |
||
6151 | 5216 |
self newLink:#soft. |
3892 | 5217 |
! |
5218 |
||
5219 |
pasteFiles |
|
6373 | 5220 |
"paste from clipBoard" |
5221 |
||
5222 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5223 |
|
5224 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5225 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5226 |
|
5227 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5228 |
||
3892 | 5229 |
buffer := self clipboard copy. |
3982 | 5230 |
directories := self currentSelectedDirectories. |
5880 | 5231 |
directories size ~~ 1 ifTrue:[ |
4414 | 5232 |
|box dirStringCol| |
5880 | 5233 |
|
4414 | 5234 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5235 |
box := ListSelectionBox new. |
|
6373 | 5236 |
box title:'Paste into which directory ?'. |
4414 | 5237 |
box list:dirStringCol. |
5238 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5239 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5240 |
box destroy. |
3892 | 5241 |
] ifFalse:[ |
5880 | 5242 |
destination := directories anElement. |
3892 | 5243 |
]. |
6373 | 5244 |
|
5245 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5246 |
buffer files copy do:[:aFile| |
5247 |
aFile directory = destination ifTrue:[ |
|
5248 |
buffer files remove:aFile. |
|
5249 |
]. |
|
5250 |
]. |
|
5251 |
]. |
|
5252 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5253 |
copiedFiles notEmptyOrNil ifTrue:[ |
5254 |
thisIsAFileMoveOperation ifTrue:[ |
|
5255 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5256 |
]. |
|
5257 |
||
5258 |
"/ select those pasted files. |
|
5259 |
self updateCurrentDirectory:true. |
|
5260 |
self currentFileNameHolder value:copiedFiles values. |
|
5261 |
] |
|
3892 | 5262 |
! |
5263 |
||
5264 |
renameFile:aFile |
|
5265 |
"rename the selected file(s)" |
|
5266 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5267 |
^ self renameFiles:(Array with:aFile). |
3892 | 5268 |
! |
5269 |
||
4230 | 5270 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5271 |
"rename filename to newFileString" |
5272 |
||
5273 |
|rename| |
|
5274 |
||
5961 | 5275 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5276 |
rename result ifTrue:[ |
4230 | 5277 |
aBoolean ifTrue:[ |
5278 |
self updateAndSelect:(rename renamedFiles). |
|
5279 |
]. |
|
3892 | 5280 |
] ifFalse:[ |
4523 | 5281 |
self notify:rename errorString. |
3892 | 5282 |
]. |
5283 |
^ rename result |
|
5284 |
! |
|
5285 |
||
5286 |
renameFiles:aColOfFiles |
|
6373 | 5287 |
"rename some file(s)" |
3892 | 5288 |
|
5289 |
|rename| |
|
5290 |
||
5961 | 5291 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5292 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5293 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5294 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5295 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5296 |
^ rename |
3892 | 5297 |
! |
5298 |
||
5299 |
renameSelection |
|
5300 |
"rename the selected file(s)" |
|
5301 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5302 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5303 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5304 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5305 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5306 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5307 |
]. |
7560 | 5308 |
|
5309 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5310 |
! ! |
5311 |
||
4080 | 5312 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5313 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5314 |
bookmarksMenu |
3952 | 5315 |
<resource: #programMenu> |
5316 |
||
14941 | 5317 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5318 |
! |
|
5319 |
||
5320 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5321 |
<resource: #programMenu> |
|
5322 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5323 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5324 |
|
14941 | 5325 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5326 |
|
5327 |
"/ add the bookmark items ... |
|
5328 |
bookmarks := self class directoryBookmarks. |
|
5329 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5330 |
menu addSeparator. |
7763 | 5331 |
bookmarks do:[:dirName | |
12963 | 5332 |
menu addItem:(MenuItem |
5333 |
label:dirName asString |
|
5334 |
itemValue:[ |
|
5335 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5336 |
self setCurrentFileName:dirName. |
|
5337 |
]. |
|
5338 |
]). |
|
7763 | 5339 |
]. |
5340 |
]. |
|
4080 | 5341 |
menu findGuiResourcesIn:self. |
7763 | 5342 |
^ menu |
5343 |
||
11135 | 5344 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5345 |
! |
5346 |
||
5347 |
canBackward |
|
5348 |
^ self directoryHistory canBackward. |
|
5349 |
||
5350 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5351 |
! |
|
5352 |
||
5353 |
canForward |
|
5354 |
^ self directoryHistory canForward. |
|
5355 |
||
5356 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5357 |
! |
|
5358 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5359 |
gotoBookmarksMenu |
7763 | 5360 |
<resource: #programMenu> |
5361 |
||
14941 | 5362 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5363 |
! |
5364 |
||
3892 | 5365 |
menuDirHistory:backOrForward |
7763 | 5366 |
"initialize the history menu" |
5367 |
||
3892 | 5368 |
<resource: #programMenu > |
5369 |
||
7763 | 5370 |
|hist menu pathList currentSel currentPath| |
5371 |
||
5372 |
hist := self directoryHistory. |
|
5373 |
hist isEmpty ifTrue:[^ nil]. |
|
5374 |
||
3892 | 5375 |
backOrForward == #back ifTrue:[ |
6725 | 5376 |
currentSel := self currentSelectedDirectories. |
4347 | 5377 |
currentSel size == 1 ifTrue:[ |
5378 |
currentPath := currentSel first asString. |
|
5379 |
] ifFalse:[ |
|
5380 |
currentPath := nil. |
|
5381 |
]. |
|
7763 | 5382 |
pathList := hist getBackCollection. |
3892 | 5383 |
] ifFalse:[ |
7763 | 5384 |
pathList := hist getForwardCollection. |
3892 | 5385 |
]. |
4022 | 5386 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5387 |
|
6370 | 5388 |
pathList size > 30 ifTrue:[ |
5389 |
pathList := pathList copyTo:30 |
|
5390 |
]. |
|
7763 | 5391 |
|
5392 |
menu := Menu new. |
|
5393 |
||
3964 | 5394 |
pathList do:[:aPath| |
14593 | 5395 |
menu addItem:(MenuItem |
5396 |
label:aPath |
|
5397 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5398 |
translateLabel:false). |
|
3952 | 5399 |
]. |
7763 | 5400 |
menu findGuiResourcesIn:self. |
3892 | 5401 |
^ menu |
7763 | 5402 |
|
11783 | 5403 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5404 |
! |
5405 |
||
5406 |
menuDirHistoryBack |
|
5407 |
"initialize the directory menu |
|
5408 |
" |
|
5409 |
<resource: #programMenu > |
|
5410 |
||
5411 |
^ self menuDirHistory:#back. |
|
5412 |
! |
|
5413 |
||
5414 |
menuDirHistoryForward |
|
5415 |
"initialize the directory menu |
|
5416 |
" |
|
5417 |
<resource: #programMenu > |
|
5418 |
||
5419 |
^ self menuDirHistory:#forward. |
|
3906 | 5420 |
! |
5421 |
||
5422 |
menuFileHistory |
|
5423 |
"initialize the file history menu |
|
5424 |
" |
|
5425 |
<resource: #programMenu > |
|
5426 |
||
7763 | 5427 |
|menu hist text removeItem| |
3906 | 5428 |
|
5429 |
hist := self fileHistory. |
|
5430 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5431 |
|
7763 | 5432 |
menu := Menu new. |
5433 |
||
5434 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5435 |
aFileItem fileName exists ifTrue:[ |
12963 | 5436 |
menu addItem:(MenuItem |
5437 |
label: aFileItem fileName asString |
|
14593 | 5438 |
itemValue: |
5439 |
[ |
|
5440 |
self setCurrentFileName:(aFileItem fileName). |
|
5441 |
self openApplByFileItem:aFileItem |
|
5442 |
] |
|
5443 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5444 |
] ifFalse:[ |
7763 | 5445 |
"/ remove all not existing history entries |
5446 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5447 |
] |
3906 | 5448 |
]. |
7763 | 5449 |
menu addSeparator. |
5450 |
||
4080 | 5451 |
removeItem := MenuItem new. |
5452 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5453 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5454 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5455 |
removeItem label:text. |
11783 | 5456 |
removeItem |
5457 |
itemValue:[ |
|
5458 |
self fileHistory removeAll. |
|
5459 |
self enableFileHistory value:false. |
|
5460 |
]. |
|
3906 | 5461 |
menu addItem:removeItem. |
7763 | 5462 |
menu findGuiResourcesIn:self. |
3906 | 5463 |
^ menu |
7763 | 5464 |
|
11783 | 5465 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5466 |
! |
5467 |
||
4080 | 5468 |
sortMenu |
5469 |
<resource: #programMenu > |
|
5470 |
||
5471 |
|menu| |
|
5472 |
||
7763 | 5473 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5474 |
menu findGuiResourcesIn:self. |
5475 |
^ menu |
|
7763 | 5476 |
|
5477 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5478 |
! |
5479 |
||
5480 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5481 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5482 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5483 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5484 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5485 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5486 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5487 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5488 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5489 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5490 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5491 |
^ spec |
4080 | 5492 |
! |
5493 |
||
5494 |
viewInContentsBrowserMenu |
|
5009 | 5495 |
self |
5496 |
applicationNamed:#DirectoryContentsBrowser |
|
5497 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5498 |
||
5499 |
^ nil. |
|
4080 | 5500 |
! |
5501 |
||
3952 | 5502 |
visitedDirectoriesMenu |
5503 |
<resource: #programMenu > |
|
5504 |
||
5505 |
|menu histCopy text removeItem| |
|
5506 |
||
7763 | 5507 |
histCopy := self directoryHistory. |
5508 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5509 |
||
3952 | 5510 |
menu := Menu new. |
7763 | 5511 |
|
5512 |
histCopy do:[:aFile| |
|
12963 | 5513 |
menu addItem:(MenuItem |
5514 |
label:aFile asString |
|
5515 |
itemValue:[ |
|
5516 |
self setCurrentFileName:(aFile path asFilename). |
|
5517 |
]). |
|
7763 | 5518 |
]. |
5519 |
menu addSeparator. |
|
5520 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5521 |
"/ 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
|
5522 |
text := (resources string:'Clear History'). |
3952 | 5523 |
removeItem := MenuItem new. |
4040 | 5524 |
removeItem translateLabel:true. |
3952 | 5525 |
removeItem label:text. |
11783 | 5526 |
removeItem |
5527 |
itemValue:[ |
|
5528 |
self directoryHistory removeAll. |
|
5529 |
self enableForward value:self canForward. |
|
5530 |
self enableBack value:self canBackward. |
|
5531 |
]. |
|
7763 | 5532 |
|
3952 | 5533 |
menu addItem:removeItem. |
7763 | 5534 |
menu findGuiResourcesIn:self. |
3952 | 5535 |
^ menu |
7763 | 5536 |
|
11783 | 5537 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5538 |
! ! |
5539 |
||
5880 | 5540 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5541 |
||
5542 |
doCompareTwoFiles |
|
5543 |
self openDiffView. |
|
5544 |
! |
|
5545 |
||
5546 |
doGoDirectoryUp |
|
5960 | 5547 |
| upDir directory rootInTreeView| |
5880 | 5548 |
|
5549 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5550 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5551 |
directory := self currentDirectory. |
5552 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5553 |
] ifFalse:[ |
5554 |
rootInTreeView := self |
|
5555 |
applicationNamed:#DirectoryTreeBrowser |
|
5556 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5557 |
directory := rootInTreeView value asFilename. |
5558 |
]. |
|
5559 |
upDir := directory directory. |
|
5959 | 5560 |
self setCurrentFileName:upDir. |
5880 | 5561 |
! |
5562 |
||
5563 |
doGotoDefaultDirectory |
|
5564 |
self gotoFile:(Filename defaultDirectory). |
|
5565 |
! |
|
5566 |
||
8091 | 5567 |
doGotoDesktopDirectory |
5568 |
self gotoFile:(Filename desktopDirectory). |
|
5569 |
! |
|
5570 |
||
5880 | 5571 |
doGotoHomeDirectory |
8091 | 5572 |
self gotoFile:(Filename homeDirectory). |
5880 | 5573 |
! |
5574 |
||
6434 | 5575 |
doGotoSmalltalkDirectory |
5576 |
self gotoFile:(self smalltalkDirectory). |
|
5577 |
! |
|
5578 |
||
17187 | 5579 |
doGotoSmalltalkWorkspaceDirectory |
5580 |
self gotoFile:(UserPreferences current workspaceDirectory). |
|
5581 |
! |
|
5582 |
||
9677 | 5583 |
doGotoTempDirectory |
5584 |
self gotoFile:(self tempDirectory). |
|
5585 |
||
5586 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5587 |
! |
|
5588 |
||
9596 | 5589 |
doMakeCurrentDirectory |
5590 |
OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
5591 |
self currentFileNameHolderChangedForCommon. |
|
5592 |
||
5593 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
5594 |
! |
|
5595 |
||
5880 | 5596 |
fileGetInfo:longInfo |
5597 |
"get info on selected file - show it in a box" |
|
5598 |
||
5599 |
|string box updater| |
|
5600 |
||
5601 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5602 |
string notNil ifTrue:[ |
|
5603 |
box := InfoBox title:string. |
|
5604 |
updater := [ |
|
5605 |
[true] whileTrue:[ |
|
5606 |
Delay waitForSeconds:2. |
|
5607 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5608 |
string isNil ifTrue:[ ^ self]. |
|
5609 |
box title:string |
|
5610 |
] |
|
5611 |
] fork. |
|
5612 |
box show. |
|
5613 |
updater terminate. |
|
5614 |
box destroy |
|
5615 |
] |
|
6434 | 5616 |
! |
5617 |
||
5618 |
smalltalkDirectory |
|
8590 | 5619 |
|stxPath| |
6434 | 5620 |
|
5621 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 5622 |
stxPath isNil ifTrue:[ |
5623 |
^ Filename currentDirectory |
|
5624 |
]. |
|
5625 |
^ stxPath asFilename directory. |
|
9677 | 5626 |
! |
5627 |
||
5628 |
tempDirectory |
|
5629 |
^ Filename tempDirectory. |
|
5630 |
||
5631 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 5632 |
! ! |
5633 |
||
11139 | 5634 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
5635 |
||
14262 | 5636 |
addDirToJavaSourcePath |
5637 |
"add the current path to java's sourcePath |
|
5638 |
(only available with ST/J System" |
|
5639 |
||
5640 |
Java addToSourcePath:self currentDirectory pathName |
|
5641 |
||
5642 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
5643 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
5644 |
! |
|
5645 |
||
11139 | 5646 |
copyFiles |
5647 |
self |
|
5648 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
5649 |
! |
|
5650 |
||
5651 |
cutFiles |
|
5652 |
self |
|
5653 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
5654 |
! |
|
5655 |
||
5656 |
deleteFiles |
|
5657 |
self |
|
5658 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
5659 |
! |
|
5660 |
||
5661 |
eraseFiles |
|
5662 |
self |
|
5663 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
5664 |
! |
|
5665 |
||
14262 | 5666 |
fileAddToJavaSourcePath |
5667 |
"add the current path to java's sourcePath |
|
5668 |
(only available with ST/J System" |
|
5669 |
||
5670 |
self currentSelectedObjects do:[:each | |
|
5671 |
Java addToSourcePath:(each pathName) |
|
5672 |
]. |
|
5673 |
||
5674 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
5675 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
5676 |
! |
|
5677 |
||
11139 | 5678 |
openSettingsDialog |
5679 |
|dialog| |
|
5680 |
||
5681 |
dialog := FileBrowserV2SettingsDialog new. |
|
5682 |
dialog settingsDialog:self. |
|
5683 |
dialog allButOpen. |
|
5684 |
dialog doReload. |
|
5685 |
dialog openWindow |
|
5686 |
! |
|
5687 |
||
5688 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
5689 |
|files dirs| |
|
5690 |
||
5691 |
files := self currentSelectedFiles. |
|
5692 |
files notEmpty ifTrue:[ |
|
5693 |
aBlock value:files. |
|
5694 |
] ifFalse:[ |
|
5695 |
dirs := self currentSelectedDirectories. |
|
5696 |
dirs notEmpty ifTrue:[ |
|
5697 |
aBlock value:dirs. |
|
5698 |
]. |
|
5699 |
]. |
|
5700 |
! ! |
|
5701 |
||
5702 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
5703 |
||
5704 |
openAboutThisApplication |
|
5705 |
"opens an about box for this application." |
|
5706 |
||
5707 |
Dialog aboutClass:self class. |
|
5708 |
! |
|
5709 |
||
5710 |
openHTMLDocument:relativeDocPath |
|
5711 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
5712 |
! ! |
|
5713 |
||
5714 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 5715 |
|
15905 | 5716 |
canCvsAddAndCommit |
5717 |
||
5718 |
|selectedFiles| |
|
5719 |
||
5720 |
selectedFiles := self currentSelectedObjects. |
|
5721 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
5722 |
! |
|
5723 |
||
5724 |
canRemoveCVSContainer |
|
5725 |
^ self currentSelectedFiles |
|
5726 |
contains:[:fileName| |
|
5727 |
|dirOfFile cvsDir| |
|
5728 |
||
5729 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
5730 |
cvsDir := dirOfFile construct:'CVS'. |
|
5731 |
cvsDir isDirectory |
|
5732 |
]. |
|
5733 |
! |
|
5734 |
||
12777 | 5735 |
commitFilesToCVS:files |
5736 |
|numFiles| |
|
5737 |
||
5738 |
(numFiles := files size) > 0 ifTrue:[ |
|
5739 |
self withActivityIndicationDo:[ |
|
5740 |
self cvsCommitFiles:files |
|
5741 |
] |
|
5742 |
] |
|
5743 |
! |
|
5744 |
||
3892 | 5745 |
cvsAddAndCommit |
4849 | 5746 |
self cvsAddAndCommitAsBinary:false |
5747 |
! |
|
5748 |
||
5749 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 5750 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 5751 |
|
5752 |
log := Dialog |
|
11139 | 5753 |
requestText:(resources string:'Enter initial log message:') |
4414 | 5754 |
lines:10 |
5755 |
columns:70 |
|
5756 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
5757 |
log isNil ifTrue:[^ self]. |
3892 | 5758 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5759 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5760 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5761 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5762 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5763 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5764 |
|
8588 | 5765 |
binArg := ''. |
5766 |
asBinary ifTrue:[ |
|
5767 |
binArg := '-kb '. |
|
5768 |
]. |
|
3982 | 5769 |
sel := self currentSelectedFiles. |
11139 | 5770 |
executionBlock := |
5771 |
[:stream | |
|
5772 |
log notNil ifTrue:[ |
|
17416 | 5773 |
sel notEmptyOrNil ifTrue:[ |
11139 | 5774 |
sel do:[:fn | |
5775 |
|nameArg| |
|
5776 |
||
5777 |
nameArg := '"',fn baseName,'"'. |
|
5778 |
||
5779 |
dir := self getDirWithoutFileName:fn. |
|
5780 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
5781 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5782 |
||
5783 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5784 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 5785 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
5786 |
"/ support and need the 'admin -kb' command. |
|
5787 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
5788 |
asBinary ifTrue:[ |
|
5789 |
cmd := ('cvs admin -kb ' , nameArg). |
|
5790 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5791 |
||
5792 |
cmd := ('cvs upd ' , nameArg). |
|
5793 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5794 |
]. |
|
5795 |
] |
|
5796 |
] |
|
5797 |
] |
|
5798 |
]. |
|
4107 | 5799 |
nameString := 'Command> cvs add and commit'. |
3892 | 5800 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 5801 |
|
17416 | 5802 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 5803 |
! |
5804 |
||
4849 | 5805 |
cvsAddBinaryAndCommit |
5806 |
self cvsAddAndCommitAsBinary:true |
|
5807 |
! |
|
5808 |
||
3892 | 5809 |
cvsCommit |
12777 | 5810 |
|selectedFiles| |
3892 | 5811 |
|
3982 | 5812 |
selectedFiles:= self currentSelectedFiles. |
12777 | 5813 |
self cvsCommitFiles:selectedFiles |
5814 |
! |
|
5815 |
||
5816 |
cvsCommitFiles:files |
|
5817 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
5818 |
||
5819 |
nFiles := files size. |
|
5820 |
nFiles == 0 ifTrue:[^ self]. |
|
5821 |
||
5822 |
nFiles == 1 ifTrue:[ |
|
5823 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 5824 |
] ifFalse:[ |
12777 | 5825 |
nFiles > 1 ifTrue:[ |
5826 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 5827 |
] ifFalse:[ |
6627 | 5828 |
msg := resources string:'Enter log message for checkIn' |
4414 | 5829 |
] |
3892 | 5830 |
]. |
5831 |
||
5832 |
log := Dialog |
|
4414 | 5833 |
requestText:msg |
5834 |
lines:10 |
|
5835 |
columns:70 |
|
5836 |
initialAnswer:nil. |
|
3892 | 5837 |
|
4663 | 5838 |
log isNil ifTrue:[^ self]. |
12777 | 5839 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5840 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5841 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 5842 |
"/ save the log message into another tempFile ... |
13121 | 5843 |
s := FileStream newTemporary. |
5844 |
logTmp := s fileName. |
|
12777 | 5845 |
s nextPutAll:log. |
5846 |
s close. |
|
5847 |
||
5848 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5849 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5850 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5851 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5852 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5853 |
executionBlock := [:stream | |
12777 | 5854 |
[ |
5855 |
files do:[:fn | |
|
5856 |
| dir nameArg cmd | |
|
5857 |
||
5858 |
nameArg := '"',fn baseName,'"'. |
|
5859 |
dir := fn directory. |
|
5860 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
5861 |
stream showCR:fn pathName. |
|
5862 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 5863 |
] |
12777 | 5864 |
] ensure:[ |
5865 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5866 |
]. |
|
4107 | 5867 |
]. |
5868 |
nameString := 'Command> cvs commit'. |
|
5869 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 5870 |
! |
5871 |
||
14527 | 5872 |
cvsCommitFolder |
5873 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
5874 |
||
5875 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
5876 |
||
5877 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
5878 |
log := Dialog |
|
5879 |
requestText:msg |
|
5880 |
lines:10 |
|
5881 |
columns:70 |
|
5882 |
initialAnswer:nil. |
|
5883 |
||
5884 |
log isNil ifTrue:[^ self]. |
|
5885 |
log := log replChar:$" withString:'\"'. |
|
5886 |
||
5887 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5888 |
"/ save the log message into another tempFile ... |
|
5889 |
s := FileStream newTemporary. |
|
5890 |
logTmp := s fileName. |
|
5891 |
s nextPutAll:log. |
|
5892 |
s close. |
|
5893 |
||
5894 |
logArg := '-F "', logTmp pathName, '"'. |
|
5895 |
] ifFalse:[ |
|
5896 |
logArg := '-m ''' , log , ''''. |
|
5897 |
]. |
|
5898 |
||
5899 |
executionBlock := [:stream | |
|
5900 |
[ |
|
5901 |
|cmd| |
|
5902 |
||
5903 |
cmd := 'cvs commit ',logArg. |
|
5904 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5905 |
] ensure:[ |
|
5906 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5907 |
]. |
|
5908 |
]. |
|
5909 |
||
5910 |
nameString := 'Command> cvs commit'. |
|
5911 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
5912 |
! |
|
5913 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5914 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5915 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5916 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5917 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5918 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5919 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5920 |
|
15589 | 5921 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5922 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5923 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5924 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5925 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5926 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5927 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5928 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5929 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5930 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5931 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5932 |
|
15211 | 5933 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
5934 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
5935 |
||
5936 |
|toRemove updateRunning executionBlock nameString| |
|
5937 |
||
5938 |
updateRunning := self backgroundProcesses value notEmpty. |
|
5939 |
self killAllRunningBackgroundProcesses. |
|
5940 |
toRemove := OrderedCollection new. |
|
5941 |
||
5942 |
executionBlock := |
|
5943 |
[:stream | |
|
5944 |
|cmd logArg prevDir prevFiles| |
|
5945 |
||
5946 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5947 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
5948 |
] ifFalse:[ |
|
5949 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
5950 |
]. |
|
5951 |
prevFiles := ''. |
|
5952 |
||
5953 |
filesToRemove do:[:fileName | |
|
5954 |
|dir file| |
|
5955 |
||
5956 |
dir := fileName directory. |
|
5957 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
5958 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
5959 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
5960 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
5961 |
prevFiles := ''. |
|
5962 |
]. |
|
5963 |
||
17116 | 5964 |
OsError handle:[:ex| |
15211 | 5965 |
"was not able to remove it" |
5966 |
| lastError msg | |
|
5967 |
lastError := OperatingSystem lastErrorString. |
|
5968 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
5969 |
lastError isNil ifFalse:[ |
|
5970 |
msg := msg , '\\(' , lastError , ')' |
|
5971 |
]. |
|
5972 |
Dialog warn:msg withCRs |
|
5973 |
] do:[ |
|
5974 |
(fileName isSymbolicLink) ifFalse:[ |
|
5975 |
fileName remove. |
|
5976 |
file := fileName baseName. |
|
5977 |
cmd := ('cvs remove -f "',file,'"'). |
|
5978 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5979 |
"/ Transcript show:dir; space; showCR:cmd. |
|
5980 |
] |
|
5981 |
]. |
|
5982 |
prevDir := dir. |
|
5983 |
prevFiles := prevFiles,' ',file. |
|
5984 |
]. |
|
5985 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
5986 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
5987 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
5988 |
]. |
|
5989 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
5990 |
filesToRemove size > 1 ifTrue:[ |
|
5991 |
nameString := nameString, ' ...'. |
|
5992 |
]. |
|
5993 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
5994 |
! |
|
3892 | 5995 |
|
5996 |
cvsRemoveFileAndCVSContainer |
|
12493 | 5997 |
|files| |
5998 |
||
5999 |
files := self currentSelectedFiles copy. |
|
6000 |
self removeFilesAndCVSContainers:files |
|
3892 | 6001 |
! |
6002 |
||
9338 | 6003 |
cvsRevisionLog |
6004 |
| cmd sel executionBlock nameString| |
|
6005 |
||
6006 |
sel := self currentSelectedObjects. |
|
6007 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6008 |
||
6009 |
executionBlock := [:stream | |
|
6010 |
sel do:[:fn | |
|
6011 |
| dir nameArg | |
|
6012 |
||
6013 |
nameArg := '"',fn baseName,'"'. |
|
6014 |
dir := fn directory. |
|
6015 |
cmd := 'cvs log ' , nameArg. |
|
6016 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6017 |
] |
|
6018 |
]. |
|
6019 |
nameString := 'Command> cvs log'. |
|
6020 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6021 |
! |
|
6022 |
||
8562 | 6023 |
cvsTagSelection |
12856 | 6024 |
|tag tags cmd| |
6025 |
||
6026 |
tag := Dialog |
|
6027 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6028 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6029 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6030 |
||
6031 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6032 |
|
6033 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6034 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6035 |
] ifFalse:[ |
|
6036 |
cmd := 'cvs'. |
|
6037 |
]. |
|
6038 |
||
12856 | 6039 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6040 |
tags do:[:eachTag | |
|
6041 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6042 |
bindWith:cmd |
|
12858 | 6043 |
with:(eachTag withoutSeparators) |
12856 | 6044 |
with:(self makeFileNameArgumentString)) |
6045 |
]. |
|
8562 | 6046 |
! |
6047 |
||
3892 | 6048 |
cvsUpdateAll |
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 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6057 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6058 |
! |
6059 |
||
6060 |
cvsUpdateAllRecursive |
|
6061 |
| cmd | |
|
6062 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6063 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6064 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6065 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6066 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6067 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6068 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6069 |
! |
6070 |
||
6071 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6072 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6073 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6074 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6075 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6076 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6077 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6078 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6079 |
|
15589 | 6080 |
stream := CharacterWriteStream new. |
8563 | 6081 |
stream |
6082 |
nextPutAll:cmd; |
|
6083 |
nextPutAll:' upd '; |
|
6084 |
nextPutAll:(self makeFileNameArgumentString). |
|
6085 |
||
6086 |
self executeCommand:stream contents. |
|
6087 |
! |
|
6088 |
||
6089 |
makeFileNameArgumentString |
|
6090 |
|stream| |
|
6091 |
||
15589 | 6092 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6093 |
self currentSelectedFiles do:[: file | |
8563 | 6094 |
stream nextPut:$". |
4414 | 6095 |
stream nextPutAll:file baseName. |
8563 | 6096 |
stream nextPutAll:'" '. |
6097 |
]. |
|
6098 |
^ stream contents. |
|
12493 | 6099 |
! |
6100 |
||
6101 |
removeFilesAndCVSContainers:files |
|
6102 |
|numFiles question aswer| |
|
6103 |
||
6104 |
(numFiles := files size) > 0 ifTrue:[ |
|
6105 |
numFiles > 1 ifTrue:[ |
|
6106 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6107 |
] ifFalse:[ |
|
6108 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6109 |
]. |
|
6110 |
||
6111 |
aswer := Dialog |
|
6112 |
confirm:question withCRs |
|
6113 |
yesLabel:(resources string:'Remove') |
|
6114 |
noLabel:(resources string:'Cancel'). |
|
6115 |
||
6116 |
aswer ifTrue:[ |
|
6117 |
self withActivityIndicationDo:[ |
|
6118 |
self cvsRemoveAndRemoveFromCVS:files |
|
6119 |
] |
|
6120 |
] |
|
6121 |
] |
|
3892 | 6122 |
! ! |
6123 |
||
14126 | 6124 |
|
11139 | 6125 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6126 |
||
6127 |
mercurialAdd |
|
6128 |
|executionBlock sel maxCmdSize| |
|
6129 |
||
6130 |
maxCmdSize := 512. |
|
6131 |
||
6132 |
sel := self currentSelectedObjects. |
|
6133 |
sel isEmptyOrNil ifTrue:[ |
|
6134 |
^ self |
|
6135 |
]. |
|
6136 |
||
6137 |
executionBlock := |
|
6138 |
[:stream | |
|
6139 |
|prevDir cmd| |
|
6140 |
||
6141 |
prevDir := nil. |
|
6142 |
sel do:[:fn | |
|
6143 |
|nameArg dir| |
|
6144 |
||
6145 |
nameArg := '"',fn baseName,'"'. |
|
6146 |
dir := fn directory. |
|
6147 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6148 |
"/ flush |
|
6149 |
cmd notNil ifTrue:[ |
|
6150 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6151 |
cmd := nil. |
|
6152 |
] |
|
6153 |
]. |
|
6154 |
cmd isNil ifTrue:[ |
|
6155 |
cmd := 'hg add'. |
|
6156 |
]. |
|
6157 |
cmd := cmd,' ',nameArg. |
|
6158 |
prevDir := dir. |
|
6159 |
]. |
|
6160 |
cmd notNil ifTrue:[ |
|
6161 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6162 |
cmd := nil. |
|
6163 |
]. |
|
6164 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6165 |
]. |
|
6166 |
||
6167 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6168 |
||
6169 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6170 |
! |
|
6171 |
||
6172 |
mercurialCommit |
|
6173 |
|dir executionBlock| |
|
6174 |
||
6175 |
"/ dir := self currentDirectory. |
|
6176 |
dir := self directoryContentsBrowser directory. |
|
6177 |
executionBlock := |
|
6178 |
[:stream | |
|
6179 |
(self getExecutionBlockForCommand:'hg commit' |
|
6180 |
inDirectory:dir) value:stream. |
|
6181 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6182 |
]. |
11139 | 6183 |
|
6184 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6185 |
||
6186 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6187 |
! |
|
6188 |
||
11144 | 6189 |
mercurialInit |
6190 |
|dir executionBlock| |
|
6191 |
||
6192 |
dir := self directoryContentsBrowser directory. |
|
6193 |
||
6194 |
(Dialog confirm:(resources |
|
6195 |
string:'Initialize new Mercurial Repository in %1?' |
|
6196 |
with:dir baseName)) ifFalse:[^ self]. |
|
6197 |
||
6198 |
executionBlock := |
|
6199 |
[:stream | |
|
6200 |
(self getExecutionBlockForCommand:('hg init') |
|
6201 |
inDirectory:dir) value:stream. |
|
6202 |
]. |
|
6203 |
||
6204 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6205 |
||
6206 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6207 |
! |
|
6208 |
||
11139 | 6209 |
mercurialPush |
6210 |
|destination dir executionBlock| |
|
6211 |
||
6212 |
destination := Dialog request:'Mercurial Repository' |
|
6213 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6214 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6215 |
||
6216 |
LastMercurialRepository := destination. |
|
6217 |
||
6218 |
dir := self directoryContentsBrowser directory. |
|
6219 |
executionBlock := |
|
6220 |
[:stream | |
|
6221 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6222 |
inDirectory:dir) value:stream. |
|
6223 |
]. |
|
6224 |
||
6225 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6226 |
||
6227 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6228 |
! |
|
6229 |
||
6230 |
mercurialStatus |
|
6231 |
|executionBlock sel maxCmdSize| |
|
6232 |
||
6233 |
maxCmdSize := 512. |
|
6234 |
||
6235 |
sel := self currentSelectedObjects. |
|
6236 |
sel isEmptyOrNil ifTrue:[ |
|
6237 |
^ self |
|
6238 |
]. |
|
6239 |
||
6240 |
executionBlock := |
|
6241 |
[:stream | |
|
6242 |
|prevDir cmd| |
|
6243 |
||
6244 |
prevDir := nil. |
|
6245 |
sel do:[:fn | |
|
6246 |
|nameArg dir| |
|
6247 |
||
6248 |
nameArg := '"',fn baseName,'"'. |
|
6249 |
dir := fn directory. |
|
6250 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6251 |
"/ flush |
|
6252 |
cmd notNil ifTrue:[ |
|
6253 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6254 |
cmd := nil. |
|
6255 |
] |
|
6256 |
]. |
|
6257 |
cmd isNil ifTrue:[ |
|
6258 |
cmd := 'hg status'. |
|
6259 |
]. |
|
6260 |
cmd := cmd,' ',nameArg. |
|
6261 |
prevDir := dir. |
|
6262 |
]. |
|
6263 |
cmd notNil ifTrue:[ |
|
6264 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6265 |
cmd := nil. |
|
6266 |
]. |
|
6267 |
]. |
|
6268 |
||
6269 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6270 |
||
6271 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6272 |
! ! |
6273 |
||
4849 | 6274 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6275 |
|
8510 | 6276 |
allFilesInSelectedDirectoriesForWhich:aBlock |
6277 |
|directories allFiles| |
|
6278 |
||
6279 |
directories := self currentSelectedDirectories. |
|
6280 |
directories isEmpty ifTrue:[^ self]. |
|
6281 |
||
6282 |
allFiles := OrderedCollection new. |
|
6283 |
directories do:[:dir| |
|
6284 |
[ |
|
6285 |
|fileNames| |
|
6286 |
||
6287 |
fileNames := dir directoryContents. |
|
6288 |
fileNames notNil ifTrue:[ |
|
6289 |
fileNames := fileNames |
|
6290 |
collect:[:fn | dir construct:fn] |
|
6291 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
6292 |
allFiles addAll:fileNames. |
|
6293 |
] |
|
6294 |
] on:FileStream openErrorSignal do:[:ex| |
|
6295 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
|
6296 |
with:ex pathName |
|
6297 |
with:ex description). |
|
6298 |
ex proceedWith:nil. |
|
6299 |
]. |
|
6300 |
]. |
|
6301 |
||
6302 |
^ allFiles |
|
6303 |
! |
|
6304 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6305 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6306 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6307 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6308 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6309 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6310 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6311 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6312 |
"/ 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
|
6313 |
"/ 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
|
6314 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6315 |
conv := OrderedCollection new. |
4722 | 6316 |
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
|
6317 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6318 |
outSuffix = 'png' ifTrue:[ |
4722 | 6319 |
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
|
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 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6323 |
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
|
6324 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6325 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6326 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6327 |
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
|
6328 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6329 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6330 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6331 |
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
|
6332 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6333 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6334 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6335 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6336 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6337 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6338 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6339 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6340 |
outSuffix := outFile suffix. |
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 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6343 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6344 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6345 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6346 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6347 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6348 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6349 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6350 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6351 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6352 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6353 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6354 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6355 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6356 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6357 |
|
4367 | 6358 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6359 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6360 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6361 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6362 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6363 |
self convertImageToSuffix:'jpg' |
4531 | 6364 |
! |
6365 |
||
6366 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6367 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6368 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6369 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6370 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6371 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6372 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6373 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6374 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6375 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6376 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6377 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6378 |
fileName isDirectory ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6379 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6380 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6381 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6382 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6383 |
outFile exists ifTrue:[ |
4722 | 6384 |
|answer| |
6385 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6386 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6387 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6388 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6389 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6390 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6391 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6392 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6393 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6394 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6395 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6396 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6397 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6398 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6399 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6400 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6401 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6402 |
] |
4721
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 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6405 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6406 |
self updateAndSelect:nil. |
4367 | 6407 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6408 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6409 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6410 |
self notify:nil. |
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 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6413 |
"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
|
6414 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6415 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6416 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6417 |
self convertImageToSuffix:'xpm' |
4367 | 6418 |
! |
6419 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6420 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6421 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6422 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
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 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6425 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6426 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6427 |
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
|
6428 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6429 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6430 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6431 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6432 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6433 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6434 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6435 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6436 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6437 |
|image tempStreamXPM| |
9493
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 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6440 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6441 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6442 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6443 |
]. |
13121 | 6444 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6445 |
XPMReader save:image onStream:tempStreamXPM. |
|
6446 |
tempStreamXPM close. |
|
6447 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6448 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6449 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6450 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6451 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6452 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6453 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6454 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6455 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6456 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6457 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6458 |
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
|
6459 |
|
13121 | 6460 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6461 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6462 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6463 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6464 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6465 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6466 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6467 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6468 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6469 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6470 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6471 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6472 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6473 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6474 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6475 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6476 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6477 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6478 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6479 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6480 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6481 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6482 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6483 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6484 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6485 |
] ifCurtailed:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6486 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6487 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6488 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6489 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6490 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6491 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6492 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6493 |
|
3892 | 6494 |
createProjectAndOpenProjectBrowser |
6495 |
|nm f s directory| |
|
6496 |
||
6497 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6498 |
directory := self currentDirectory. |
3892 | 6499 |
nm := directory baseName. |
6500 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6501 |
f exists ifTrue:[ |
|
4414 | 6502 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6503 |
^ self. |
|
3892 | 6504 |
]. |
6505 |
s := f writeStream. |
|
6506 |
s nextPutAll:' |
|
6507 |
name ''' , nm , ''' |
|
6508 |
type #classLibrary |
|
6509 |
package #''private:' , nm , ''' |
|
6510 |
prerequisites nil |
|
6511 |
||
6512 |
classes #( ) |
|
6513 |
'. |
|
6514 |
s close. |
|
6515 |
ProjectBrowser openOnFile:f. |
|
6516 |
! |
|
6517 |
||
5880 | 6518 |
doExecuteCommand |
6519 |
"execute an OperatingSystem-command" |
|
6520 |
||
6521 |
| action fileName| |
|
6522 |
||
6523 |
fileName := self firstSelectedFile. |
|
6524 |
action := [:command | |
|
6525 |
self addToCommandHistory:command for:fileName. |
|
6526 |
self executeCommand:command. |
|
6527 |
]. |
|
6528 |
self askForCommandFor:fileName thenDo:action |
|
6529 |
! |
|
6530 |
||
6531 |
doExecuteScript |
|
16941 | 6532 |
"execute a Smalltalk script" |
5880 | 6533 |
|
6534 |
|textHolder dialog template dummyClass dummyInstance| |
|
6535 |
||
6536 |
template := |
|
6537 |
'"/ Smalltalk script: |
|
6538 |
||
16084 | 6539 |
"/ the following variables are accessible: |
5880 | 6540 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6541 |
"/ selectedFiles (= ...) |
|
6542 |
"/ |
|
6543 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6544 |
"/ |
|
6545 |
"/ Useful operations are: |
|
6546 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6547 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6548 |
"/ directory directory |
|
6549 |
"/ |
|
6550 |
"/ example: move all files which match a aarticular pattern to |
|
6551 |
"/ a separate directory: |
|
6552 |
"/ |
|
6553 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6554 |
"/ |
|
6555 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6556 |
"/ |
|
6557 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6558 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6559 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6560 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6561 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6562 |
"/ newDir := directory construct:prefix. |
|
6563 |
"/ newDir exists ifFalse:[ |
|
6564 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6565 |
"/ newDir makeDirectory. |
|
6566 |
"/ ]. |
|
6567 |
"/ ]. |
|
6568 |
"/ newDir exists ifTrue:[ |
|
6569 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6570 |
"/ newFile := newDir construct:rest. |
|
6571 |
"/ oldFile moveTo:newFile |
|
6572 |
"/ ] |
|
6573 |
"/ ] |
|
6574 |
"/ ] |
|
6575 |
'. |
|
6576 |
||
6577 |
LastScriptBlockString isNil ifTrue:[ |
|
6578 |
LastScriptBlockString := template. |
|
6579 |
]. |
|
6580 |
||
6581 |
textHolder := ValueHolder new. |
|
6582 |
dialog := Dialog |
|
6583 |
forRequestText:(resources string:'Enter script') |
|
6584 |
editViewClass:CodeView |
|
6585 |
lines:25 |
|
6586 |
columns:70 |
|
6587 |
initialAnswer:LastScriptBlockString |
|
6588 |
model:textHolder. |
|
6589 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
6590 |
dialog open. |
|
6591 |
dialog accepted ifFalse:[^ self]. |
|
6592 |
||
6593 |
LastScriptBlockString := textHolder value. |
|
6594 |
||
6595 |
Class classConventionViolationConfirmationQuerySignal |
|
6596 |
answer:true |
|
6597 |
do:[ |
|
6598 |
dummyClass := Object class |
|
6599 |
name:#Dummy |
|
6600 |
inEnvironment:nil |
|
6601 |
subclassOf:Object |
|
6602 |
instanceVariableNames:'directory selectedFiles' |
|
6603 |
variable:false |
|
6604 |
words:true |
|
6605 |
pointers:true |
|
6606 |
classVariableNames:'' |
|
6607 |
poolDictionaries:'' |
|
6608 |
category:#dummyCategory |
|
6609 |
comment:nil |
|
6610 |
changed:true. |
|
6611 |
]. |
|
6612 |
||
6613 |
dummyInstance := dummyClass basicNew. |
|
6614 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
6615 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
6616 |
||
6617 |
Compiler |
|
6618 |
evaluate:textHolder value |
|
6619 |
in:nil |
|
6620 |
receiver:dummyInstance |
|
6621 |
notifying:nil |
|
6622 |
logged:false |
|
6623 |
ifFail:[] |
|
6624 |
compile:true. |
|
6625 |
||
6626 |
"/ fileName := self firstSelectedFile. |
|
6627 |
"/ action := [:command | |
|
6628 |
"/ self addToCommandHistory:command for:fileName. |
|
6629 |
"/ self executeCommand:command. |
|
6630 |
"/ ]. |
|
6631 |
"/ self askForCommandFor:fileName thenDo:action |
|
6632 |
! |
|
6633 |
||
4230 | 6634 |
doMake |
7938 | 6635 |
|dir cmd| |
4230 | 6636 |
|
13856 | 6637 |
cmd := self makeCommandHolder value. |
6638 |
||
6639 |
"Make" |
|
6640 |
cmd = 'make' ifTrue:[ |
|
6641 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6642 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6643 |
dir notNil ifTrue:[ |
|
6644 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
6645 |
cmd := 'bmake.bat'. |
|
6646 |
] |
|
7938 | 6647 |
] |
13856 | 6648 |
]. |
6649 |
self executeCommand:cmd. |
|
6650 |
^self. |
|
6651 |
]. |
|
6652 |
||
6653 |
"Apache ant" |
|
6654 |
cmd = 'ant' ifTrue:[ |
|
6655 |
self executeCommand:cmd. |
|
6656 |
^self. |
|
6657 |
]. |
|
6658 |
||
6659 |
"Add more here..." |
|
6660 |
||
6661 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 6662 |
! |
6663 |
||
8256 | 6664 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6665 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6666 |
(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
|
6667 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6668 |
|
8256 | 6669 |
|destDir| |
6670 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6671 |
(CBrowser isNil or:[ CBrowser::Browser isNil ]) ifTrue:[ |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6672 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6673 |
]. |
8256 | 6674 |
destDir := self currentDirectory. |
6675 |
CBrowser::Browser openIn:destDir pathName |
|
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6676 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6677 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6678 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
8256 | 6679 |
! |
6680 |
||
7829 | 6681 |
doOpenExplorer |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6682 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6683 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6684 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
7829 | 6685 |
! |
6686 |
||
12473 | 6687 |
doOpenFinder |
6688 |
self currentDirectory asFilename openFinder |
|
6689 |
||
6690 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
6691 |
! |
|
6692 |
||
12811 | 6693 |
doOpenMonticelloBrowser |
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6694 |
MCMczReader isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/monticello']. |
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6695 |
|
12811 | 6696 |
self withWaitCursorDo:[ |
6697 |
self currentSelectedFiles do:[:fn | |
|
6698 |
|version snapshot| |
|
6699 |
||
6700 |
fn suffix asLowercase = 'mcz' ifTrue:[ |
|
6701 |
version := MCMczReader versionFromFile:fn. |
|
6702 |
snapshot := version snapshot. |
|
6703 |
(Tools::ChangeSetBrowser2 |
|
6704 |
on: snapshot asChangeSet |
|
6705 |
label: version info name) |
|
6706 |
beTwoColumn; |
|
6707 |
targetNamespace:nil; |
|
6708 |
targetPackage:nil; |
|
6709 |
open |
|
6710 |
] |
|
6711 |
] |
|
6712 |
] |
|
6713 |
! |
|
6714 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6715 |
doOpenSettings |
8168 | 6716 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6717 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6718 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6719 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6720 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6721 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6722 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6723 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6724 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6725 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6726 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6727 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6728 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6729 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6730 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6731 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6732 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6733 |
|
7104 | 6734 |
editMode:aSymbol |
6735 |
self |
|
6736 |
applicationNamed:#FileApplicationNoteBook |
|
6737 |
ifPresentDo:[:appl | |
|
6738 |
|subApp| |
|
6739 |
||
6740 |
subApp := appl selectedApplication. |
|
6741 |
subApp notNil ifTrue:[ |
|
6742 |
^ subApp perform:aSymbol |
|
6743 |
] |
|
6744 |
]. |
|
6745 |
||
6746 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
6747 |
! |
|
6748 |
||
6749 |
editModeInsert |
|
6750 |
self editMode:#editModeInsert |
|
6751 |
||
6752 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
6753 |
! |
|
6754 |
||
6755 |
editModeInsertAndSelect |
|
6756 |
self editMode:#editModeInsertAndSelect |
|
6757 |
||
6758 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
6759 |
! |
|
6760 |
||
6761 |
editModeOverwrite |
|
6762 |
self editMode:#editModeOverwrite |
|
6763 |
||
6764 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
6765 |
! |
|
6766 |
||
15528 | 6767 |
fetchFileByURL |
6768 |
|url destinationFilename| |
|
6769 |
||
6770 |
url := Dialog request:'URL to Fetch:' initialAnswer:'http://host/path'. |
|
6771 |
url isEmptyOrNil ifTrue:[^ self]. |
|
6772 |
url := url asURL. |
|
6773 |
||
6774 |
destinationFilename := Dialog request:'Download As:' initialAnswer:(UnixFilename named:url path) baseName. |
|
6775 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
|
6776 |
||
6777 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
6778 |
destinationFilename exists ifTrue:[ |
|
6779 |
|answer| |
|
6780 |
||
6781 |
answer := Dialog |
|
6782 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
6783 |
default:false. |
|
6784 |
answer ~~ true ifTrue:[^ self]. |
|
6785 |
]. |
|
6786 |
self withActivityIndicationDo:[ |
|
6787 |
self notify:(resources string:'Fetching %1' with:url). |
|
6788 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
6789 |
self notify:nil. |
|
6790 |
] |
|
6791 |
||
6792 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
|
6793 |
! |
|
6794 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6795 |
fileContentsAsByteArray |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6796 |
|file| |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6797 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6798 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6799 |
file isNil ifTrue:[^ self ]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6800 |
file asFilename fileSize > (1024*1024) ifTrue:[ |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6801 |
file asFilename fileSize > (128*1024*1024) ifTrue:[ |
11889 | 6802 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6803 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6804 |
]. |
11889 | 6805 |
(Dialog confirm:(resources string:'File is big - proceed ?')) ifFalse:[^ self]. |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6806 |
]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6807 |
file asFilename binaryContentsOfEntireFile inspect |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6808 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6809 |
|
3892 | 6810 |
fileFileIn |
6811 |
"fileIn the selected file(s)" |
|
6812 |
||
6813 |
self fileFileInLazy:false |
|
6814 |
! |
|
6815 |
||
7324 | 6816 |
fileFileIn:aFilename lazy:lazy |
6817 |
"fileIn a file" |
|
6818 |
||
6819 |
self withActivityIndicationDo:[ |
|
6820 |
self notify:('File in:', aFilename asFilename baseName). |
|
6821 |
self singleFileFileIn:aFilename lazy:lazy. |
|
6822 |
self notify:nil. |
|
6823 |
] |
|
6824 |
||
6825 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
6826 |
! |
|
6827 |
||
3892 | 6828 |
fileFileInLazy |
6829 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
6830 |
||
6831 |
self fileFileInLazy:true |
|
6832 |
! |
|
6833 |
||
6834 |
fileFileInLazy:lazy |
|
6835 |
"fileIn the selected file(s)" |
|
6836 |
||
7324 | 6837 |
self currentSelectedFiles do:[:fileName | |
6838 |
self fileIn:fileName lazy:lazy |
|
6839 |
]. |
|
6840 |
||
6841 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 6842 |
! |
6843 |
||
12497 | 6844 |
fileFileInPackage |
6845 |
"assuming the current directory is a package directory, load it" |
|
6846 |
||
6847 |
|packageDir dir path top packageID| |
|
6848 |
||
6849 |
"/ find a reasonable package-id (walk up until we find stx) |
|
6850 |
path := ''. |
|
6851 |
dir := packageDir := self currentDirectory. |
|
6852 |
||
6853 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
6854 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
6855 |
path := dir baseName , '/' , path. |
|
6856 |
dir := dir directory. |
|
6857 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6858 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 6859 |
"/ should ask the user for a packageID and proceed... |
6860 |
^ self. |
|
6861 |
]. |
|
6862 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6863 |
packageID := path copyButLast:1. |
12497 | 6864 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
6865 |
! |
|
6866 |
||
3892 | 6867 |
fileFileInToNameSpace |
6868 |
"fileIn the selected file(s)<into a nameSpace" |
|
6869 |
||
6870 |
|ns listOfKnownNameSpaces| |
|
6871 |
||
6872 |
listOfKnownNameSpaces := Set new. |
|
6873 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
6874 |
allNameSpaces |
4414 | 6875 |
do:[:eachNameSpace | |
6876 |
listOfKnownNameSpaces add:eachNameSpace name |
|
6877 |
]. |
|
3892 | 6878 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
6879 |
||
6880 |
ns := Dialog |
|
4414 | 6881 |
request:'During fileIn, new classes are created in nameSpace:' |
6882 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
6883 |
list:listOfKnownNameSpaces. |
|
3892 | 6884 |
ns isEmptyOrNil ifTrue:[^ self]. |
6885 |
||
6886 |
LastEnforcedNameSpace := ns. |
|
6887 |
ns := NameSpace name:ns. |
|
6888 |
||
6889 |
Class nameSpaceQuerySignal |
|
4414 | 6890 |
answer:ns |
6891 |
do:[ |
|
6892 |
self fileFileInLazy:false |
|
6893 |
] |
|
3892 | 6894 |
! |
6895 |
||
6896 |
fileFindAllDuplicates |
|
6897 |
"scan directory and all subdirs for duplicate files" |
|
6898 |
||
6899 |
|fileNames dir infoDir filesBySize |
|
6900 |
result info dirPrefix myName stream textBox maxLength directories| |
|
6901 |
||
6902 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6903 |
self withActivityIndicationDo:[ |
4414 | 6904 |
result := Dictionary new. |
6905 |
myName := self class name asString. |
|
6906 |
directories := self currentSelectedDirectories. |
|
6907 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 6908 |
|
4414 | 6909 |
dir := directories first. |
3892 | 6910 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6911 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6912 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6913 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 6914 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
6915 |
with:ex pathName |
|
6916 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6917 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6918 |
]. |
4765 | 6919 |
fileNames := fileNames |
6920 |
collect:[:fn | dir construct:fn] |
|
6921 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 6922 |
|
6923 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 6924 |
infoDir := Dictionary new. |
6925 |
fileNames do:[:fn | |
|
6926 |
infoDir at:fn put:(fn fileSize) |
|
6927 |
]. |
|
6928 |
||
14497 | 6929 |
"/ for each, get the file's size. |
4414 | 6930 |
"/ in a first pass, look for files of the same size and |
6931 |
"/ compare them ... |
|
3892 | 6932 |
|
6933 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 6934 |
filesBySize := Dictionary new. |
6935 |
infoDir keysAndValuesDo:[:fn :sz | |
|
6936 |
|entry| |
|
6937 |
||
6938 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
6939 |
entry add:fn. |
|
6940 |
]. |
|
6941 |
||
6942 |
"/ any of same size ? |
|
3892 | 6943 |
|
6944 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 6945 |
filesBySize do:[:entry | |
6946 |
|files| |
|
6947 |
||
6948 |
entry size > 1 ifTrue:[ |
|
6949 |
files := entry asArray. |
|
6950 |
1 to:files size-1 do:[:idx1 | |
|
6951 |
idx1+1 to:files size do:[:idx2 | |
|
6952 |
|fn1 fn2| |
|
6953 |
||
6954 |
fn1 := files at:idx1. |
|
6955 |
fn2 := files at:idx2. |
|
3892 | 6956 |
|
6957 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 6958 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
6959 |
"/ compare the files |
|
6960 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 6961 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 6962 |
result at:fn1 put:fn2. |
6963 |
] |
|
6964 |
] |
|
6965 |
] |
|
6966 |
] |
|
6967 |
] |
|
6968 |
]. |
|
3892 | 6969 |
|
6970 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 6971 |
dirPrefix := dir pathName. |
6972 |
result := result associations. |
|
6973 |
result := result collect:[:assoc | |
|
6974 |
|f1 f2| |
|
6975 |
||
6976 |
f1 := assoc key name. |
|
6977 |
f2 := assoc value name. |
|
6978 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
6979 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
6980 |
]. |
|
6981 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
6982 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
6983 |
]. |
|
6984 |
f1 < f2 ifTrue:[ |
|
6985 |
f2 -> f1 |
|
6986 |
] ifFalse:[ |
|
6987 |
f1 -> f2 |
|
6988 |
] |
|
6989 |
]. |
|
6990 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
6991 |
||
6992 |
info := OrderedCollection new. |
|
6993 |
result do:[:assoc | |
|
6994 |
info add:(assoc key , ' same as ' , assoc value) |
|
6995 |
]. |
|
6996 |
info isEmpty ifTrue:[ |
|
11889 | 6997 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 6998 |
^ self. |
4414 | 6999 |
]. |
3892 | 7000 |
]. |
7001 |
||
15589 | 7002 |
stream := CharacterWriteStream new. |
11688 | 7003 |
stream nextPutAllLines:info. |
5542 | 7004 |
|
3892 | 7005 |
textBox := TextBox new. |
7006 |
textBox initialText:(stream contents). |
|
5542 | 7007 |
stream close. |
11889 | 7008 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7009 |
textBox readOnly:true. |
7010 |
textBox noCancel. |
|
11889 | 7011 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7012 |
maxLength := 10. |
7013 |
info do:[: el | |
|
4414 | 7014 |
maxLength := maxLength max:(el size). |
3892 | 7015 |
]. |
7016 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7017 |
textBox maxExtent:Screen current extent. |
7018 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7019 |
|
11688 | 7020 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7021 |
! |
7022 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7023 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7024 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7025 |
|
10306 | 7026 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7027 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7028 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7029 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7030 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7031 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7032 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7033 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7034 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7035 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7036 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7037 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7038 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7039 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7040 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7041 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7042 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7043 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7044 |
eachFile isDirectory ifFalse:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7045 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7046 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7047 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7048 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7049 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7050 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7051 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7052 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7053 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7054 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7055 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7056 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7057 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7058 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7059 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7060 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7061 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7062 |
|
15589 | 7063 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7064 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7065 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7066 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7067 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7068 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7069 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7070 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7071 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7072 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7073 |
]. |
10306 | 7074 |
stream nextPutLine:'Files without duplicates:'. |
7075 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7076 |
do:[:origFile | |
|
7077 |
|sameFiles| |
|
7078 |
||
7079 |
sameFiles := samePerFile at:origFile. |
|
7080 |
sameFiles isEmpty ifTrue:[ |
|
7081 |
stream nextPutLine:origFile baseName. |
|
7082 |
]. |
|
7083 |
]. |
|
7084 |
||
7085 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7086 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7087 |
LastMustMatchPattern := mustHaveMatches. |
|
7088 |
||
7089 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7090 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7091 |
do:[:origFile | |
|
7092 |
|sameFiles| |
|
7093 |
||
7094 |
sameFiles := samePerFile at:origFile. |
|
7095 |
sameFiles notEmpty ifTrue:[ |
|
7096 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7097 |
stream nextPutLine:origFile baseName. |
|
7098 |
] |
|
7099 |
]. |
|
7100 |
]. |
|
7101 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7102 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7103 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7104 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7105 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7106 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7107 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7108 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7109 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7110 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7111 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7112 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7113 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7114 |
|
3892 | 7115 |
fileFindDuplicates |
7116 |
"scan directory for duplicate files" |
|
7117 |
||
8510 | 7118 |
|infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
7119 |
||
7120 |
directories := self currentSelectedDirectories. |
|
3892 | 7121 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7122 |
self withActivityIndicationDo:[ |
4355 | 7123 |
result := Dictionary new. |
7124 |
||
7125 |
directories := self currentSelectedDirectories. |
|
7126 |
directories isEmpty ifTrue:[^ self]. |
|
7127 |
||
8510 | 7128 |
allFiles := self allFilesInSelectedDirectoriesForWhich:[:f | true]. |
4355 | 7129 |
|
7130 |
infoDir := Dictionary new. |
|
7131 |
allFiles do:[:fn | |
|
7132 |
infoDir at:fn put:(fn info) |
|
7133 |
]. |
|
7134 |
||
14497 | 7135 |
"/ for each, get the file's size. |
4355 | 7136 |
"/ in a first pass, look for files of the same size and |
7137 |
"/ compare them ... |
|
7138 |
||
7139 |
filesBySize := Dictionary new. |
|
7140 |
infoDir keysAndValuesDo:[:fn :info | |
|
7141 |
|sz entry| |
|
7142 |
||
7143 |
sz := info size. |
|
7144 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7145 |
entry add:fn. |
|
7146 |
]. |
|
7147 |
||
7148 |
"/ any of same size ? |
|
7149 |
||
7150 |
filesBySize do:[:entry | |
|
7151 |
|files| |
|
7152 |
||
7153 |
entry size > 1 ifTrue:[ |
|
7154 |
files := entry asArray. |
|
7155 |
1 to:files size-1 do:[:idx1 | |
|
7156 |
idx1+1 to:files size do:[:idx2 | |
|
7157 |
|fn1 fn2| |
|
7158 |
||
7159 |
fn1 := files at:idx1. |
|
7160 |
fn2 := files at:idx2. |
|
7161 |
||
7162 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
7163 |
"/ compare the files |
|
7164 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7165 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 7166 |
result at:fn1 put:fn2. |
7167 |
] |
|
7168 |
] |
|
7169 |
] |
|
7170 |
] |
|
7171 |
] |
|
7172 |
]. |
|
7173 |
||
7174 |
result := result associations. |
|
7175 |
result := result collect:[:assoc | |
|
7176 |
|f1 f2| |
|
7177 |
||
7178 |
f1 := assoc key asString. |
|
7179 |
f2 := assoc value asString. |
|
7180 |
f1 < f2 ifTrue:[ |
|
7181 |
f2 -> f1 |
|
7182 |
] ifFalse:[ |
|
7183 |
f1 -> f2 |
|
7184 |
] |
|
7185 |
]. |
|
5789 | 7186 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
7187 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 7188 |
|
7189 |
info := OrderedCollection new. |
|
7190 |
size := self getBestDirectory asString size. |
|
7191 |
result do:[:assoc | |
|
7192 |
|fn1 fn2| |
|
7193 |
||
7194 |
fn1 := assoc key. |
|
7195 |
fn2 := assoc value. |
|
7196 |
size > 1 ifTrue:[ |
|
7197 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
7198 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
7199 |
]. |
|
7200 |
(fn1 includes:Character space) ifTrue:[ |
|
7201 |
fn1 := '"' , fn1 , '"' |
|
7202 |
]. |
|
7203 |
(fn2 includes:Character space) ifTrue:[ |
|
7204 |
fn2 := '"' , fn2 , '"' |
|
7205 |
]. |
|
7206 |
info add:(fn1 , ' same as ' , fn2) |
|
7207 |
]. |
|
7208 |
info isEmpty ifTrue:[ |
|
5543 | 7209 |
Dialog information:'No duplicate files found.'. |
7210 |
^ self. |
|
4355 | 7211 |
]. |
3892 | 7212 |
]. |
15589 | 7213 |
stream := CharacterWriteStream new. |
11688 | 7214 |
stream nextPutAllLines:info. |
7215 |
||
15589 | 7216 |
titleStream := CharacterWriteStream with:'File duplicates in directory'. |
3892 | 7217 |
directories size == 1 ifTrue:[ |
12602 | 7218 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7219 |
] ifFalse:[ |
4535 | 7220 |
titleStream nextPutLine:'ies: '. |
4355 | 7221 |
directories do:[:dir| |
7222 |
size > 1 ifTrue:[ |
|
7223 |
titleStream nextPutAll:'..'. |
|
4535 | 7224 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 7225 |
] ifFalse:[ |
4535 | 7226 |
titleStream nextPutLine:(dir asString). |
4355 | 7227 |
]. |
7228 |
] |
|
3892 | 7229 |
]. |
5543 | 7230 |
|
3892 | 7231 |
textBox := TextBox new. |
7232 |
textBox initialText:(stream contents). |
|
7233 |
textBox title:(titleStream contents). |
|
7234 |
textBox readOnly:true. |
|
7235 |
textBox noCancel. |
|
14715 | 7236 |
stream := WriteStream on:''. |
7237 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7238 |
directories do:[ :aDirectory | |
4355 | 7239 |
stream nextPutAll:aDirectory baseName. |
7240 |
stream space. |
|
4050 | 7241 |
]. |
4170 | 7242 |
textBox label:stream contents. |
3892 | 7243 |
maxLength := 10. |
7244 |
info do:[: el | |
|
4355 | 7245 |
maxLength := maxLength max:(el size). |
3892 | 7246 |
]. |
5092 | 7247 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7248 |
textBox maxExtent:Screen current extent. |
|
4355 | 7249 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7250 |
|
11688 | 7251 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7252 |
! |
7253 |
||
7254 |
fileFindFile |
|
5961 | 7255 |
|filename| |
7256 |
||
7257 |
filename := self firstSelectedFileName. |
|
7258 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7259 |
filename := Filename homeDirectory. |
3892 | 7260 |
]. |
4101 | 7261 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7262 |
! |
7263 |
||
8510 | 7264 |
fileFindSimilarImages |
7265 |
"scan directory for similar image files" |
|
7266 |
||
8512 | 7267 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7268 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7269 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7270 |
self withWaitCursorDo:[ |
8510 | 7271 |
self withActivityIndicationDo:[ |
7272 |
result := Dictionary new. |
|
7273 |
||
7274 |
directories := self currentSelectedDirectories. |
|
7275 |
directories isEmpty ifTrue:[^ self]. |
|
7276 |
||
13714 | 7277 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7278 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7279 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7280 |
||
8510 | 7281 |
"/ for each, get the color histogram |
7282 |
histogramsV := Dictionary new. |
|
7283 |
histogramsH := Dictionary new. |
|
7284 |
imageFiles do:[:fn | |
|
7285 |
|hist image| |
|
7286 |
||
7287 |
image := Image fromFile:fn. |
|
7288 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7289 |
hist := ImageColorHistogram new forImage:image. |
|
7290 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7291 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7292 |
]. |
|
7293 |
||
7294 |
similarH := Dictionary new. |
|
7295 |
similarV := Dictionary new. |
|
7296 |
similar := Dictionary new. |
|
7297 |
||
8512 | 7298 |
(self firstSelectedFile notNil |
7299 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7300 |
ifFalse:[ imageFiles ]) |
|
7301 |
do:[:eachFile1 | |
|
8510 | 7302 |
|setOfSimilar distancesV distancesH| |
7303 |
||
7304 |
distancesV := OrderedCollection new. |
|
7305 |
distancesH := OrderedCollection new. |
|
7306 |
setOfSimilar := OrderedCollection new. |
|
7307 |
||
7308 |
imageFiles do:[:eachFile2 | |
|
7309 |
|v1 v2 dV dH| |
|
7310 |
||
7311 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7312 |
v1 := histogramsV at:eachFile1. |
|
7313 |
v2 := histogramsV at:eachFile2. |
|
7314 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7315 |
distancesV add:(eachFile2 -> dV). |
|
7316 |
v1 := histogramsH at:eachFile1. |
|
7317 |
v2 := histogramsH at:eachFile2. |
|
7318 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7319 |
distancesH add:(eachFile2 -> dH). |
|
7320 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7321 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7322 |
]. |
7323 |
] |
|
7324 |
]. |
|
7325 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7326 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7327 |
similarV at:eachFile1 put:distancesV. |
|
7328 |
similarH at:eachFile1 put:distancesH. |
|
7329 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7330 |
]. |
|
7331 |
||
7332 |
similar isEmpty ifTrue:[ |
|
7333 |
Dialog information:'No similarities found.'. |
|
7334 |
^ self. |
|
7335 |
]. |
|
7336 |
]. |
|
7337 |
||
15589 | 7338 |
stream := CharacterWriteStream new. |
8512 | 7339 |
alreadyPrinted := Set new. |
7340 |
||
7341 |
imageFiles do:[:eachFile | |
|
7342 |
|eachSet| |
|
7343 |
||
7344 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7345 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7346 |
eachSet notNil ifTrue:[ |
|
7347 |
stream nextPutLine:eachFile pathName. |
|
7348 |
eachSet do:[:info | |
|
7349 |
|fn2 dist| |
|
7350 |
||
7351 |
fn2 := info key. |
|
7352 |
dist := info value. |
|
7353 |
stream nextPutAll:' '. |
|
7354 |
stream nextPutAll:fn2 pathName. |
|
7355 |
stream nextPutLine:' (',dist printString,')'. |
|
7356 |
alreadyPrinted add:fn2. |
|
7357 |
]. |
|
7358 |
stream cr. |
|
7359 |
]. |
|
8510 | 7360 |
]. |
7361 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7362 |
]. |
8510 | 7363 |
|
7364 |
textBox := TextBox new. |
|
7365 |
textBox initialText:(stream contents). |
|
7366 |
textBox title:'File similarities:'. |
|
7367 |
textBox readOnly:true. |
|
7368 |
textBox noCancel. |
|
7369 |
||
7370 |
textBox label:'File similarities'. |
|
7371 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7372 |
textBox maxExtent:Screen current extent. |
|
7373 |
textBox openModeless. "/ showAtPointer. |
|
7374 |
||
7375 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7376 |
! |
|
7377 |
||
4618 | 7378 |
fileHexDump |
7379 |
||
7380 |
| file item| |
|
7381 |
||
7382 |
file := self firstSelectedFile. |
|
7383 |
file notNil ifTrue:[ |
|
7384 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7385 |
self |
7386 |
applicationNamed:#FileApplicationNoteBook |
|
7387 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7388 |
]. |
7389 |
! |
|
7390 |
||
7324 | 7391 |
fileIn:aFilename |
7392 |
"fileIn a file" |
|
7393 |
||
7394 |
self fileIn:aFilename lazy:false |
|
7395 |
||
7396 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7397 |
! |
|
7398 |
||
7399 |
fileIn:aFilename lazy:lazy |
|
7400 |
"fileIn a file" |
|
7401 |
||
7402 |
self withActivityIndicationDo:[ |
|
7403 |
self notify:('File in:', aFilename asFilename baseName). |
|
7404 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7405 |
self notify:nil. |
|
7406 |
] |
|
7407 |
||
7408 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7409 |
! |
|
7410 |
||
4930 | 7411 |
filterSelectedFiles:whichFilter |
7412 |
|selectedFiles numFiles msg filterBlock| |
|
7413 |
||
7560 | 7414 |
selectedFiles := self currentSelectedObjects. |
4930 | 7415 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7416 |
||
7417 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7418 |
numFiles > 1 ifTrue:[ |
|
7419 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7420 |
]. |
|
7421 |
||
7422 |
(Dialog |
|
6352 | 7423 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7424 |
initialAnswer:false |
7425 |
) ifFalse:[ |
|
7426 |
^ self |
|
7427 |
]. |
|
7428 |
||
7429 |
whichFilter == #rot13 ifTrue:[ |
|
7430 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7431 |
]. |
|
7432 |
"/ add more here... |
|
7433 |
||
7434 |
filterBlock isNil ifTrue:[ |
|
7435 |
self information:'No such filter: ' , whichFilter. |
|
7436 |
^ self. |
|
7437 |
]. |
|
7438 |
||
7439 |
selectedFiles do:[:fileName | |
|
7440 |
|s| |
|
7441 |
||
7442 |
self notify:('Processing:', fileName baseName). |
|
7443 |
fileName isDirectory ifFalse:[ |
|
7444 |
[ |
|
7445 |
|inFile outFile in out| |
|
7446 |
||
7447 |
inFile := fileName asFilename. |
|
7448 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7449 |
||
7450 |
[ |
|
7451 |
|charIn charOut| |
|
7452 |
||
7453 |
in := inFile readStream. |
|
7454 |
out := outFile writeStream. |
|
7455 |
[in atEnd] whileFalse:[ |
|
7456 |
charIn := in next. |
|
7457 |
charOut := filterBlock value:charIn. |
|
7458 |
out nextPut:charOut. |
|
7459 |
]. |
|
13683 | 7460 |
out close. out:= nil. |
4930 | 7461 |
outFile renameTo:inFile. |
7462 |
] ensure:[ |
|
7463 |
out notNil ifTrue:[ out close ]. |
|
7464 |
in notNil ifTrue:[ in close ]. |
|
7465 |
outFile delete. |
|
7466 |
] |
|
7467 |
] on:FileStream openErrorSignal do:[:ex| |
|
7468 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7469 |
]. |
|
7470 |
] |
|
7471 |
]. |
|
6190 | 7472 |
self notify:nil. |
7560 | 7473 |
|
7474 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7475 |
! |
7476 |
||
9784 | 7477 |
forEachParsedXmlFileDo:aBlock |
7478 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7479 |
||
7480 |
self withActivityIndicationDo:[ |
|
7481 |
| selectedFiles xmlDocument | |
|
7482 |
||
7483 |
selectedFiles:= self currentSelectedFiles. |
|
7484 |
selectedFiles do:[:fileName | |
|
7485 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7486 |
Dialog |
7487 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7488 |
title:'XML Error'. |
|
9784 | 7489 |
^ self. |
7490 |
] do:[ |
|
7491 |
|s d magic encoder document| |
|
7492 |
||
7493 |
s := fileName asFilename readStream. |
|
14012 | 7494 |
[ |
7495 |
s binary. |
|
7496 |
magic := (s next:2). |
|
7497 |
magic = #[254 255] ifTrue:[ |
|
7498 |
"/ UTF16BE |
|
7499 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7500 |
] ifFalse:[ |
|
7501 |
magic = #[255 254] ifTrue:[ |
|
7502 |
"/ UTF16LE |
|
7503 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7504 |
]. |
|
7505 |
]. |
|
7506 |
] ensure:[ |
|
7507 |
s close. |
|
7508 |
]. |
|
9784 | 7509 |
document notNil ifTrue:[ |
7510 |
xmlDocument := XML::XMLParser |
|
7511 |
processDocumentString:document |
|
7512 |
beforeScanDo:[:parse| parse validate:false]. |
|
7513 |
] ifFalse:[ |
|
7514 |
xmlDocument := XML::XMLParser |
|
7515 |
processDocumentInFilename:fileName |
|
7516 |
beforeScanDo:[:parse| parse validate:false]. |
|
7517 |
] |
|
7518 |
]. |
|
7519 |
aBlock value:xmlDocument. |
|
7520 |
]. |
|
7521 |
] |
|
7522 |
||
7523 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7524 |
! |
|
7525 |
||
8832 | 7526 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7527 |
|numItems path files| |
|
7528 |
||
7529 |
files := self currentSelectedFiles. |
|
7530 |
||
7531 |
(numItems := files size) > 2 ifTrue:[ |
|
7532 |
(self |
|
7533 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7534 |
with:numItems)) ifFalse:[^ self]. |
|
7535 |
]. |
|
7536 |
||
7537 |
self withActivityIndicationDo:[ |
|
7538 |
files do:[:fileName | |
|
7539 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7540 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7541 |
path := fileName name. |
8832 | 7542 |
] ifFalse:[ |
7543 |
path := fileName pathName. |
|
7544 |
]. |
|
7545 |
aBlock value:path |
|
7546 |
] |
|
7547 |
]. |
|
7548 |
]. |
|
17239 | 7549 |
|
7550 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7551 |
! |
7552 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7553 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7554 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7555 |
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
|
7556 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7557 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7558 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7559 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7560 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7561 |
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
|
7562 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7563 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7564 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7565 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7566 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7567 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7568 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7569 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7570 |
]. |
13677 | 7571 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7572 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7573 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7574 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7575 |
|
15211 | 7576 |
generatePatchInstallerForSelectedFiles |
7577 |
"generate an expecco patch, which installs the selected file(s). |
|
7578 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7579 |
||
7580 |
|dialog targetDirHolder targetDir |
|
7581 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7582 |
||
7583 |
targetDirHolder := '.' asValue. |
|
7584 |
generateSignedPatchHolder := true asValue. |
|
7585 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7586 |
||
7587 |
dialog := Dialog new. |
|
7588 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7589 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
7590 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
7591 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
7592 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
7593 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
7594 |
dialog addAbortAndOkButtons. |
|
7595 |
dialog open. |
|
7596 |
||
7597 |
dialog accepted ifFalse:[^ self]. |
|
7598 |
||
7599 |
targetDir := targetDirHolder value asFilename. |
|
7600 |
patchFileName := patchFileNameHolder value asFilename. |
|
7601 |
||
7602 |
self withActivityIndicationDo:[ |
|
7603 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
7604 |
||
7605 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
7606 |
outStream := patchFileName writeStream. |
|
7607 |
outStream nextPutAll:' |
|
7608 |
|patchStream zipArchive| |
|
7609 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
7610 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
7611 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
7612 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
7613 |
patchStream setToEnd. "/ to force fileIn to finish |
|
7614 |
!! |
|
7615 |
||
7616 |
!! !! |
|
7617 |
||
7618 |
'. |
|
7619 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
7620 |
||
7621 |
self currentSelectedFiles do:[:fn | |
|
7622 |
|inStream signatureFilename| |
|
7623 |
||
7624 |
inStream := fn asFilename readStream. |
|
7625 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
7626 |
inStream close. |
|
7627 |
]. |
|
7628 |
||
16975 | 7629 |
zipArchive close. |
15211 | 7630 |
|
7631 |
generateSignedPatchHolder value ifTrue:[ |
|
7632 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
7633 |
||
7634 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
7635 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
7636 |
signatureFilename contents:pkcs7SignedData. |
|
7637 |
]. |
|
7638 |
self notify:nil. |
|
7639 |
] |
|
7640 |
! |
|
13783 | 7641 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7642 |
generateSignaturesForSelectedFiles |
13783 | 7643 |
"generate signed pkcs7 files from the contents of the selected files. |
7644 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7645 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7646 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7647 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7648 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7649 |
|
8646 | 7650 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7651 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7652 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 7653 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7654 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7655 |
]. |
13677 | 7656 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7657 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7658 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7659 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7660 |
|
9784 | 7661 |
inspectXmlFile |
7662 |
"Show an XML file - either in an XMLInspector or fall back to |
|
7663 |
a plain inspector on the XML tree" |
|
7664 |
||
7665 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
7666 |
XML::XMLInspector notNil ifTrue:[ |
|
7667 |
XML::XMLInspector openOn:xmlDocument. |
|
7668 |
] ifFalse:[ |
|
7669 |
"fall back..." |
|
7670 |
xmlDocument inspect. |
|
7671 |
] |
|
7672 |
]. |
|
7673 |
||
7674 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
7675 |
! |
|
7676 |
||
3892 | 7677 |
installAllAsAutoloaded |
7678 |
"install all classes found here as autoloaded classes" |
|
7679 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7680 |
self installAllAsAutoloadedRecursive:false |
3892 | 7681 |
! |
7682 |
||
6521 | 7683 |
installAllAsAutoloadedRecursive |
7684 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
7685 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7686 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7687 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7688 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7689 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7690 |
"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
|
7691 |
|
6521 | 7692 |
[ |
15507 | 7693 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
7694 |
|installAction| |
|
7695 |
||
7696 |
installAction := |
|
7697 |
[:fn | |
|
7698 |
(fn suffix = 'st') ifTrue:[ |
|
7699 |
self notify:('Install as autoloaded: ', fn baseName). |
|
7700 |
self installAsAutoloaded:fn. |
|
7701 |
] |
|
7702 |
]. |
|
7703 |
||
7704 |
self withActivityIndicationDo:[ |
|
7705 |
self currentSelectedDirectories do:[:dir| |
|
7706 |
aBoolean ifTrue:[ |
|
7707 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
7708 |
] ifFalse:[ |
|
7709 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 7710 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7711 |
]. |
15507 | 7712 |
self notify:nil. |
7713 |
]. |
|
7714 |
] |
|
6521 | 7715 |
] fork. |
7716 |
! |
|
7717 |
||
3892 | 7718 |
installAsAutoloaded:aFilename |
7719 |
"install aFilename as autoloaded class" |
|
7720 |
||
13292 | 7721 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
7722 |
||
7723 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 7724 |
! |
7725 |
||
15211 | 7726 |
joinSelectedFiles |
7727 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
7728 |
||
7729 |
selectedFiles := self currentSelectedObjects. |
|
7730 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
7731 |
||
7732 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
7733 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
7734 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
7735 |
outFile := selectedFiles first directory construct:outFileName. |
|
7736 |
||
7737 |
outStream := outFile writeStream. |
|
7738 |
||
7739 |
selectedFiles do:[:fileName | |
|
7740 |
|inStream| |
|
7741 |
||
7742 |
self notify:('Adding:', fileName baseName). |
|
7743 |
inStream := fileName readStream. |
|
7744 |
inStream copyToEndInto:outStream. |
|
7745 |
inStream close. |
|
7746 |
]. |
|
7747 |
outStream close. |
|
7748 |
self notify:nil. |
|
7749 |
||
7750 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
7751 |
! |
|
4558 | 7752 |
|
6292 | 7753 |
loadImageThenDo:aBlock |
3892 | 7754 |
|img path files| |
7755 |
||
3982 | 7756 |
files := self currentSelectedFiles. |
3892 | 7757 |
files isEmpty ifTrue:[ ^ self]. |
7758 |
files do:[:fileName | |
|
4414 | 7759 |
path := fileName. |
7760 |
path isDirectory ifFalse:[ |
|
7761 |
img := Image fromFile:(path pathName). |
|
7762 |
img notNil ifTrue:[ |
|
6292 | 7763 |
aBlock value:img |
4414 | 7764 |
] ifFalse:[ |
15346 | 7765 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 7766 |
] |
7767 |
] |
|
3892 | 7768 |
]. |
7769 |
! |
|
7770 |
||
13089 | 7771 |
loadSignatureSupport |
7772 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 7773 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 7774 |
]. |
7775 |
! |
|
7776 |
||
3892 | 7777 |
openASN1Browser |
7778 |
||
7779 |
self openTool:OSI::ASN1Browser |
|
7780 |
! |
|
7781 |
||
7782 |
openAppletViewer |
|
7783 |
|numItems files| |
|
7784 |
||
3982 | 7785 |
files := self currentSelectedFiles. |
3892 | 7786 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 7787 |
(self |
7788 |
confirm:(resources string:'open for each of the %1 items ?' |
|
7789 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 7790 |
]. |
7791 |
||
7792 |
Java startupJavaSystem. |
|
7793 |
"/ Java markAllClassesUninitialized. |
|
7794 |
"/ Java initAllStaticFields. |
|
7795 |
"/ Java initAllClasses. |
|
7796 |
||
7797 |
files do:[:fileName | |
|
4414 | 7798 |
|p path| |
7799 |
||
7800 |
path := fileName. |
|
7801 |
path isDirectory ifFalse:[ |
|
7802 |
p := Java |
|
7803 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
7804 |
argumentString:path pathName. |
|
7805 |
p resume. |
|
7806 |
] |
|
3892 | 7807 |
]. |
7808 |
! |
|
7809 |
||
7810 |
openCBrowser |
|
6031 | 7811 |
|dir files| |
5880 | 7812 |
|
7813 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7814 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7815 |
self withActivityIndicationDo:[ |
7560 | 7816 |
files := self currentSelectedObjects. |
6031 | 7817 |
files notEmptyOrNil ifTrue:[ |
7818 |
CBrowser::Browser openOn:files first. |
|
7819 |
] ifFalse:[ |
|
7820 |
CBrowser::Browser openIn:dir. |
|
7821 |
] |
|
3892 | 7822 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7823 |
|
7560 | 7824 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 7825 |
! |
7826 |
||
4230 | 7827 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7828 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7829 |
|
4230 | 7830 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7831 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 7832 |
with:#openOnFile: |
7833 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7834 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7835 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 7836 |
! |
7837 |
||
3892 | 7838 |
openChangesBrowser |
7839 |
"open a change browser on the selected file(s)" |
|
7840 |
||
7841 |
self openTool:(UserPreferences current changesBrowserClass) |
|
7842 |
! |
|
7843 |
||
7844 |
openDiffView |
|
15215 | 7845 |
"open a diff-view on the two selected files" |
7846 |
||
7847 |
|name1 name2 files title |
|
7848 |
defaultName defaultDir| |
|
6460 | 7849 |
|
7850 |
files := self currentSelectedObjects. |
|
3892 | 7851 |
files isEmpty ifTrue:[ |
6460 | 7852 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 7853 |
^ self. |
3892 | 7854 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7855 |
|
3892 | 7856 |
(files size == 2) ifTrue:[ |
4414 | 7857 |
name1 := files last. |
7858 |
name2 := files first. |
|
3892 | 7859 |
] ifFalse:[ |
4414 | 7860 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 7861 |
LastFileDiffFile exists ifTrue:[ |
7862 |
name1 := LastFileDiffFile. |
|
7863 |
]. |
|
7864 |
"/ | directory | |
|
7865 |
"/ directory := self currentDirectory. |
|
7866 |
"/ directory notNil ifTrue:[ |
|
7867 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
7868 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
7869 |
"/ name1 := lastFile. |
|
7870 |
"/ ] |
|
7871 |
"/ ] |
|
4414 | 7872 |
]. |
7873 |
name2 := files first. |
|
6460 | 7874 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 7875 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 7876 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 7877 |
name1 := DialogBox |
7878 |
requestFileName:title |
|
7879 |
default:defaultName |
|
6460 | 7880 |
ok:(resources string:'OK') |
7881 |
abort:(resources string:'Compare against File List') |
|
4414 | 7882 |
pattern:'*' |
11052 | 7883 |
fromDirectory:defaultDir. |
3892 | 7884 |
]. |
15215 | 7885 |
self openDiffViewOn:name1 and:name2 |
7886 |
||
7887 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
7888 |
! |
|
7889 |
||
7890 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
7891 |
"open a diff-view on two files" |
|
7892 |
||
7893 |
|file1 file2 text1 text2 d err nm l1 sameContents msg| |
|
7894 |
||
7895 |
file1 := fileArg1. |
|
7896 |
file2 := fileArg2. |
|
3892 | 7897 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7898 |
self withWaitCursorDo:[ |
15215 | 7899 |
(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
|
7900 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 7901 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 7902 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7903 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7904 |
] ifFalse:[ |
15215 | 7905 |
file1 := file1 asFilename. |
7906 |
LastFileDiffFile := file1. |
|
7907 |
file1 isReadable ifFalse:[ |
|
7908 |
nm := file1. |
|
7909 |
file1 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 |
]. |
15215 | 7915 |
l1 := file1 pathName |
4414 | 7916 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7917 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7918 |
err isNil ifTrue:[ |
15215 | 7919 |
file2 isReadable ifFalse:[ |
7920 |
nm := file2. |
|
7921 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7922 |
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
|
7923 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7924 |
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
|
7925 |
]. |
4414 | 7926 |
]. |
7927 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7928 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7929 |
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
|
7930 |
^ self |
6176 | 7931 |
]. |
7932 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7933 |
self withActivityIndicationDo:[ |
15215 | 7934 |
((file1 notNil and:[file1 fileSize > (1024*1024*32)]) |
7935 |
or:[ file2 fileSize > (1024*1024*32) ]) ifTrue:[ |
|
7936 |
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
|
7937 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7938 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7939 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7940 |
during:[ |
15215 | 7941 |
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
|
7942 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7943 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7944 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7945 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7946 |
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
|
7947 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7948 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7949 |
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
|
7950 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7951 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7952 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7953 |
|
15215 | 7954 |
file1 notNil ifTrue:[ |
7955 |
file1 isDirectory ifTrue:[ |
|
7956 |
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
|
7957 |
] ifFalse:[ |
15215 | 7958 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7959 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7960 |
]. |
15215 | 7961 |
file2 isDirectory ifTrue:[ |
7962 |
text2 := file2 directoryContents asString. |
|
6460 | 7963 |
] ifFalse:[ |
15215 | 7964 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7965 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7966 |
text1 = text2 ifTrue:[ |
15215 | 7967 |
(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
|
7968 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7969 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7970 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7971 |
]. |
16911 | 7972 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7973 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7974 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7975 |
openOn:text1 label:l1 |
15215 | 7976 |
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
|
7977 |
d topView label:(resources string:'File Differences'). |
6460 | 7978 |
] |
4414 | 7979 |
] |
3892 | 7980 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7981 |
|
11494 | 7982 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
3892 | 7983 |
! |
7984 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7985 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7986 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7987 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7988 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7989 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7990 |
files := self currentSelectedObjects. |
11108 | 7991 |
files notEmpty ifTrue:[ |
7992 |
name1 := files first asFilename. |
|
7993 |
name1 asFilename isDirectory ifFalse:[ |
|
7994 |
name1 := name1 directory |
|
7995 |
]. |
|
7996 |
]. |
|
7997 |
||
7998 |
(files size == 2) ifTrue:[ |
|
7999 |
name2 := files second. |
|
8000 |
] ifFalse:[ |
|
8001 |
(files size ~= 1) ifTrue:[ |
|
8002 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8003 |
^ self. |
|
8004 |
]. |
|
8005 |
name2 := Dialog |
|
8006 |
requestDirectoryName:(resources |
|
8007 |
string:'Recursive compare "%1" with folder:' |
|
8008 |
with:name1 asFilename baseName) |
|
8009 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8010 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8011 |
LastFileDiffDirectory := name2. |
|
8012 |
]. |
|
8013 |
name2 := name2 asFilename. |
|
8014 |
||
8015 |
name2 asFilename isDirectory ifFalse:[ |
|
8016 |
name2 := name2 directory |
|
8017 |
]. |
|
8018 |
||
8019 |
self |
|
8020 |
applicationNamed:#FileApplicationNoteBook |
|
8021 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8022 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8023 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8024 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8025 |
|
3892 | 8026 |
openEditor |
8027 |
self openTool:EditTextView |
|
8028 |
! |
|
8029 |
||
4957 | 8030 |
openGV |
8031 |
self openOSCommandWithFiles:'gv' |
|
8032 |
! |
|
8033 |
||
3892 | 8034 |
openHTMLReader |
8035 |
||
8036 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8037 |
! |
|
8038 |
||
8039 |
openImageEditor |
|
6292 | 8040 |
[ |
8041 |
self loadImageThenDo:[:img | img edit] |
|
8042 |
] fork |
|
3892 | 8043 |
! |
8044 |
||
8045 |
openImageInspector |
|
6292 | 8046 |
[ |
8047 |
self loadImageThenDo:[:img | img inspect] |
|
8048 |
] fork |
|
3892 | 8049 |
! |
8050 |
||
8051 |
openImagePreview |
|
5778 | 8052 |
[ |
8053 |
self |
|
6292 | 8054 |
loadImageThenDo: |
5778 | 8055 |
[:img | |
8056 |
|i top viewer| |
|
8057 |
||
8058 |
top := StandardSystemView new. |
|
8059 |
||
8060 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8061 |
i := img. |
|
8062 |
top extent:200@200. |
|
8063 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8064 |
top openAndWait. |
|
8065 |
||
8066 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8067 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8068 |
]. |
|
8069 |
viewer image:i. |
|
8070 |
]. |
|
3892 | 8071 |
] fork |
8072 |
! |
|
8073 |
||
8074 |
openMP3Player |
|
8075 |
|file| |
|
8076 |
||
3982 | 8077 |
file := self currentSelectedFiles. |
3892 | 8078 |
(file isEmpty) ifTrue:[ |
4414 | 8079 |
^ self. |
3892 | 8080 |
]. |
8081 |
file := file first. |
|
8082 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8083 |
! |
|
8084 |
||
4957 | 8085 |
openOSCommandWithFiles:command |
8086 |
|files fileNames| |
|
8087 |
||
8088 |
files := self currentSelectedFiles. |
|
8089 |
(files isEmpty) ifTrue:[ |
|
8090 |
^ self. |
|
8091 |
]. |
|
8092 |
||
8093 |
fileNames := files collect:[:each | |
|
8094 |
'"' , each asFilename pathName , '"' |
|
8095 |
]. |
|
8096 |
||
8097 |
[ |
|
8098 |
OperatingSystem |
|
4959 | 8099 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8100 |
inDirectory:(files first asFilename directory). |
|
4957 | 8101 |
] fork |
8102 |
! |
|
8103 |
||
4820 | 8104 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8105 |
|files fileNames cmd arg| |
4820 | 8106 |
|
8107 |
files := self currentSelectedFiles. |
|
8108 |
(files isEmpty) ifTrue:[ |
|
8109 |
^ self. |
|
8110 |
]. |
|
12972 | 8111 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8112 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8113 |
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
|
8114 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8115 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8116 |
|
4820 | 8117 |
fileNames := |
8118 |
files |
|
8119 |
collect: |
|
8120 |
[:each | |
|
8121 |
'"' , each asFilename pathName , '"' |
|
8122 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8123 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8124 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8125 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8126 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8127 |
]. |
4820 | 8128 |
|
4950 | 8129 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8130 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8131 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8132 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8133 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8134 |
! |
8135 |
||
4958 | 8136 |
openRP |
8137 |
self openOSCommandWithFiles:'realplay' |
|
8138 |
! |
|
8139 |
||
8426 | 8140 |
openResourceFileEditor |
8141 |
||
8142 |
self |
|
8143 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8144 |
with: #openOnFile: |
|
8145 |
! |
|
8146 |
||
3892 | 8147 |
openSlideShow |
5880 | 8148 |
|dir| |
8149 |
||
8150 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8151 |
dir isNil ifTrue:[^ self]. |
|
8152 |
||
3892 | 8153 |
CodingExamples_GUI::SlideShow openIn:dir. |
8154 |
! |
|
8155 |
||
8156 |
openSnapshotImageBrowser |
|
4491 | 8157 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8158 |
||
3892 | 8159 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8160 |
! |
|
8161 |
||
8162 |
openTerminal |
|
5880 | 8163 |
|dir| |
8164 |
||
8165 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8166 |
|
5300 | 8167 |
TerminalApplication notNil ifTrue:[ |
8168 |
TerminalApplication openIn:dir |
|
8169 |
] ifFalse:[ |
|
8170 |
VT100TerminalView openShellIn:dir. |
|
8171 |
]. |
|
3892 | 8172 |
! |
8173 |
||
8174 |
openTool:aToolClass |
|
8175 |
"open a tool on the selected file(s)" |
|
8176 |
||
8177 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8178 |
! |
|
8179 |
||
8180 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8181 |
"open a tool on the selected file(s)" |
|
8182 |
||
8183 |
^ self |
|
4414 | 8184 |
openTool:aToolClass |
8185 |
with:#openOn: |
|
8186 |
ignoreDirectories:ignoreDirs |
|
3892 | 8187 |
! |
8188 |
||
8426 | 8189 |
openTool:aToolClass with:aSelector |
8190 |
"open a tool on the selected file(s)" |
|
8191 |
||
8192 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8193 |
! |
|
8194 |
||
3892 | 8195 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8196 |
"open a tool on the selected file(s)" |
|
8197 |
||
8832 | 8198 |
|tool| |
3892 | 8199 |
|
8200 |
aToolClass isNil ifTrue:[ |
|
4414 | 8201 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8202 |
^ nil. |
|
3892 | 8203 |
]. |
8832 | 8204 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8205 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8206 |
]. |
8207 |
^ tool |
|
8832 | 8208 |
! |
8209 |
||
8210 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8211 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8212 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8213 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8214 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8215 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8216 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8217 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8218 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8219 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8220 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8221 |
]. |
3892 | 8222 |
! |
8223 |
||
6022 | 8224 |
openWorkspace |
8225 |
self |
|
8226 |
openTool:WorkspaceApplication |
|
8227 |
with:#openOnFile: |
|
8228 |
ignoreDirectories:true |
|
8229 |
! |
|
8230 |
||
4950 | 8231 |
openXV |
4957 | 8232 |
self openOSCommandWithFiles:'xv' |
4950 | 8233 |
! |
8234 |
||
3892 | 8235 |
openZipTool |
5880 | 8236 |
|zipTool| |
3892 | 8237 |
|
8238 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8239 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8240 |
]. |
8241 |
! |
|
8242 |
||
8243 |
readAbbrevFile |
|
8244 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8245 |
||
5880 | 8246 |
|directories| |
3892 | 8247 |
|
3982 | 8248 |
directories := self currentSelectedDirectories. |
3892 | 8249 |
directories isEmpty ifTrue:[^ self]. |
8250 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8251 |
self withActivityIndicationDo:[ |
5880 | 8252 |
directories do:[:eachDir | |
8253 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8254 |
] |
|
5828 | 8255 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8256 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8257 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8258 |
! |
8259 |
||
6460 | 8260 |
readAndShowResources |
8261 |
self withActivityIndicationDo:[ |
|
8262 |
| selectedFiles| |
|
8263 |
||
8264 |
selectedFiles:= self currentSelectedFiles. |
|
8265 |
selectedFiles do:[:fileName | |
|
8266 |
resources := ResourcePack fromFile:fileName. |
|
8267 |
resources inspect. |
|
8268 |
]. |
|
8269 |
] |
|
8270 |
! |
|
8271 |
||
3892 | 8272 |
singleFileFileIn:fileName lazy:lazy |
8273 |
"fileIn the selected file(s)" |
|
8274 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8275 |
|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
|
8276 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8277 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8278 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8279 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8280 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8281 |
[ |
4345 | 8282 |
(ObjectFileLoader notNil |
5491 | 8283 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8284 |
AbortOperationRequest catch:[ |
8285 |
|p| |
|
8286 |
||
8287 |
"/ |
|
8288 |
"/ look if already loaded ... then unload first |
|
8289 |
"/ |
|
8290 |
p := fileName pathName. |
|
8291 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8292 |
(Dialog confirm:(resources |
|
8293 |
string:'%1 is already loaded; load anyway ?' |
|
8294 |
with:p)) ifFalse:[ |
|
8295 |
^ self |
|
8296 |
]. |
|
8297 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8298 |
Transcript showCR:notifyString. |
|
4523 | 8299 |
self notify:notifyString. |
4345 | 8300 |
ObjectFileLoader unloadObjectFile:p. |
8301 |
]. |
|
8302 |
||
8303 |
notifyString := 'loading ' , p , ' ...'. |
|
8304 |
Transcript showCR:notifyString. |
|
4523 | 8305 |
self notify:notifyString. |
12426 | 8306 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8307 |
notifyString := 'Error: could not load ' , p. |
|
8308 |
Transcript showCR:notifyString. |
|
8309 |
self notify:notifyString. |
|
8310 |
] ifFalse:[ |
|
8311 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8312 |
]. |
|
4345 | 8313 |
] |
8314 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8315 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8316 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8317 |
aStream := fileName readStreamOrNil. |
4345 | 8318 |
aStream notNil ifTrue:[ |
8319 |
aStream fileInBinary. |
|
8320 |
] |
|
8321 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8322 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8323 |
"/ loading a java class file |
8324 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8325 |
JavaClassReader loadFile:fileName |
4345 | 8326 |
] |
8327 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8328 |
"/ loading a sif (smalltalk interchange format) file |
|
8329 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8330 |
SmalltalkInterchangeFileManager newForFileIn |
|
8331 |
fileName: fileName pathName; |
|
8332 |
fileIn. |
|
8333 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8334 |
Parcel isNil ifTrue:[ |
|
8335 |
Dialog warn:'Parcel support not loaded.' |
|
8336 |
] ifFalse:[ |
|
8337 |
Parcel loadParcelFrom: fileName pathName |
|
8338 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8339 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8340 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8341 |
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
|
8342 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8343 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8344 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8345 |
(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
|
8346 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8347 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8348 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8349 |
] |
4345 | 8350 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8351 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8352 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8353 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8354 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8355 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8356 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8357 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8358 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8359 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8360 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8361 |
Error handle:[:ex | |
15675 | 8362 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8363 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8364 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8365 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8366 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8367 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8368 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8369 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8370 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8371 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8372 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8373 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8374 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8375 |
] |
4345 | 8376 |
] |
8377 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8378 |
]]]] |
4345 | 8379 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8380 |
] 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
|
8381 |
|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
|
8382 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8383 |
isRedef := false. |
12684 | 8384 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8385 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8386 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8387 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8388 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8389 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8390 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8391 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8392 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8393 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8394 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8395 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8396 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8397 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8398 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8399 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8400 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8401 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8402 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8403 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8404 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8405 |
sender := ex suspendedContext. |
17024 | 8406 |
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
|
8407 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8408 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8409 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8410 |
]]]. |
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 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8413 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8414 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8415 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8416 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8417 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8418 |
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
|
8419 |
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
|
8420 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8421 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8422 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8423 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8424 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8425 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8426 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8427 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8428 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8429 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8430 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8431 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8432 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8433 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8434 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8435 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8436 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8437 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8438 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8439 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8440 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8441 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8442 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8443 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8444 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8445 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8446 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8447 |
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
|
8448 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8449 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8450 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8451 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8452 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8453 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8454 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8455 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8456 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8457 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8458 |
(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
|
8459 |
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
|
8460 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8461 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8462 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8463 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8464 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8465 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8466 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8467 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8468 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8469 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8470 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8471 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8472 |
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
|
8473 |
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
|
8474 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8475 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8476 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8477 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8478 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8479 |
] |
7040 | 8480 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8481 |
"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
|
8482 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8483 |
! |
8484 |
||
4558 | 8485 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8486 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8487 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8488 |
||
8489 |
bufferSize := 32*1024. |
|
8490 |
||
8491 |
inStream := infile readStream. |
|
8492 |
||
8493 |
bytesPerSplit := kiloBytes * 1024. |
|
8494 |
||
8495 |
remaining := infile fileSize. |
|
8496 |
splitIndex := 1. |
|
8497 |
[remaining > 0] whileTrue:[ |
|
8498 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8499 |
outStream := outFile asFilename writeStream. |
|
8500 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8501 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8502 |
buffer := ByteArray new:bufferSize. |
|
8503 |
n := inStream |
|
8504 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8505 |
into:buffer |
|
8506 |
startingAt:1. |
|
8507 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8508 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8509 |
remaining := remaining - n. |
|
8510 |
]. |
|
8511 |
outStream close. |
|
8512 |
splitIndex := splitIndex + 1. |
|
8513 |
]. |
|
8514 |
inStream close. |
|
8515 |
! |
|
8516 |
||
15906 | 8517 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
8518 |
|splitIndex line |
|
8519 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
8520 |
||
8521 |
inStream := infile readStream. |
|
8522 |
||
8523 |
splitIndex := 1. |
|
8524 |
[inStream atEnd] whileFalse:[ |
|
8525 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8526 |
outStream := outFile asFilename writeStream. |
|
8527 |
remainingLinesInThisOutfile := numberOfLines. |
|
8528 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
8529 |
line := inStream nextLine. |
|
15910 | 8530 |
outStream nextPutLine:line. |
15906 | 8531 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
8532 |
]. |
|
8533 |
outStream close. |
|
8534 |
splitIndex := splitIndex + 1. |
|
8535 |
]. |
|
8536 |
inStream close. |
|
8537 |
! |
|
8538 |
||
4558 | 8539 |
splitSelectedFiles |
6264 | 8540 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 8541 |
|
12871 | 8542 |
selectedFiles := self currentSelectedFiles. |
4558 | 8543 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8544 |
||
6265 | 8545 |
msg := (numFiles > 1) |
8546 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
8547 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 8548 |
|
6352 | 8549 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 8550 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
8551 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 8552 |
kiloBytes isNil ifTrue:[^ self]. |
8553 |
||
8554 |
selectedFiles do:[:fileName | |
|
8555 |
self notify:('Splitting:', fileName baseName). |
|
8556 |
fileName isDirectory ifFalse:[ |
|
8557 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
8558 |
] |
|
8559 |
]. |
|
6190 | 8560 |
self notify:nil. |
6265 | 8561 |
|
7560 | 8562 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 8563 |
! |
8564 |
||
15906 | 8565 |
splitSelectedFilesByLines |
8566 |
|selectedFiles numFiles msg numLinesString numLines| |
|
8567 |
||
8568 |
selectedFiles := self currentSelectedFiles. |
|
8569 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8570 |
||
8571 |
msg := (numFiles > 1) |
|
8572 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
8573 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
8574 |
||
8575 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8576 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
8577 |
||
8578 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
8579 |
numLines isNil ifTrue:[^ self]. |
|
8580 |
||
8581 |
selectedFiles do:[:fileName | |
|
8582 |
self notify:('Splitting:', fileName baseName). |
|
8583 |
fileName isDirectory ifFalse:[ |
|
8584 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
|
8585 |
] |
|
8586 |
]. |
|
8587 |
self notify:nil. |
|
8588 |
! |
|
8589 |
||
15211 | 8590 |
truncateSelectedFilesToZeroSize |
8591 |
|selectedFiles numFiles msg| |
|
8592 |
||
8593 |
selectedFiles := self currentSelectedObjects. |
|
8594 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8595 |
||
8596 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
8597 |
numFiles > 1 ifTrue:[ |
|
8598 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
8599 |
]. |
|
8600 |
||
8601 |
(Dialog |
|
8602 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
8603 |
initialAnswer:false |
|
8604 |
) ifFalse:[ |
|
8605 |
^ self |
|
8606 |
]. |
|
8607 |
||
8608 |
selectedFiles do:[:fileName | |
|
8609 |
|s| |
|
8610 |
||
8611 |
self notify:('Truncating:', fileName baseName). |
|
8612 |
fileName isDirectory ifFalse:[ |
|
8613 |
[ |
|
8614 |
s := fileName writeStream. |
|
8615 |
s close. |
|
8616 |
] on:FileStream openErrorSignal do:[:ex| |
|
8617 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
8618 |
]. |
|
8619 |
] |
|
8620 |
]. |
|
8621 |
self notify:nil. |
|
8622 |
||
8623 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
8624 |
! ! |
|
3892 | 8625 |
|
4849 | 8626 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 8627 |
|
8628 |
anySTFilesPresent |
|
8629 |
^ self anyFilesPresentWithSuffix:'st' |
|
8630 |
! |
|
8631 |
||
8632 |
canCreateNewProject |
|
8633 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
12811 | 8634 |
^ self currentSelectedFiles contains:[:fileName| |
8635 |
| suffix| |
|
8636 |
suffix := fileName suffix asLowercase. |
|
8637 |
(suffix = 'prj' or:[suffix = 'st']) |
|
8638 |
] |
|
3892 | 8639 |
! |
8640 |
||
8641 |
canDoTerminal |
|
8642 |
||
8643 |
^ OperatingSystem isUNIXlike |
|
8644 |
or:[OperatingSystem isMSWINDOWSlike] |
|
8645 |
! |
|
8646 |
||
8647 |
canDoTerminalAndSystemIsDOS |
|
8648 |
||
8649 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
8650 |
! |
|
8651 |
||
8652 |
canDoTerminalAndSystemIsUnix |
|
8653 |
||
8654 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
8655 |
! |
|
8656 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8657 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8658 |
"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
|
8659 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8660 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8661 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8662 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8663 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8664 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8665 |
|
12811 | 8666 |
canOpenMonticelloBrowser |
8667 |
^ self currentSelectedFiles |
|
8668 |
contains:[:fileName| |
|
8669 |
fileName suffix asLowercase = 'mcz' |
|
8670 |
] |
|
8671 |
! |
|
8672 |
||
3892 | 8673 |
canReadAbbrevFile |
8674 |
||
5960 | 8675 |
|currentDirectory| |
3892 | 8676 |
|
8677 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 8678 |
currentDirectory := self currentDirectory. |
8679 |
^ currentDirectory notNil |
|
8680 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 8681 |
! |
8682 |
||
8683 |
canRemoveFromSourcePath |
|
8684 |
||
8685 |
^ false |
|
8686 |
! |
|
8687 |
||
13089 | 8688 |
cannotGenerateSignatureFiles |
8689 |
^ self canGenerateSignatureFiles not |
|
8690 |
! |
|
8691 |
||
3892 | 8692 |
hasASN1 |
8693 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 8694 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 8695 |
|
8696 |
! |
|
8697 |
||
8698 |
hasASN1AndSelection |
|
8699 |
^ [ self hasSelection value |
|
17416 | 8700 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 8701 |
and:[OSI::ASN1Parser notNil |
8702 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 8703 |
|
8704 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 8705 |
! |
8706 |
||
8707 |
hasCBrowser |
|
8708 |
^ [ CBrowser::Browser notNil ] |
|
8709 |
! |
|
8710 |
||
8711 |
hasJava |
|
8712 |
||
14298 | 8713 |
^ [ JavaVM notNil |
8714 |
and:[JavaClassReader notNil |
|
8715 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8716 |
! |
8717 |
||
8718 |
hasJavaAndSelection |
|
8719 |
||
12871 | 8720 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8721 |
and:[JavaClassReader notNil |
8722 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8723 |
! |
8724 |
||
8725 |
hasMP3Player |
|
8726 |
||
8727 |
^ [ MP3PlayerApplication notNil |
|
4414 | 8728 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 8729 |
! |
8730 |
||
8731 |
hasMP3PlayerAndSelection |
|
8732 |
||
12871 | 8733 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8734 |
and:[ self hasMP3Player value]] |
3892 | 8735 |
! |
8736 |
||
8426 | 8737 |
hasResourceFileSelected |
12871 | 8738 |
^ (self currentSelectedFiles) |
8739 |
contains:[:fn | |
|
12811 | 8740 |
fn suffix asLowercase = 'rs' |
8741 |
]. |
|
8426 | 8742 |
! |
8743 |
||
3892 | 8744 |
hasSlideShow |
8745 |
||
8746 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
8747 |
! |
|
8748 |
||
8749 |
hasSnapshotSelection |
|
8750 |
||
8751 |
^ [ |
|
4414 | 8752 |
| files | |
8426 | 8753 |
|
4414 | 8754 |
files := self currentSelectedFiles. |
8755 |
((files size == 1) |
|
8756 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 8757 |
] |
8758 |
! |
|
8759 |
||
7869 | 8760 |
hasXml |
9206 | 8761 |
^ [ XML::XMLParser notNil ] |
7869 | 8762 |
! |
8763 |
||
8764 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
8765 |
"/ 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
|
8766 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 8767 |
|
8426 | 8768 |
^ [ |
8769 |
|sel fileName| |
|
7869 | 8770 |
|
8771 |
sel := self currentSelectedFiles. |
|
8772 |
sel size == 1 ifTrue:[ |
|
8773 |
fileName := sel first. |
|
8774 |
fileName notNil ifTrue:[ |
|
15936 | 8775 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 8776 |
] ifFalse:[ |
8777 |
false |
|
8778 |
] |
|
8779 |
] ifFalse:[ |
|
8780 |
false |
|
8781 |
] |
|
8782 |
] |
|
8783 |
! |
|
8784 |
||
3892 | 8785 |
hasZipFileSelected |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8786 |
|sel fileName suff| |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8787 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8788 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8789 |
sel size == 1 ifFalse:[^ false]. |
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 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8792 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8793 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8794 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8795 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8796 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8797 |
^ fileName mimeTypeOfContents = 'application/x-zip-compressed' |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8798 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8799 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8800 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8801 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8802 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8803 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8804 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8805 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 8806 |
! |
8807 |
||
8808 |
javaSupportLoaded |
|
8809 |
||
8810 |
^ false |
|
8811 |
! ! |
|
8812 |
||
14126 | 8813 |
|
8814 |
||
3906 | 8815 |
!AbstractFileBrowser methodsFor:'presentation'! |
8816 |
||
8817 |
getModeString:modeBits |
|
8818 |
"convert file-mode bits into a more user-friendly string. |
|
8819 |
This is wrong here - should be moved into OperatingSystem." |
|
8820 |
||
8821 |
^ self getModeString:modeBits |
|
4414 | 8822 |
with:#( 'owner:' $r $w $x |
8823 |
' group:' $r $w $x |
|
8824 |
' others:' $r $w $x ) |
|
3906 | 8825 |
! |
8826 |
||
8827 |
getModeString:modeBits with:texts |
|
8828 |
"convert file-mode bits into a more user-friendly string. |
|
8829 |
This is wrong here - should be moved into OperatingSystem." |
|
8830 |
||
8831 |
|bits modeString| |
|
8832 |
||
8833 |
bits := modeBits bitAnd:8r777. |
|
8834 |
modeString := ''. |
|
8835 |
||
8836 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
8837 |
with: texts do:[:bitMask :access | |
|
4414 | 8838 |
|ch| |
8839 |
||
8840 |
bitMask isNil ifTrue:[ |
|
8841 |
modeString := modeString , access |
|
8842 |
] ifFalse:[ |
|
8843 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
8844 |
ch := $- |
|
8845 |
] ifFalse:[ |
|
8846 |
ch := access |
|
8847 |
]. |
|
8848 |
modeString := modeString copyWith:ch |
|
8849 |
] |
|
3906 | 8850 |
]. |
8851 |
^ modeString |
|
8852 |
! ! |
|
8853 |
||
5880 | 8854 |
!AbstractFileBrowser methodsFor:'private'! |
8855 |
||
8856 |
theSingleSelectedDirectoryOrHomeDir |
|
8857 |
|dir| |
|
8858 |
||
5888 | 8859 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 8860 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
8861 |
^ dir. |
|
8862 |
! |
|
8863 |
||
8864 |
theSingleSelectedDirectoryOrNil |
|
8865 |
|dirs| |
|
8866 |
||
8867 |
dirs := self currentSelectedDirectories. |
|
8868 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8869 |
^ dirs anElement. |
|
14577 | 8870 |
! |
8871 |
||
8872 |
theSingleSelectedFileOrNil |
|
8873 |
|dirs| |
|
8874 |
||
8875 |
dirs := self currentSelectedFiles. |
|
8876 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8877 |
^ dirs anElement. |
|
5880 | 8878 |
! ! |
8879 |
||
3892 | 8880 |
!AbstractFileBrowser methodsFor:'queries'! |
8881 |
||
8256 | 8882 |
cBrowserLoaded |
8883 |
^ CBrowser::Browser notNil |
|
8884 |
! |
|
8885 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8886 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8887 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8888 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8889 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8890 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8891 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8892 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8893 |
"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
|
8894 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8895 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8896 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8897 |
|
3906 | 8898 |
getFileInfoStringForFirstSelectedFile:longInfo |
8899 |
"get stat info on selected file - return a string which can be |
|
8900 |
shown in a box" |
|
8901 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
8902 |
|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
|
8903 |
sizeString fileSize tAccess tModification buffer| |
3906 | 8904 |
|
7560 | 8905 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
8906 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 8907 |
filename := selFiles first. |
8908 |
||
8364 | 8909 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8910 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8911 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8912 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8913 |
]. |
8364 | 8914 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
8915 |
buffer := Text writeStream. |
4765 | 8916 |
|
8917 |
buffer |
|
8918 |
nextPutAll:'filename: '; |
|
8919 |
nextPutLine:filename asString. |
|
8920 |
||
8364 | 8921 |
OperatingSystem isMSDOSlike ifTrue: [ |
8922 |
(info alternativeName notNil |
|
8923 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
8924 |
buffer nextPutAll:'shortname: '. |
|
8925 |
buffer nextPutLine:info alternativeName. |
|
8926 |
] |
|
8927 |
]. |
|
8928 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8929 |
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
|
8930 |
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
|
8931 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8932 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8933 |
]. |
4765 | 8934 |
buffer |
8935 |
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
|
8936 |
nextPutLine:(info path ? '???'). |
3906 | 8937 |
] 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
|
8938 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8939 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8940 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8941 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8942 |
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
|
8943 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8944 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8945 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8946 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8947 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8948 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8949 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8950 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8951 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8952 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8953 |
fileSize > 1024 ifTrue:[ |
8172 | 8954 |
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
|
8955 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8956 |
]. |
4765 | 8957 |
buffer nextPutLine:sizeString. |
3906 | 8958 |
|
8959 |
modeBits := info mode. |
|
8960 |
modeString := self getModeString:modeBits. |
|
4765 | 8961 |
|
8962 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 8963 |
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
|
8964 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 8965 |
]. |
4765 | 8966 |
buffer |
8967 |
cr; |
|
8968 |
nextPutAll:'owner: '; |
|
8969 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
8970 |
||
3906 | 8971 |
longInfo ifTrue:[ |
4765 | 8972 |
buffer |
8973 |
nextPutAll:'group: '; |
|
8974 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
8975 |
||
8976 |
tAccess := info accessTime. |
|
8977 |
buffer |
|
8978 |
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
|
8979 |
nextPutAll:tAccess asDate printString; |
4765 | 8980 |
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
|
8981 |
nextPutLine:tAccess asTime printString. |
4765 | 8982 |
|
8983 |
tModification := info modificationTime. |
|
8984 |
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
|
8985 |
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
|
8986 |
nextPutAll:tModification asDate printString; |
4765 | 8987 |
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
|
8988 |
nextPutLine:tModification asTime printString. |
3906 | 8989 |
]. |
4765 | 8990 |
^ buffer contents |
7560 | 8991 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
8992 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 8993 |
! |
8994 |
||
8510 | 8995 |
hasImageColorHistogram |
8996 |
^ ImageColorHistogram notNil |
|
8997 |
! |
|
8998 |
||
10258 | 8999 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9000 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9001 |
|
9002 |
"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
|
9003 |
"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
|
9004 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9005 |
! |
9006 |
||
3892 | 9007 |
initialCommandFor:fileName into:aBox |
9008 |
"set a useful initial command for execute box." |
|
9009 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
9010 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 9011 |
! |
9012 |
||
9013 |
isAbstractFileBrowser |
|
9014 |
||
9015 |
^ true |
|
9016 |
! |
|
9017 |
||
9018 |
systemIsDOS |
|
9019 |
||
9020 |
^ OperatingSystem isMSDOSlike |
|
9021 |
! |
|
9022 |
||
12473 | 9023 |
systemIsOSX |
9024 |
||
9025 |
^ OperatingSystem isOSXlike |
|
9026 |
! |
|
9027 |
||
3892 | 9028 |
systemIsUnix |
9029 |
^ OperatingSystem isUNIXlike |
|
14980 | 9030 |
! |
9031 |
||
9032 |
systemSupportsVolumes |
|
9033 |
||
9034 |
^ OperatingSystem supportsVolumes |
|
3892 | 9035 |
! ! |
9036 |
||
9037 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9038 |
||
9039 |
allItemsOfCurrentDirectory |
|
5009 | 9040 |
self |
4774 | 9041 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9042 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9043 |
||
9044 |
^ nil |
|
3892 | 9045 |
! |
9046 |
||
9047 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9048 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9049 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9050 |
(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
|
9051 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9052 |
]. |
9053 |
^ false. |
|
9054 |
! |
|
9055 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9056 |
commonPrefixOfSelectedFiles |
4773 | 9057 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9058 |
|
7560 | 9059 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9060 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9061 |
|
4772 | 9062 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 9063 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9064 |
stringCol from:2 do:[:el| |
4773 | 9065 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9066 |
]. |
4773 | 9067 |
^ firstPre asFilename |
7560 | 9068 |
|
9069 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9070 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9071 |
|
12481 | 9072 |
compressTabsOnSave |
9073 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9074 |
when saving. |
|
9075 |
Default is true" |
|
9076 |
||
9077 |
^ true |
|
9078 |
! |
|
9079 |
||
3892 | 9080 |
currentFilesAreInSameDirectory |
9081 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9082 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9083 |
! |
9084 |
||
9085 |
currentFilesHasDirectories |
|
9086 |
||
6725 | 9087 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9088 |
! |
9089 |
||
3982 | 9090 |
directoriesForFiles:aFileCol |
11743 | 9091 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9092 |
! |
9093 |
||
3892 | 9094 |
fileListIsEmpty |
5009 | 9095 |
self |
9096 |
applicationNamed:#DirectoryContentsBrowser |
|
9097 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9098 |
||
9099 |
^ nil. |
|
3892 | 9100 |
! |
9101 |
||
9102 |
fileListIsNotEmpty |
|
9103 |
||
9104 |
^ self fileListIsEmpty not. |
|
9105 |
! |
|
9106 |
||
9107 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9108 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9109 |
|
9110 |
| file1 file2 | |
|
9111 |
||
6284 | 9112 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9113 |
file1 := aFilename1 asFilename. |
9114 |
file2 := aFilename2 asFilename. |
|
6284 | 9115 |
|
3892 | 9116 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9117 |
|
3892 | 9118 |
((file1 isDirectory) |
9119 |
and:[(file2 isDirectory) |
|
9120 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9121 |
^ file1 baseName = file2 baseName |
3892 | 9122 |
]. |
3982 | 9123 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9124 |
! |
9125 |
||
9126 |
getAllFilesAsStringCollection |
|
5009 | 9127 |
self |
9128 |
applicationNamed:#DirectoryContentsBrowser |
|
9129 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9130 |
||
9131 |
^ nil |
|
3892 | 9132 |
! |
9133 |
||
9134 |
getBestDirectory |
|
9135 |
||
9136 |
|selFiles stringCol firstPre| |
|
9137 |
||
6725 | 9138 |
selFiles := self currentSelectedDirectories. |
3892 | 9139 |
selFiles isEmpty ifTrue:[^ nil]. |
9140 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 9141 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 9142 |
firstPre := stringCol at:1. |
9143 |
stringCol from:2 do:[:el| |
|
4414 | 9144 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 9145 |
]. |
9146 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 9147 |
firstPre removeLast. |
3892 | 9148 |
]. |
9149 |
^ firstPre asFilename |
|
9150 |
! |
|
9151 |
||
9152 |
getDirWithoutFileName:aFileName |
|
9153 |
||
9154 |
| dir | |
|
9155 |
aFileName isNil ifTrue:[ |
|
4414 | 9156 |
^ aFileName. |
3892 | 9157 |
]. |
9158 |
dir := aFileName asFilename. |
|
9159 |
dir isDirectory ifFalse:[ |
|
4414 | 9160 |
dir := dir directory. |
3892 | 9161 |
]. |
9162 |
^ dir. |
|
9163 |
! |
|
9164 |
||
9165 |
getInfoItem |
|
9166 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9167 |
This file is automatically shown when a directory is entered. |
3892 | 9168 |
You can add more names below if you like." |
9169 |
||
5880 | 9170 |
|dir| |
9171 |
||
9172 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9173 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9174 |
|
16778 | 9175 |
#( |
3892 | 9176 |
'.dir.info' |
9177 |
'README' |
|
9178 |
'ReadMe' |
|
9179 |
'Readme' |
|
9180 |
'readme' |
|
9181 |
'read.me' |
|
9182 |
'Read.me' |
|
9183 |
'READ.ME' |
|
9184 |
'README.TXT' |
|
15915 | 9185 |
'README.txt' |
3892 | 9186 |
'readme.txt' |
9187 |
'Readme.txt' |
|
9188 |
'Info.txt' |
|
9189 |
'info.txt' |
|
9190 |
'INFO.TXT' |
|
15915 | 9191 |
'INFO.txt' |
16778 | 9192 |
) do:[:f | |
5883 | 9193 |
|n| |
4414 | 9194 |
|
5880 | 9195 |
n := dir construct:f. |
4414 | 9196 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
9197 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
9198 |
] |
|
3892 | 9199 |
]. |
9200 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9201 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9202 |
|
12497 | 9203 |
hasPackageDirectorySelected |
9204 |
|dir| |
|
9205 |
||
9206 |
dir := self currentDirectory. |
|
9207 |
^ dir notNil |
|
9208 |
and:[ dir exists |
|
9209 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9210 |
! |
|
9211 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9212 |
parentDirectoriesOfCurrentFiles |
11743 | 9213 |
^ self currentSelectedObjects |
9214 |
collect:[:file | file directory] as:Set |
|
7560 | 9215 |
|
9216 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9217 |
! |
9218 |
||
9219 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9220 |
^ true. "/ the code below is too slow for a menu enabling operation |
9221 |
||
9222 |
"/ |directories| |
|
9223 |
"/ |
|
9224 |
"/ directories := self currentDirectories value. |
|
9225 |
"/ directories do:[:dir| |
|
9226 |
"/ [ |
|
9227 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9228 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9229 |
"/ ] |
|
9230 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9231 |
"/ ]. |
|
9232 |
"/ ^ false. |
|
6586 | 9233 |
! |
9234 |
||
9235 |
recursiveAnySTFilesPresent |
|
9236 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9237 |
! ! |
9238 |
||
9239 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9240 |
||
9241 |
currentSelectedDirectories |
|
6725 | 9242 |
^ self currentDirectoriesValue. |
3982 | 9243 |
! |
9244 |
||
9245 |
currentSelectedFiles |
|
12824 | 9246 |
^ self currentSelectedObjects reject:[:file | file isDirectory]. |
7560 | 9247 |
|
9248 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9249 |
! |
9250 |
||
6460 | 9251 |
currentSelectedObjects |
9252 |
^ self currentFileNameHolder value |
|
9253 |
! |
|
9254 |
||
3982 | 9255 |
firstSelectedFile |
7560 | 9256 |
^ self currentSelectedObjects |
12102 | 9257 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9258 |
ifNone:[]. |
7560 | 9259 |
|
9260 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9261 |
! |
9262 |
||
9490 | 9263 |
hasOnlyDirectoriesSelected |
9264 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9265 |
||
9266 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9267 |
! |
|
9268 |
||
4414 | 9269 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9270 |
|
7560 | 9271 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9272 |
||
9273 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9274 |
! |
9275 |
||
9490 | 9276 |
hasTwoDirectoriesSelected |
9277 |
||
9278 |
^ self currentSelectedObjects size == 2 |
|
9279 |
and:[self hasOnlyDirectoriesSelected] |
|
9280 |
||
9281 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9282 |
! |
|
9283 |
||
4414 | 9284 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9285 |
|
7560 | 9286 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9287 |
and:[self hasOnlyFilesSelected] |
7560 | 9288 |
|
9289 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9290 |
! |
9291 |
||
9292 |
selectNextFile |
|
9293 |
self |
|
9294 |
applicationNamed:#DirectoryContentsBrowser |
|
9295 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9296 |
! |
|
9297 |
||
9298 |
selectPreviousFile |
|
9299 |
self |
|
9300 |
applicationNamed:#DirectoryContentsBrowser |
|
9301 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
3892 | 9302 |
! ! |
9303 |
||
3964 | 9304 |
!AbstractFileBrowser methodsFor:'sorting'! |
9305 |
||
3989 | 9306 |
currentSortOrder |
4027 | 9307 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 9308 |
! |
9309 |
||
9310 |
sortBlockHolder |
|
9311 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9312 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9313 |
selector:#fileName |
|
9314 |
sortCaseless:self sortCaseless value |
|
9315 |
sortReverse:false) asValue. |
|
3989 | 9316 |
]. |
9317 |
! |
|
9318 |
||
9319 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9320 |
|v| |
4027 | 9321 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9322 |
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
|
9323 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9324 |
^ v. |
3989 | 9325 |
! |
9326 |
||
9327 |
sortCaseless |
|
4201 | 9328 |
" aspect for sort caseless " |
3989 | 9329 |
|
13000 | 9330 |
^ self |
9331 |
aspectFor:#sortCaseless |
|
9332 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9333 |
! |
9334 |
||
4074 | 9335 |
sortDirectoriesBeforeFiles |
9336 |
||
4201 | 9337 |
" aspect for sort directories always before files" |
4074 | 9338 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9339 |
! |
|
9340 |
||
3989 | 9341 |
sortFileListsBy:instanceName |
9342 |
||
9343 |
self sortFileListsBy:instanceName withReverse:true |
|
9344 |
! |
|
9345 |
||
9346 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9347 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9348 |
|
9349 |
aSymbol := instanceName asSymbol. |
|
4027 | 9350 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9351 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9352 |
currentSortOrder := self currentSortOrder value. |
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9353 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9354 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9355 |
currentSortOrder at:#column put:aSymbol. |
9356 |
currentSortOrder at:#reverse put:false. |
|
9357 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9358 |
] ifFalse:[ |
4343 | 9359 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9360 |
"/ sort caseless changed |
|
9361 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9362 |
] ifFalse:[ |
|
9363 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9364 |
"/ same column like before - change sort order ifReverse is true |
|
9365 |
aBoolean ifTrue:[ |
|
9366 |
isReverse := currentSortOrder at:#reverse. |
|
9367 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9368 |
]. |
|
9369 |
] ifFalse:[ |
|
9370 |
"/ another column - remark column |
|
9371 |
currentSortOrder at:#column put:aSymbol. |
|
9372 |
] |
|
9373 |
] |
|
3964 | 9374 |
]. |
4027 | 9375 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9376 |
|
5383 | 9377 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9378 |
selector:instanceName |
|
9379 |
sortCaseless:sortCaselessLocal |
|
9380 |
sortReverse:(currentSortOrder at:#reverse). |
|
9381 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9382 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9383 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
3964 | 9384 |
! ! |
9385 |
||
3892 | 9386 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9387 |
||
16720 | 9388 |
initializeAspects |
9389 |
aspects := IdentityDictionary new. |
|
9390 |
aspects at:#applications put:(IdentityDictionary new). |
|
9391 |
! |
|
9392 |
||
3892 | 9393 |
makeDependent |
4074 | 9394 |
self filterModel addDependent:self. |
4004 | 9395 |
self currentFileNameHolder addDependent:self. |
4074 | 9396 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9397 |
self sortCaseless addDependent:self. |
4011 | 9398 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9399 |
self rootHolder addDependent:self. |
3892 | 9400 |
! |
9401 |
||
9402 |
masterApplication:anApplication |
|
9403 |
||
9404 |
masterApplication isNil ifTrue:[ |
|
4414 | 9405 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9406 |
aspects := anApplication aspects |
|
9407 |
] ifFalse:[ |
|
9408 |
aspects isNil ifTrue:[ |
|
16721 | 9409 |
self initializeAspects. |
4414 | 9410 |
] |
9411 |
]. |
|
9412 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9413 |
"/ self makeDependent. |
3892 | 9414 |
]. |
3952 | 9415 |
^ super masterApplication:anApplication. |
3892 | 9416 |
! |
9417 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9418 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9419 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9420 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9421 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9422 |
|
3892 | 9423 |
postOpenWith:aBuilder |
9424 |
||
9425 |
super postOpenWith:aBuilder. |
|
14655 | 9426 |
"/ now done for all windowGroups by the group itself |
9427 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9428 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9429 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9430 |
! ! |
9431 |
||
9432 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9433 |
||
9434 |
files |
|
9435 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9436 |
||
9437 |
^ files |
|
9438 |
! |
|
9439 |
||
9440 |
files:something |
|
9441 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9442 |
||
9443 |
files := something. |
|
9444 |
! |
|
9445 |
||
9446 |
method |
|
9447 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9448 |
||
9449 |
^ method |
|
9450 |
! |
|
9451 |
||
9452 |
method:something |
|
9453 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9454 |
||
9455 |
method := something. |
|
9456 |
! ! |
|
9457 |
||
9458 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9459 |
||
9460 |
locked |
|
9461 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
9462 |
||
9463 |
locked isNil ifTrue:[ |
|
4414 | 9464 |
locked := false. |
3892 | 9465 |
]. |
9466 |
^ locked |
|
9467 |
! ! |
|
9468 |
||
9469 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
9470 |
||
9471 |
doIfUnLocked:aBlock |
|
9472 |
||
9473 |
self locked ifFalse:[ |
|
4414 | 9474 |
aBlock value. |
3892 | 9475 |
]. |
9476 |
! |
|
9477 |
||
9478 |
doLocked:aBlock |
|
9479 |
||
9480 |
locked := true. |
|
4004 | 9481 |
aBlock ensure:[ |
4414 | 9482 |
locked := false. |
4004 | 9483 |
] |
3892 | 9484 |
! ! |
9485 |
||
3952 | 9486 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
9487 |
||
6369 | 9488 |
defaultHistorySize |
9489 |
^ 50 |
|
3892 | 9490 |
! ! |
9491 |
||
6371 | 9492 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 9493 |
|
9494 |
new |
|
6371 | 9495 |
^ (super new) initializeHistory. |
6369 | 9496 |
! ! |
9497 |
||
9498 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
9499 |
||
9500 |
historySize |
|
9501 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
9502 |
^ historySize |
|
9503 |
! |
|
9504 |
||
9505 |
historySize:aNumber |
|
9506 |
historySize := aNumber |
|
4032 | 9507 |
! ! |
9508 |
||
3892 | 9509 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
9510 |
||
3952 | 9511 |
addToHistory:aPath |
15803 | 9512 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9513 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9514 |
pathToAdd := aPath. |
15803 | 9515 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9516 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 9517 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9518 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9519 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9520 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9521 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9522 |
self backForwardListAdd:pathToAdd. |
3952 | 9523 |
item isNil ifTrue:[ |
4347 | 9524 |
" not already in history" |
6369 | 9525 |
self size >= self historySize ifTrue:[ |
4347 | 9526 |
self removeLast. |
9527 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9528 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 9529 |
] ifFalse:[ |
4347 | 9530 |
"already been there before; move the entry to |
9531 |
the beginning, so it will fall out later." |
|
9532 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9533 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9534 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9535 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9536 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 9537 |
! |
9538 |
||
4347 | 9539 |
backForwardListAdd:aPath |
9540 |
|pathIndex| |
|
9541 |
||
9542 |
pathIndex := backForwardList indexOf:aPath. |
|
9543 |
pathIndex == 0 ifTrue:[ |
|
9544 |
" a new path comes in remove forward paths " |
|
9545 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
9546 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
9547 |
]. |
|
9548 |
] ifFalse:[ |
|
9549 |
backForwardList remove:aPath. |
|
9550 |
pathIndex <= backForwardIndex ifTrue:[ |
|
9551 |
backForwardIndex := backForwardIndex - 1. |
|
9552 |
] |
|
4022 | 9553 |
]. |
4347 | 9554 |
backForwardList add:aPath afterIndex:backForwardIndex. |
9555 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 9556 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 9557 |
backForwardList removeFirst. |
9558 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 9559 |
]. |
4347 | 9560 |
! |
9561 |
||
9562 |
goBackward |
|
4288 | 9563 |
"return the first path of the backward list; |
9564 |
remove it from the back list and add it ti the forward list." |
|
4022 | 9565 |
|
4347 | 9566 |
|retPath| |
9567 |
||
9568 |
self canBackward ifTrue:[ |
|
9569 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
9570 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 9571 |
]. |
4022 | 9572 |
^ retPath. |
9573 |
! |
|
9574 |
||
9575 |
goForward |
|
4288 | 9576 |
"return the first path of the forward list; |
9577 |
remove it from the list." |
|
4022 | 9578 |
|
4347 | 9579 |
|retPath| |
9580 |
||
9581 |
self canForward ifTrue:[ |
|
9582 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9583 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 9584 |
]. |
4022 | 9585 |
^ retPath. |
9586 |
! |
|
9587 |
||
9588 |
resetForwardBackward |
|
9589 |
||
4347 | 9590 |
self initialize |
4022 | 9591 |
! |
9592 |
||
9593 |
setPosition:aPosition for:aPath |
|
9594 |
||
9595 |
self do:[:item| |
|
4414 | 9596 |
item path = aPath ifTrue:[ |
9597 |
item position:aPosition. |
|
9598 |
] |
|
4022 | 9599 |
]. |
3892 | 9600 |
! ! |
9601 |
||
4870 | 9602 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 9603 |
|
6371 | 9604 |
initializeHistory |
4032 | 9605 |
|
4347 | 9606 |
backForwardList := OrderedCollection new. |
9607 |
self reverseDo:[:el| |
|
9608 |
backForwardList add:el path. |
|
9609 |
]. |
|
9610 |
backForwardIndex := backForwardList size. |
|
4032 | 9611 |
! ! |
9612 |
||
3892 | 9613 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
9614 |
||
4288 | 9615 |
canBackward |
4347 | 9616 |
|
9617 |
^ backForwardIndex > 1 |
|
4288 | 9618 |
! |
9619 |
||
3892 | 9620 |
canForward |
4347 | 9621 |
|
9622 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
9623 |
! |
|
9624 |
||
9625 |
getBackCollection |
|
9626 |
||
9627 |
| backCol | |
|
9628 |
||
9629 |
backCol := OrderedCollection new. |
|
9630 |
self canBackward ifTrue:[ |
|
9631 |
| tmpCol | |
|
9632 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
9633 |
tmpCol reverseDo:[ :el| |
|
9634 |
backCol add:el. |
|
9635 |
] |
|
9636 |
]. |
|
9637 |
^ backCol |
|
3952 | 9638 |
! |
9639 |
||
9640 |
getForwardCollection |
|
9641 |
||
4347 | 9642 |
| forwCol | |
9643 |
||
9644 |
forwCol := OrderedCollection new. |
|
9645 |
self canForward ifTrue:[ |
|
9646 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
9647 |
]. |
|
9648 |
^ forwCol |
|
3952 | 9649 |
! |
9650 |
||
9651 |
getItemFor:aPath |
|
6627 | 9652 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
9653 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
9654 |
"/ ^ nil. |
|
3952 | 9655 |
! |
9656 |
||
9657 |
getPositionFor:aPath |
|
9658 |
||
9659 |
|item| |
|
9660 |
||
9661 |
item := self getItemFor:aPath. |
|
9662 |
||
9663 |
item notNil ifTrue:[ |
|
4414 | 9664 |
^ item position. |
3952 | 9665 |
]. |
9666 |
^ nil |
|
9667 |
! |
|
9668 |
||
9669 |
includesPath:aPath |
|
6627 | 9670 |
^ self contains:[:item | item path = aPath]. |
9671 |
||
9672 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
9673 |
"/ ^ false. |
|
4347 | 9674 |
! |
9675 |
||
9676 |
nextBackwardItem |
|
9677 |
"return the first path of the backward list" |
|
9678 |
||
9679 |
|retPath| |
|
9680 |
||
9681 |
self canBackward ifTrue:[ |
|
9682 |
retPath := backForwardList at:backForwardIndex. |
|
9683 |
]. |
|
9684 |
^ retPath. |
|
9685 |
! |
|
9686 |
||
9687 |
nextForwardItem |
|
9688 |
"return the first path of the forward list" |
|
9689 |
||
9690 |
|retPath| |
|
9691 |
||
9692 |
self canForward ifTrue:[ |
|
9693 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9694 |
]. |
|
9695 |
^ retPath. |
|
3952 | 9696 |
! ! |
9697 |
||
9698 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
9699 |
||
9700 |
path:aPath |
|
9701 |
||
9702 |
^ self new path:aPath |
|
9703 |
! ! |
|
9704 |
||
9705 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
9706 |
||
6433 | 9707 |
asFilename |
9708 |
^ path asFilename |
|
9709 |
! |
|
9710 |
||
3952 | 9711 |
path |
9712 |
"return the value of the instance variable 'path' (automatically generated)" |
|
9713 |
||
9714 |
^ path |
|
9715 |
! |
|
9716 |
||
9717 |
path:something |
|
9718 |
"set the value of the instance variable 'path' (automatically generated)" |
|
9719 |
||
9720 |
path := something. |
|
9721 |
! |
|
9722 |
||
9723 |
position |
|
9724 |
"return the value of the instance variable 'position' (automatically generated)" |
|
9725 |
||
9726 |
^ position |
|
9727 |
! |
|
9728 |
||
9729 |
position:something |
|
9730 |
"set the value of the instance variable 'position' (automatically generated)" |
|
9731 |
||
9732 |
position := something. |
|
9733 |
! |
|
9734 |
||
9735 |
printString |
|
9736 |
||
9737 |
^ self path asString |
|
3892 | 9738 |
! ! |
9739 |
||
9740 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
9741 |
||
9742 |
withValue:aValue isHolder:aBoolean |
|
9743 |
||
9744 |
| instance | |
|
9745 |
||
9746 |
instance := self basicNew. |
|
9747 |
instance value:aValue. |
|
9748 |
instance isHolder:aBoolean. |
|
9749 |
^ instance |
|
9750 |
! ! |
|
9751 |
||
9752 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
9753 |
||
9754 |
isHolder |
|
9755 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
9756 |
||
9757 |
^ isHolder |
|
9758 |
! |
|
9759 |
||
9760 |
isHolder:something |
|
9761 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
9762 |
||
9763 |
isHolder := something. |
|
9764 |
! |
|
9765 |
||
9766 |
value |
|
9767 |
"return the value of the instance variable 'value' (automatically generated)" |
|
9768 |
||
9769 |
^ value |
|
9770 |
! |
|
9771 |
||
9772 |
value:something |
|
9773 |
"set the value of the instance variable 'value' (automatically generated)" |
|
9774 |
||
9775 |
value := something. |
|
9776 |
! ! |
|
9777 |
||
9778 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
9779 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9780 |
version |
15803 | 9781 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9782 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9783 |
|
8832 | 9784 |
version_CVS |
15803 | 9785 |
^ '$Header$' |
3892 | 9786 |
! ! |
12094 | 9787 |