author | Claus Gittinger <cg@exept.de> |
Sun, 19 Nov 2017 14:10:32 +0100 | |
changeset 17767 | 195cf7c7e58f |
parent 17762 | 29cf50354a7a |
child 17768 | dde98b4c9580 |
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 |
|
17724 | 1440 |
isVisible: systemIsOSX |
15211 | 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 |
||
17724 | 1519 |
"Modified: / 29-10-2017 / 11:13:49 / cg" |
15211 | 1520 |
! |
1521 |
||
1522 |
directoryMenu |
|
1523 |
"This resource specification was automatically generated |
|
1524 |
by the MenuEditor of ST/X." |
|
1525 |
||
1526 |
"Do not manually edit this!! If it is corrupted, |
|
1527 |
the MenuEditor may not be able to read the specification." |
|
1528 |
||
1529 |
||
1530 |
" |
|
1531 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1532 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1533 |
" |
|
1534 |
||
1535 |
<resource: #menu> |
|
1536 |
||
1537 |
^ |
|
1538 |
#(Menu |
|
1539 |
( |
|
1540 |
(MenuItem |
|
1541 |
label: 'Bookmarks' |
|
1542 |
submenuChannel: bookmarksMenu |
|
1543 |
) |
|
1544 |
(MenuItem |
|
1545 |
label: 'Visited Directories' |
|
1546 |
submenuChannel: visitedDirectoriesMenu |
|
1547 |
) |
|
1548 |
(MenuItem |
|
1549 |
label: '-' |
|
1550 |
) |
|
1551 |
(MenuItem |
|
1552 |
label: 'Up' |
|
1553 |
itemValue: doGoDirectoryUp |
|
1554 |
) |
|
1555 |
(MenuItem |
|
1556 |
activeHelpKey: directoryBack |
|
1557 |
enabled: enableBack |
|
1558 |
label: 'Back' |
|
1559 |
itemValue: doBack |
|
1560 |
) |
|
1561 |
(MenuItem |
|
1562 |
activeHelpKey: directoryBack |
|
1563 |
enabled: enableForward |
|
1564 |
label: 'Forward' |
|
1565 |
itemValue: doForward |
|
1566 |
) |
|
1567 |
(MenuItem |
|
1568 |
label: '-' |
|
1569 |
) |
|
1570 |
(MenuItem |
|
1571 |
enabled: enableHome |
|
1572 |
label: 'Home Directory' |
|
1573 |
itemValue: doGotoHomeDirectory |
|
1574 |
) |
|
1575 |
(MenuItem |
|
1576 |
enabled: enableGotoDesktopDirectory |
|
1577 |
label: 'Desktop' |
|
1578 |
itemValue: doGotoDesktopDirectory |
|
1579 |
) |
|
1580 |
(MenuItem |
|
1581 |
enabled: enableGotoDefaultDirectory |
|
1582 |
label: 'Default (Current) Directory' |
|
1583 |
itemValue: doGotoDefaultDirectory |
|
1584 |
) |
|
1585 |
(MenuItem |
|
1586 |
enabled: enableGotoSmalltalkDirectory |
|
1587 |
label: 'Smalltalk (Application) Directory' |
|
1588 |
itemValue: doGotoSmalltalkDirectory |
|
1589 |
) |
|
1590 |
(MenuItem |
|
17187 | 1591 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1592 |
label: 'Smalltalk Workspace Directory' |
|
1593 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1594 |
) |
|
1595 |
(MenuItem |
|
15211 | 1596 |
enabled: enableGotoTempDirectory |
1597 |
label: 'Smalltalk Temp Directory' |
|
1598 |
itemValue: doGotoTempDirectory |
|
1599 |
) |
|
1600 |
(MenuItem |
|
1601 |
label: '-' |
|
17582 | 1602 |
isVisible: false |
15211 | 1603 |
) |
1604 |
(MenuItem |
|
1605 |
enabled: enableMakeCurrentDirectory |
|
1606 |
label: 'Make this the Default (Current) Directory' |
|
1607 |
itemValue: doMakeCurrentDirectory |
|
17582 | 1608 |
isVisible: false |
15211 | 1609 |
) |
1610 |
) |
|
1611 |
nil |
|
1612 |
nil |
|
1613 |
) |
|
17582 | 1614 |
|
1615 |
"Modified: / 17-07-2017 / 10:08:31 / cg" |
|
15211 | 1616 |
! |
1617 |
||
1618 |
editMenu |
|
1619 |
"This resource specification was automatically generated |
|
1620 |
by the MenuEditor of ST/X." |
|
1621 |
||
1622 |
"Do not manually edit this!! If it is corrupted, |
|
1623 |
the MenuEditor may not be able to read the specification." |
|
1624 |
||
1625 |
" |
|
1626 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1627 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1628 |
" |
|
1629 |
||
1630 |
<resource: #menu> |
|
1631 |
||
1632 |
^ |
|
1633 |
#(Menu |
|
1634 |
( |
|
1635 |
(MenuItem |
|
1636 |
enabled: hasFileSelection |
|
1637 |
label: 'Copy Selected Filenames to Clipboard' |
|
1638 |
itemValue: copySelectedFilenames |
|
1639 |
translateLabel: true |
|
1640 |
) |
|
1641 |
(MenuItem |
|
1642 |
enabled: fileListIsNotEmpty |
|
1643 |
label: 'Copy all Filenames to Clipboard' |
|
1644 |
itemValue: copyFileList |
|
1645 |
translateLabel: true |
|
1646 |
) |
|
1647 |
) |
|
1648 |
nil |
|
1649 |
nil |
|
1650 |
) |
|
1651 |
! |
|
1652 |
||
1653 |
emptyMenuSpec |
|
1654 |
"This resource specification was automatically generated |
|
1655 |
by the MenuEditor of ST/X." |
|
1656 |
||
1657 |
"Do not manually edit this!! If it is corrupted, |
|
1658 |
the MenuEditor may not be able to read the specification." |
|
1659 |
||
1660 |
" |
|
1661 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1662 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1663 |
" |
|
1664 |
||
1665 |
<resource: #menu> |
|
1666 |
||
1667 |
^ |
|
1668 |
#(#Menu |
|
1669 |
#( |
|
1670 |
) |
|
1671 |
nil |
|
1672 |
nil |
|
1673 |
) |
|
1674 |
! |
|
1675 |
||
1676 |
extraMenu |
|
1677 |
"This resource specification was automatically generated |
|
1678 |
by the MenuEditor of ST/X." |
|
1679 |
||
1680 |
"Do not manually edit this!! If it is corrupted, |
|
1681 |
the MenuEditor may not be able to read the specification." |
|
1682 |
||
1683 |
||
1684 |
" |
|
1685 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1686 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1687 |
" |
|
1688 |
||
1689 |
<resource: #menu> |
|
1690 |
||
1691 |
^ |
|
1692 |
#(Menu |
|
1693 |
( |
|
1694 |
(MenuItem |
|
1695 |
label: 'Encoding...' |
|
1696 |
itemValue: fileEncodingDialog |
|
1697 |
translateLabel: true |
|
1698 |
) |
|
1699 |
(MenuItem |
|
1700 |
label: 'Line End Convention...' |
|
1701 |
itemValue: lineEndConventionDialog |
|
1702 |
translateLabel: true |
|
1703 |
) |
|
1704 |
(MenuItem |
|
1705 |
label: 'Tab Stop Conversion...' |
|
1706 |
itemValue: tabStopConversionDialog |
|
1707 |
translateLabel: true |
|
1708 |
) |
|
1709 |
(MenuItem |
|
1710 |
label: '-' |
|
1711 |
) |
|
1712 |
(MenuItem |
|
1713 |
label: 'Settings...' |
|
1714 |
itemValue: doOpenSettings |
|
1715 |
translateLabel: true |
|
1716 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1717 |
) |
|
1718 |
) |
|
1719 |
nil |
|
1720 |
nil |
|
1721 |
) |
|
1722 |
! |
|
1723 |
||
1724 |
fileMenu |
|
1725 |
"This resource specification was automatically generated |
|
1726 |
by the MenuEditor of ST/X." |
|
1727 |
||
1728 |
"Do not manually edit this!! If it is corrupted, |
|
1729 |
the MenuEditor may not be able to read the specification." |
|
1730 |
||
1731 |
||
1732 |
" |
|
1733 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1734 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1735 |
" |
|
1736 |
||
1737 |
<resource: #menu> |
|
1738 |
||
1739 |
^ |
|
1740 |
#(Menu |
|
1741 |
( |
|
1742 |
(MenuItem |
|
1743 |
enabled: enableFileHistory |
|
1744 |
label: 'File History' |
|
1745 |
submenuChannel: menuFileHistory |
|
1746 |
) |
|
1747 |
(MenuItem |
|
1748 |
label: '-' |
|
1749 |
) |
|
1750 |
(MenuItem |
|
1751 |
label: 'Open' |
|
1752 |
itemValue: doShowFileContents |
|
1753 |
) |
|
1754 |
(MenuItem |
|
1755 |
label: '-' |
|
1756 |
) |
|
1757 |
(MenuItem |
|
1758 |
enabled: hasFileSelection |
|
1759 |
label: 'FileIn' |
|
1760 |
itemValue: fileFileIn |
|
1761 |
) |
|
1762 |
(MenuItem |
|
1763 |
enabled: hasFileSelection |
|
1764 |
label: 'FileIn to Namespace...' |
|
1765 |
itemValue: fileFileInToNameSpace |
|
1766 |
) |
|
1767 |
(MenuItem |
|
1768 |
enabled: hasPackageDirectorySelected |
|
1769 |
label: 'Load Package from Here' |
|
1770 |
itemValue: fileFileInPackage |
|
1771 |
) |
|
1772 |
(MenuItem |
|
1773 |
label: '-' |
|
1774 |
) |
|
1775 |
(MenuItem |
|
1776 |
label: 'New' |
|
1777 |
submenuChannel: newMenu |
|
1778 |
keepLinkedMenu: true |
|
1779 |
) |
|
1780 |
(MenuItem |
|
1781 |
label: '-' |
|
1782 |
) |
|
1783 |
(MenuItem |
|
1784 |
enabled: hasSelection |
|
1785 |
label: 'Cut' |
|
1786 |
itemValue: cutFiles |
|
1787 |
) |
|
1788 |
(MenuItem |
|
1789 |
enabled: hasSelection |
|
1790 |
label: 'Copy' |
|
1791 |
itemValue: copyFiles |
|
1792 |
) |
|
1793 |
(MenuItem |
|
1794 |
enabled: canPaste |
|
1795 |
label: 'Paste' |
|
1796 |
itemValue: pasteFiles |
|
1797 |
) |
|
1798 |
(MenuItem |
|
1799 |
enabled: hasSelection |
|
1800 |
label: 'Delete' |
|
1801 |
itemValue: deleteFiles |
|
1802 |
) |
|
1803 |
(MenuItem |
|
1804 |
enabled: hasSelection |
|
1805 |
label: 'Erase' |
|
1806 |
itemValue: eraseFiles |
|
1807 |
) |
|
1808 |
(MenuItem |
|
1809 |
label: '-' |
|
1810 |
) |
|
1811 |
(MenuItem |
|
1812 |
enabled: hasSelection |
|
1813 |
label: 'Rename...' |
|
1814 |
itemValue: renameSelection |
|
1815 |
shortcutKey: Rename |
|
1816 |
) |
|
1817 |
(MenuItem |
|
1818 |
enabled: hasSelection |
|
1819 |
label: 'Move To...' |
|
1820 |
itemValue: moveSelectionTo |
|
1821 |
) |
|
1822 |
(MenuItem |
|
1823 |
enabled: hasSelection |
|
1824 |
label: 'Copy To...' |
|
1825 |
itemValue: copySelectionTo |
|
1826 |
) |
|
1827 |
(MenuItem |
|
1828 |
enabled: hasSelection |
|
1829 |
label: 'Properties...' |
|
1830 |
itemValue: doShowProperties |
|
1831 |
) |
|
1832 |
(MenuItem |
|
1833 |
label: '-' |
|
1834 |
isVisible: javaSupportLoaded |
|
1835 |
) |
|
1836 |
(MenuItem |
|
1837 |
enabled: canAddToClassPath |
|
1838 |
label: 'Add to Java Class Path' |
|
1839 |
isVisible: javaSupportLoaded |
|
1840 |
) |
|
1841 |
(MenuItem |
|
1842 |
enabled: canRemoveFromClassPath |
|
1843 |
label: 'Remove from Java Class Path' |
|
1844 |
isVisible: javaSupportLoaded |
|
1845 |
) |
|
1846 |
(MenuItem |
|
1847 |
enabled: canAddToSourcePath |
|
1848 |
label: 'Add to Java Source Path' |
|
1849 |
isVisible: javaSupportLoaded |
|
1850 |
) |
|
1851 |
(MenuItem |
|
1852 |
enabled: canRemoveFromSourcePath |
|
1853 |
label: 'Remove from Java Source Path' |
|
1854 |
isVisible: javaSupportLoaded |
|
1855 |
) |
|
1856 |
) |
|
1857 |
nil |
|
1858 |
nil |
|
1859 |
) |
|
1860 |
! |
|
1861 |
||
1862 |
fileOpMenu |
|
1863 |
"This resource specification was automatically generated |
|
1864 |
by the MenuEditor of ST/X." |
|
1865 |
||
1866 |
"Do not manually edit this!! If it is corrupted, |
|
1867 |
the MenuEditor may not be able to read the specification." |
|
1868 |
||
1869 |
||
1870 |
" |
|
1871 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1872 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1873 |
" |
|
1874 |
||
1875 |
<resource: #menu> |
|
1876 |
||
1877 |
^ |
|
1878 |
#(Menu |
|
1879 |
( |
|
1880 |
(MenuItem |
|
1881 |
enabled: hasFileSelection |
|
15906 | 1882 |
label: 'Split (by size)...' |
15211 | 1883 |
itemValue: splitSelectedFiles |
1884 |
) |
|
1885 |
(MenuItem |
|
1886 |
enabled: hasFileSelection |
|
15906 | 1887 |
label: 'Split (by #lines)...' |
1888 |
itemValue: splitSelectedFilesByLines |
|
1889 |
) |
|
1890 |
(MenuItem |
|
1891 |
enabled: hasFileSelection |
|
15211 | 1892 |
label: 'Join...' |
1893 |
itemValue: joinSelectedFiles |
|
1894 |
) |
|
1895 |
(MenuItem |
|
1896 |
enabled: hasFileSelection |
|
1897 |
label: 'Copy Corrupted File To...' |
|
1898 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1899 |
) |
|
1900 |
(MenuItem |
|
15569 | 1901 |
label: 'Copy Corrupted File From -> To...' |
1902 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1903 |
) |
|
1904 |
(MenuItem |
|
15211 | 1905 |
label: '-' |
1906 |
) |
|
1907 |
(MenuItem |
|
1908 |
enabled: hasFileSelection |
|
1909 |
label: 'Rot13...' |
|
1910 |
itemValue: filterSelectedFiles: |
|
1911 |
argument: rot13 |
|
1912 |
) |
|
1913 |
(MenuItem |
|
1914 |
label: '-' |
|
1915 |
) |
|
1916 |
(MenuItem |
|
1917 |
enabled: hasFileSelection |
|
1918 |
label: 'Truncate...' |
|
1919 |
itemValue: truncateSelectedFilesToZeroSize |
|
1920 |
) |
|
1921 |
(MenuItem |
|
1922 |
label: '-' |
|
1923 |
) |
|
1924 |
(MenuItem |
|
1925 |
label: 'Load Signature Support Package' |
|
1926 |
itemValue: loadSignatureSupport |
|
1927 |
isVisible: cannotGenerateSignatureFiles |
|
1928 |
) |
|
1929 |
(MenuItem |
|
1930 |
enabled: canGenerateSignatureFiles |
|
1931 |
label: 'Generate Signed Files' |
|
1932 |
itemValue: generateSignaturesForSelectedFiles |
|
1933 |
) |
|
1934 |
(MenuItem |
|
1935 |
enabled: canGenerateSignatureFiles |
|
1936 |
label: 'Generate Detached Signature Files (use for dll)' |
|
1937 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
1938 |
) |
|
1939 |
(MenuItem |
|
1940 |
enabled: canGenerateSignatureFiles |
|
1941 |
label: 'Generate Patch Installer for File(s)' |
|
1942 |
itemValue: generatePatchInstallerForSelectedFiles |
|
1943 |
) |
|
1944 |
(MenuItem |
|
1945 |
label: '-' |
|
1946 |
) |
|
1947 |
(MenuItem |
|
1948 |
enabled: hasFileSelection |
|
1949 |
label: 'File Differences' |
|
1950 |
itemValue: openDiffView |
|
1951 |
isVisible: hasTwoFilesSelectedHolder |
|
1952 |
) |
|
1953 |
(MenuItem |
|
1954 |
enabled: hasFileSelection |
|
1955 |
label: 'File Differences...' |
|
1956 |
itemValue: openDiffView |
|
1957 |
isVisible: hasNotTwoFilesSelectedHolder |
|
1958 |
) |
|
1959 |
(MenuItem |
|
1960 |
enabled: hasSelection |
|
1961 |
label: 'Directory Differences' |
|
1962 |
itemValue: openDirectoryDiffView |
|
1963 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
1964 |
) |
|
1965 |
(MenuItem |
|
1966 |
enabled: hasSelection |
|
1967 |
label: 'Directory Differences...' |
|
1968 |
itemValue: openDirectoryDiffView |
|
1969 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
1970 |
) |
|
1971 |
) |
|
1972 |
nil |
|
1973 |
nil |
|
1974 |
) |
|
1975 |
! |
|
1976 |
||
1977 |
newMenu |
|
1978 |
"This resource specification was automatically generated |
|
1979 |
by the MenuEditor of ST/X." |
|
1980 |
||
1981 |
"Do not manually edit this!! If it is corrupted, |
|
1982 |
the MenuEditor may not be able to read the specification." |
|
1983 |
||
1984 |
" |
|
1985 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
1986 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
1987 |
" |
|
1988 |
||
1989 |
<resource: #menu> |
|
1990 |
||
1991 |
^ |
|
1992 |
#(#Menu |
|
1993 |
#( |
|
1994 |
#(#MenuItem |
|
1995 |
#label: 'Directory...' |
|
1996 |
#translateLabel: true |
|
1997 |
#value: #newDirectory |
|
1998 |
) |
|
1999 |
#(#MenuItem |
|
2000 |
#label: 'File...' |
|
2001 |
#translateLabel: true |
|
2002 |
#value: #newFile |
|
2003 |
) |
|
2004 |
#(#MenuItem |
|
2005 |
#label: 'Hard Link...' |
|
2006 |
#translateLabel: true |
|
2007 |
#value: #newHardLink |
|
2008 |
) |
|
2009 |
#(#MenuItem |
|
2010 |
#label: 'Symbolic Link...' |
|
2011 |
#translateLabel: true |
|
2012 |
#value: #newSoftLink |
|
2013 |
) |
|
2014 |
) |
|
2015 |
nil |
|
2016 |
nil |
|
2017 |
) |
|
2018 |
! |
|
2019 |
||
2020 |
scmMenuSlice |
|
2021 |
"This resource specification was automatically generated |
|
2022 |
by the MenuEditor of ST/X." |
|
2023 |
||
2024 |
"Do not manually edit this!! If it is corrupted, |
|
2025 |
the MenuEditor may not be able to read the specification." |
|
2026 |
||
2027 |
||
2028 |
" |
|
2029 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2030 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2031 |
" |
|
2032 |
||
2033 |
<resource: #menu> |
|
2034 |
||
2035 |
^ |
|
2036 |
#(Menu |
|
2037 |
( |
|
2038 |
(MenuItem |
|
2039 |
label: 'CVS' |
|
2040 |
isVisible: cvsMenusAreShown |
|
2041 |
submenuChannel: cvsMenu |
|
2042 |
) |
|
2043 |
(MenuItem |
|
2044 |
label: 'SVN' |
|
2045 |
isVisible: svnMenusAreShown |
|
2046 |
submenuChannel: svnMenu |
|
2047 |
) |
|
2048 |
(MenuItem |
|
2049 |
label: 'Mercurial' |
|
2050 |
isVisible: mercurialMenusAreShown |
|
2051 |
submenuChannel: mercurialMenu |
|
2052 |
) |
|
2053 |
(MenuItem |
|
2054 |
label: 'HG' |
|
2055 |
isVisible: hgMenusAreShown |
|
2056 |
submenuChannel: hgMenu |
|
2057 |
) |
|
2058 |
(MenuItem |
|
2059 |
label: 'Perforce' |
|
2060 |
isVisible: perforceMenusAreShown |
|
2061 |
submenuChannel: perforceMenu |
|
2062 |
) |
|
2063 |
) |
|
2064 |
nil |
|
2065 |
nil |
|
2066 |
) |
|
2067 |
! |
|
2068 |
||
2069 |
showMenuSpec |
|
2070 |
"This resource specification was automatically generated |
|
2071 |
by the MenuEditor of ST/X." |
|
2072 |
||
2073 |
"Do not manually edit this!! If it is corrupted, |
|
2074 |
the MenuEditor may not be able to read the specification." |
|
2075 |
||
2076 |
" |
|
2077 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2078 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2079 |
" |
|
2080 |
||
2081 |
<resource: #menu> |
|
2082 |
||
2083 |
^ |
|
2084 |
#(Menu |
|
2085 |
( |
|
2086 |
(MenuItem |
|
2087 |
label: 'Hidden Files' |
|
2088 |
translateLabel: true |
|
2089 |
hideMenuOnActivated: false |
|
2090 |
indication: showHiddenFiles |
|
2091 |
) |
|
2092 |
(MenuItem |
|
2093 |
label: '-' |
|
2094 |
) |
|
2095 |
(MenuItem |
|
2096 |
label: 'Directory Tree' |
|
2097 |
translateLabel: true |
|
2098 |
hideMenuOnActivated: false |
|
2099 |
indication: showDirectoryTree |
|
2100 |
) |
|
2101 |
(MenuItem |
|
2102 |
label: 'Regular Files in TreeView (Left)' |
|
2103 |
translateLabel: true |
|
2104 |
hideMenuOnActivated: false |
|
2105 |
indication: viewFilesInDirectoryTree |
|
2106 |
) |
|
2107 |
(MenuItem |
|
2108 |
label: 'Directories in ContentsView (Right)' |
|
2109 |
translateLabel: true |
|
2110 |
hideMenuOnActivated: false |
|
2111 |
indication: viewDirsInContentsBrowser |
|
2112 |
) |
|
2113 |
(MenuItem |
|
2114 |
enabled: enableViewNoteBookApplication |
|
2115 |
label: 'File Applications' |
|
2116 |
translateLabel: true |
|
2117 |
hideMenuOnActivated: false |
|
2118 |
indication: viewNoteBookApplicationHolder |
|
2119 |
) |
|
2120 |
(MenuItem |
|
2121 |
label: '-' |
|
2122 |
) |
|
2123 |
(MenuItem |
|
2124 |
label: 'DiskUsage' |
|
2125 |
translateLabel: true |
|
2126 |
hideMenuOnActivated: false |
|
2127 |
indication: showDiskUsageHolder |
|
2128 |
) |
|
2129 |
) |
|
2130 |
nil |
|
2131 |
nil |
|
2132 |
) |
|
2133 |
! |
|
2134 |
||
2135 |
showMenuSpecForDialog |
|
2136 |
"This resource specification was automatically generated |
|
2137 |
by the MenuEditor of ST/X." |
|
2138 |
||
2139 |
"Do not manually edit this!! If it is corrupted, |
|
2140 |
the MenuEditor may not be able to read the specification." |
|
2141 |
||
2142 |
" |
|
2143 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2144 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2145 |
" |
|
2146 |
||
2147 |
<resource: #menu> |
|
2148 |
||
2149 |
^ |
|
2150 |
#(Menu |
|
2151 |
( |
|
2152 |
(MenuItem |
|
2153 |
label: 'Hidden Files' |
|
2154 |
translateLabel: true |
|
2155 |
hideMenuOnActivated: false |
|
2156 |
indication: showHiddenFiles |
|
2157 |
) |
|
2158 |
) |
|
2159 |
nil |
|
2160 |
nil |
|
2161 |
) |
|
2162 |
! |
|
2163 |
||
2164 |
sortMenu |
|
2165 |
"This resource specification was automatically generated |
|
2166 |
by the MenuEditor of ST/X." |
|
2167 |
||
2168 |
"Do not manually edit this!! If it is corrupted, |
|
2169 |
the MenuEditor may not be able to read the specification." |
|
2170 |
||
2171 |
" |
|
2172 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2173 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2174 |
" |
|
2175 |
||
2176 |
<resource: #menu> |
|
2177 |
||
2178 |
^ |
|
2179 |
#(#Menu |
|
2180 |
#( |
|
2181 |
#(#MenuItem |
|
2182 |
#label: 'By Filename' |
|
2183 |
#translateLabel: true |
|
2184 |
#hideMenuOnActivated: false |
|
2185 |
#choice: #sortBlockProperty |
|
2186 |
#choiceValue: #baseName |
|
2187 |
) |
|
2188 |
#(#MenuItem |
|
2189 |
#label: 'By Extension' |
|
2190 |
#translateLabel: true |
|
2191 |
#hideMenuOnActivated: false |
|
2192 |
#choice: #sortBlockProperty |
|
2193 |
#choiceValue: #suffix |
|
2194 |
) |
|
2195 |
#(#MenuItem |
|
2196 |
#label: 'By Permissions' |
|
2197 |
#translateLabel: true |
|
2198 |
#hideMenuOnActivated: false |
|
2199 |
#choice: #sortBlockProperty |
|
2200 |
#choiceValue: #permissions |
|
2201 |
) |
|
2202 |
#(#MenuItem |
|
2203 |
#label: 'By Owner' |
|
2204 |
#translateLabel: true |
|
2205 |
#isVisible: #viewOwner |
|
2206 |
#hideMenuOnActivated: false |
|
2207 |
#choice: #sortBlockProperty |
|
2208 |
#choiceValue: #owner |
|
2209 |
) |
|
2210 |
#(#MenuItem |
|
2211 |
#label: 'By Group' |
|
2212 |
#translateLabel: true |
|
2213 |
#isVisible: #viewOwner |
|
2214 |
#hideMenuOnActivated: false |
|
2215 |
#choice: #sortBlockProperty |
|
2216 |
#choiceValue: #group |
|
2217 |
) |
|
2218 |
#(#MenuItem |
|
2219 |
#label: 'By Size' |
|
2220 |
#translateLabel: true |
|
2221 |
#hideMenuOnActivated: false |
|
2222 |
#choice: #sortBlockProperty |
|
2223 |
#choiceValue: #fileSize |
|
2224 |
) |
|
2225 |
#(#MenuItem |
|
2226 |
#label: 'By Date && Time' |
|
2227 |
#translateLabel: true |
|
2228 |
#hideMenuOnActivated: false |
|
2229 |
#choice: #sortBlockProperty |
|
2230 |
#choiceValue: #modificationTime |
|
2231 |
) |
|
2232 |
#(#MenuItem |
|
2233 |
#label: '-' |
|
2234 |
) |
|
2235 |
#(#MenuItem |
|
2236 |
#label: 'Ignore Case in Sort' |
|
2237 |
#translateLabel: true |
|
2238 |
#hideMenuOnActivated: false |
|
2239 |
#indication: #sortCaseless |
|
2240 |
) |
|
2241 |
#(#MenuItem |
|
2242 |
#label: 'Directories before Files' |
|
2243 |
#translateLabel: true |
|
2244 |
#hideMenuOnActivated: false |
|
2245 |
#indication: #sortDirectoriesBeforeFiles |
|
2246 |
) |
|
2247 |
) |
|
2248 |
nil |
|
2249 |
nil |
|
2250 |
) |
|
2251 |
! |
|
2252 |
||
2253 |
toolsMenuSpec |
|
2254 |
"This resource specification was automatically generated |
|
2255 |
by the MenuEditor of ST/X." |
|
2256 |
||
2257 |
"Do not manually edit this!! If it is corrupted, |
|
2258 |
the MenuEditor may not be able to read the specification." |
|
2259 |
||
2260 |
||
2261 |
" |
|
2262 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2263 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2264 |
" |
|
2265 |
||
2266 |
<resource: #menu> |
|
2267 |
||
2268 |
^ |
|
2269 |
#(Menu |
|
2270 |
( |
|
2271 |
(MenuItem |
|
2272 |
label: 'Open (Win32-Shell)' |
|
2273 |
itemValue: doOpenWithShellCommand |
|
2274 |
isVisible: systemIsDOS |
|
2275 |
) |
|
2276 |
(MenuItem |
|
2277 |
label: 'Execute UNIX Command...' |
|
2278 |
itemValue: doExecuteCommand |
|
2279 |
isVisible: systemIsUnix |
|
2280 |
) |
|
2281 |
(MenuItem |
|
2282 |
label: 'Execute DOS Command...' |
|
2283 |
itemValue: doExecuteCommand |
|
2284 |
isVisible: systemIsDOS |
|
2285 |
) |
|
2286 |
(MenuItem |
|
2287 |
label: 'Execute Script...' |
|
2288 |
itemValue: doExecuteScript |
|
2289 |
) |
|
2290 |
(MenuItem |
|
2291 |
enabled: canDoTerminal |
|
2292 |
label: 'Shell Terminal' |
|
2293 |
itemValue: openTerminal |
|
2294 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2295 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2296 |
) |
|
2297 |
(MenuItem |
|
2298 |
enabled: canDoTerminal |
|
2299 |
label: 'DOS Terminal' |
|
2300 |
itemValue: openTerminal |
|
2301 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2302 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2303 |
) |
|
2304 |
(MenuItem |
|
2305 |
label: '-' |
|
2306 |
) |
|
2307 |
(MenuItem |
|
2308 |
enabled: hasFileSelection |
|
2309 |
label: 'Changes Browser' |
|
2310 |
itemValue: openChangesBrowser |
|
2311 |
) |
|
2312 |
(MenuItem |
|
2313 |
enabled: hasFileSelection |
|
2314 |
label: 'ChangeSet Browser' |
|
2315 |
itemValue: openChangeSetBrowser |
|
2316 |
isVisible: changeSetBrowserItemVisible |
|
2317 |
) |
|
2318 |
(MenuItem |
|
2319 |
enabled: hasFileSelection |
|
2320 |
label: 'Workspace' |
|
2321 |
itemValue: openWorkspace |
|
2322 |
) |
|
2323 |
(MenuItem |
|
2324 |
label: '-' |
|
2325 |
) |
|
2326 |
(MenuItem |
|
2327 |
enabled: canReadAbbrevFile |
|
2328 |
label: 'Install Autoloaded' |
|
2329 |
itemValue: readAbbrevFile |
|
2330 |
) |
|
2331 |
(MenuItem |
|
2332 |
enabled: anySTFilesPresent |
|
2333 |
label: 'Install all ST-Files as Autoloaded' |
|
2334 |
itemValue: installAllAsAutoloaded |
|
2335 |
) |
|
2336 |
(MenuItem |
|
2337 |
enabled: recursiveAnySTFilesPresent |
|
2338 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2339 |
itemValue: installAllAsAutoloadedRecursive |
|
2340 |
) |
|
2341 |
(MenuItem |
|
2342 |
label: '-' |
|
2343 |
) |
|
2344 |
(MenuItem |
|
2345 |
enabled: hasJava |
|
2346 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2347 |
itemValue: addDirToJavaSourcePath |
|
2348 |
) |
|
2349 |
(MenuItem |
|
2350 |
enabled: hasJava |
|
2351 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2352 |
itemValue: fileAddToJavaSourcePath |
|
2353 |
) |
|
2354 |
(MenuItem |
|
2355 |
label: '-' |
|
2356 |
) |
|
2357 |
(MenuItem |
|
2358 |
label: 'File Operations' |
|
2359 |
submenuChannel: fileOpMenu |
|
2360 |
) |
|
2361 |
(MenuItem |
|
2362 |
label: 'File Utilities' |
|
2363 |
submenu: |
|
2364 |
(Menu |
|
2365 |
( |
|
2366 |
(MenuItem |
|
2367 |
enabled: hasFileSelection |
|
2368 |
label: 'Editor' |
|
2369 |
itemValue: openEditor |
|
2370 |
) |
|
2371 |
(MenuItem |
|
2372 |
enabled: hasFileSelection |
|
2373 |
label: 'HTML Reader' |
|
2374 |
itemValue: openHTMLReader |
|
2375 |
) |
|
2376 |
(MenuItem |
|
2377 |
enabled: hasFileSelection |
|
2378 |
label: 'Web Browser' |
|
2379 |
itemValue: openWebBrowser |
|
2380 |
) |
|
2381 |
(MenuItem |
|
2382 |
label: 'XML Inspector' |
|
2383 |
itemValue: inspectXmlFile |
|
2384 |
isVisible: hasXml |
|
2385 |
showBusyCursorWhilePerforming: true |
|
2386 |
) |
|
2387 |
(MenuItem |
|
2388 |
enabled: hasFileSelection |
|
2389 |
label: 'Acroread (PDF Viewer)' |
|
2390 |
itemValue: openPDFViewer |
|
2391 |
) |
|
2392 |
(MenuItem |
|
2393 |
enabled: hasASN1AndSelection |
|
2394 |
label: 'ASN1 Browser' |
|
2395 |
itemValue: openASN1Browser |
|
2396 |
isVisible: hasASN1 |
|
2397 |
) |
|
2398 |
(MenuItem |
|
2399 |
enabled: hasCBrowser |
|
2400 |
label: 'C Browser' |
|
2401 |
itemValue: openCBrowser |
|
2402 |
isVisible: hasCBrowser |
|
2403 |
) |
|
2404 |
(MenuItem |
|
2405 |
enabled: canOpenMonticelloBrowser |
|
2406 |
label: 'Monticello Browser' |
|
2407 |
itemValue: doOpenMonticelloBrowser |
|
2408 |
) |
|
2409 |
(MenuItem |
|
2410 |
enabled: hasJavaAndSelection |
|
2411 |
label: 'Applet Viewer' |
|
2412 |
itemValue: openAppletViewer |
|
2413 |
isVisible: hasJava |
|
2414 |
) |
|
2415 |
(MenuItem |
|
2416 |
enabled: hasMP3PlayerAndSelection |
|
2417 |
label: 'MP3 Player' |
|
2418 |
itemValue: openMP3Player |
|
2419 |
isVisible: hasMP3Player |
|
2420 |
) |
|
2421 |
(MenuItem |
|
2422 |
enabled: hasFileSelection |
|
2423 |
label: 'xv (Image Viewer)' |
|
2424 |
itemValue: openXV |
|
2425 |
isVisible: systemIsUnix |
|
2426 |
) |
|
2427 |
(MenuItem |
|
2428 |
enabled: currentFilesAreInSameDirectory |
|
2429 |
label: 'Slide Show' |
|
2430 |
itemValue: openSlideShow |
|
2431 |
isVisible: hasSlideShow |
|
2432 |
) |
|
2433 |
(MenuItem |
|
2434 |
enabled: hasFileSelection |
|
2435 |
label: 'gv (Postscript Viewer)' |
|
2436 |
itemValue: openGV |
|
2437 |
isVisible: systemIsUnix |
|
2438 |
) |
|
2439 |
(MenuItem |
|
2440 |
enabled: hasMP3PlayerAndSelection |
|
2441 |
label: 'MP3 Player' |
|
2442 |
itemValue: openMP3Player |
|
2443 |
isVisible: hasMP3Player |
|
2444 |
) |
|
2445 |
(MenuItem |
|
2446 |
enabled: hasFileSelection |
|
2447 |
label: 'Realplay (avi viewer)' |
|
2448 |
itemValue: openRP |
|
2449 |
isVisible: systemIsUnix |
|
2450 |
) |
|
2451 |
(MenuItem |
|
2452 |
label: '-' |
|
2453 |
) |
|
2454 |
(MenuItem |
|
2455 |
label: 'Smalltalk' |
|
2456 |
submenu: |
|
2457 |
(Menu |
|
2458 |
( |
|
2459 |
(MenuItem |
|
2460 |
enabled: hasSnapshotSelection |
|
2461 |
label: 'Snapshot Image Browser' |
|
2462 |
itemValue: openSnapshotImageBrowser |
|
2463 |
) |
|
2464 |
(MenuItem |
|
2465 |
enabled: canCreateNewProject |
|
2466 |
label: 'Create Smalltalk Project' |
|
2467 |
itemValue: createProjectAndOpenProjectBrowser |
|
2468 |
) |
|
2469 |
(MenuItem |
|
2470 |
label: '-' |
|
2471 |
) |
|
2472 |
(MenuItem |
|
2473 |
enabled: hasResourceFileSelected |
|
2474 |
label: 'Show Contents of Resourcefile' |
|
2475 |
itemValue: readAndShowResources |
|
2476 |
) |
|
2477 |
(MenuItem |
|
2478 |
enabled: hasResourceFileSelected |
|
2479 |
label: 'Resource File Editor' |
|
2480 |
itemValue: openResourceFileEditor |
|
2481 |
showBusyCursorWhilePerforming: true |
|
2482 |
) |
|
2483 |
(MenuItem |
|
2484 |
label: '-' |
|
2485 |
) |
|
2486 |
(MenuItem |
|
2487 |
enabled: hasFileSelection |
|
2488 |
label: 'Contents as ByteArray' |
|
2489 |
itemValue: fileContentsAsByteArray |
|
2490 |
) |
|
2491 |
) |
|
2492 |
nil |
|
2493 |
nil |
|
2494 |
) |
|
2495 |
) |
|
2496 |
(MenuItem |
|
2497 |
label: 'Image' |
|
2498 |
submenu: |
|
2499 |
(Menu |
|
2500 |
( |
|
2501 |
(MenuItem |
|
2502 |
enabled: hasFileSelection |
|
2503 |
label: 'Image Editor' |
|
2504 |
itemValue: openImageEditor |
|
2505 |
) |
|
2506 |
(MenuItem |
|
2507 |
enabled: hasFileSelection |
|
2508 |
label: 'Image Preview' |
|
2509 |
itemValue: openImagePreview |
|
2510 |
) |
|
2511 |
(MenuItem |
|
2512 |
enabled: hasFileSelection |
|
2513 |
label: 'Image Inspector' |
|
2514 |
itemValue: openImageInspector |
|
2515 |
) |
|
2516 |
(MenuItem |
|
2517 |
label: '-' |
|
2518 |
) |
|
2519 |
(MenuItem |
|
2520 |
enabled: hasFileSelection |
|
2521 |
label: 'Convert to GIF' |
|
2522 |
itemValue: convertImageToGIF |
|
2523 |
) |
|
2524 |
(MenuItem |
|
2525 |
enabled: hasFileSelection |
|
2526 |
label: 'Convert to PNG' |
|
2527 |
itemValue: convertImageToPNG |
|
2528 |
) |
|
2529 |
(MenuItem |
|
2530 |
enabled: hasFileSelection |
|
2531 |
label: 'Convert to XPM' |
|
2532 |
itemValue: convertImageToXPM |
|
2533 |
) |
|
2534 |
(MenuItem |
|
2535 |
enabled: hasFileSelection |
|
2536 |
label: 'Convert to JPG' |
|
2537 |
itemValue: convertImageToJPG |
|
2538 |
) |
|
2539 |
) |
|
2540 |
nil |
|
2541 |
nil |
|
2542 |
) |
|
2543 |
) |
|
2544 |
(MenuItem |
|
15528 | 2545 |
label: 'Web' |
2546 |
submenu: |
|
2547 |
(Menu |
|
2548 |
( |
|
2549 |
(MenuItem |
|
2550 |
label: 'Fetch File by URL...' |
|
2551 |
itemValue: fetchFileByURL |
|
2552 |
) |
|
2553 |
) |
|
2554 |
nil |
|
2555 |
nil |
|
2556 |
) |
|
2557 |
) |
|
2558 |
(MenuItem |
|
15211 | 2559 |
enabled: hasZipFileSelectedHolder |
2560 |
label: 'ZipFile Tool' |
|
2561 |
itemValue: openZipTool |
|
2562 |
) |
|
2563 |
(MenuItem |
|
2564 |
enabled: hasFileSelection |
|
2565 |
label: 'Hex Dump' |
|
2566 |
itemValue: fileHexDump |
|
2567 |
) |
|
2568 |
) |
|
2569 |
nil |
|
2570 |
nil |
|
2571 |
) |
|
2572 |
) |
|
2573 |
(MenuItem |
|
2574 |
label: 'Find' |
|
2575 |
submenu: |
|
2576 |
(Menu |
|
2577 |
( |
|
2578 |
(MenuItem |
|
2579 |
label: 'File...' |
|
2580 |
itemValue: fileFindFile |
|
2581 |
) |
|
2582 |
(MenuItem |
|
2583 |
enabled: hasFileSelection |
|
2584 |
label: 'Same Contents as Selected...' |
|
2585 |
itemValue: fileFindDuplicateFile |
|
2586 |
) |
|
2587 |
(MenuItem |
|
2588 |
label: 'Duplicate Files' |
|
2589 |
itemValue: fileFindDuplicates |
|
2590 |
) |
|
2591 |
(MenuItem |
|
2592 |
enabled: hasSelection |
|
2593 |
label: 'All Duplicate Files (Recursive)' |
|
2594 |
itemValue: fileFindAllDuplicates |
|
2595 |
) |
|
2596 |
(MenuItem |
|
17686 | 2597 |
label: 'Similar Image Files (by Colors)' |
15211 | 2598 |
itemValue: fileFindSimilarImages |
2599 |
isVisible: hasImageColorHistogram |
|
2600 |
) |
|
17686 | 2601 |
(MenuItem |
2602 |
label: 'Similar Image Files (by Form)' |
|
2603 |
itemValue: fileFindSimilarImagesByForm |
|
2604 |
isVisible: hasImageHistogram |
|
2605 |
) |
|
15211 | 2606 |
) |
2607 |
nil |
|
2608 |
nil |
|
2609 |
) |
|
2610 |
) |
|
2611 |
) |
|
2612 |
nil |
|
2613 |
nil |
|
2614 |
) |
|
17686 | 2615 |
|
2616 |
"Modified: / 10-09-2017 / 16:50:09 / cg" |
|
15211 | 2617 |
! |
2618 |
||
2619 |
viewDetailsMenuSpec |
|
2620 |
"This resource specification was automatically generated |
|
2621 |
by the MenuEditor of ST/X." |
|
2622 |
||
2623 |
"Do not manually edit this!! If it is corrupted, |
|
2624 |
the MenuEditor may not be able to read the specification." |
|
2625 |
||
2626 |
" |
|
2627 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2628 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2629 |
" |
|
2630 |
||
2631 |
<resource: #menu> |
|
2632 |
||
2633 |
^ |
|
2634 |
#(#Menu |
|
2635 |
#( |
|
2636 |
#(#MenuItem |
|
2637 |
#label: '-' |
|
2638 |
) |
|
2639 |
#(#MenuItem |
|
2640 |
#label: 'Hidden Files' |
|
2641 |
#translateLabel: true |
|
2642 |
#indication: #showHiddenFiles |
|
2643 |
) |
|
2644 |
) |
|
2645 |
nil |
|
2646 |
nil |
|
2647 |
) |
|
2648 |
! ! |
|
3892 | 2649 |
|
11144 | 2650 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2651 |
||
15211 | 2652 |
cvsMenu |
2653 |
"This resource specification was automatically generated |
|
2654 |
by the MenuEditor of ST/X." |
|
2655 |
||
2656 |
"Do not manually edit this!! If it is corrupted, |
|
2657 |
the MenuEditor may not be able to read the specification." |
|
2658 |
||
2659 |
||
2660 |
" |
|
2661 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2662 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2663 |
" |
|
2664 |
||
2665 |
<resource: #menu> |
|
2666 |
||
2667 |
^ |
|
2668 |
#(Menu |
|
2669 |
( |
|
2670 |
(MenuItem |
|
2671 |
label: 'Commit (CVS)...' |
|
2672 |
itemValue: cvsCommit |
|
2673 |
translateLabel: true |
|
2674 |
) |
|
2675 |
(MenuItem |
|
2676 |
enabled: canCvsAddAndCommit |
|
2677 |
label: 'Add && Commit...' |
|
2678 |
itemValue: cvsAddAndCommit |
|
2679 |
translateLabel: true |
|
2680 |
) |
|
2681 |
(MenuItem |
|
2682 |
enabled: canCvsAddAndCommit |
|
2683 |
label: 'Add as Binary && Commit...' |
|
2684 |
itemValue: cvsAddBinaryAndCommit |
|
2685 |
translateLabel: true |
|
2686 |
) |
|
2687 |
(MenuItem |
|
2688 |
label: 'Commit Folder (CVS)...' |
|
2689 |
itemValue: cvsCommitFolder |
|
2690 |
translateLabel: true |
|
2691 |
) |
|
2692 |
(MenuItem |
|
2693 |
label: '-' |
|
2694 |
) |
|
2695 |
(MenuItem |
|
2696 |
enabled: hasSelection |
|
2697 |
label: 'Update selected Files/Directories' |
|
2698 |
itemValue: cvsUpdateSelection |
|
2699 |
translateLabel: true |
|
2700 |
) |
|
2701 |
(MenuItem |
|
2702 |
label: 'Update Directory Local' |
|
2703 |
itemValue: cvsUpdateAll |
|
2704 |
translateLabel: true |
|
2705 |
) |
|
2706 |
(MenuItem |
|
2707 |
label: 'Update Directory Recursive' |
|
2708 |
itemValue: cvsUpdateAllRecursive |
|
2709 |
translateLabel: true |
|
2710 |
) |
|
2711 |
(MenuItem |
|
2712 |
label: '-' |
|
2713 |
) |
|
2714 |
(MenuItem |
|
2715 |
enabled: hasSelection |
|
2716 |
label: 'Tag...' |
|
2717 |
itemValue: cvsTagSelection |
|
2718 |
translateLabel: true |
|
2719 |
) |
|
2720 |
(MenuItem |
|
2721 |
enabled: hasSelection |
|
2722 |
label: 'Revision Log' |
|
2723 |
itemValue: cvsRevisionLog |
|
2724 |
translateLabel: true |
|
2725 |
) |
|
2726 |
(MenuItem |
|
2727 |
enabled: hasSelection |
|
2728 |
label: 'Compare with newest in Repository' |
|
2729 |
itemValue: cvsCompareWithNewest |
|
2730 |
translateLabel: true |
|
2731 |
) |
|
2732 |
(MenuItem |
|
2733 |
label: '-' |
|
2734 |
) |
|
2735 |
(MenuItem |
|
2736 |
enabled: canRemoveCVSContainer |
|
2737 |
label: 'Remove File && CVS Container...' |
|
2738 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2739 |
translateLabel: true |
|
2740 |
) |
|
2741 |
) |
|
2742 |
nil |
|
2743 |
nil |
|
2744 |
) |
|
2745 |
! |
|
2746 |
||
2747 |
mercurialMenu |
|
2748 |
"This resource specification was automatically generated |
|
2749 |
by the MenuEditor of ST/X." |
|
2750 |
||
2751 |
"Do not manually edit this!! If it is corrupted, |
|
2752 |
the MenuEditor may not be able to read the specification." |
|
2753 |
||
2754 |
||
2755 |
" |
|
2756 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2757 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2758 |
" |
|
2759 |
||
2760 |
<resource: #menu> |
|
2761 |
||
2762 |
^ |
|
2763 |
#(Menu |
|
2764 |
( |
|
2765 |
(MenuItem |
|
2766 |
label: 'Add' |
|
2767 |
itemValue: mercurialAdd |
|
2768 |
translateLabel: true |
|
2769 |
) |
|
2770 |
(MenuItem |
|
2771 |
label: 'Commit Changes' |
|
2772 |
itemValue: mercurialCommit |
|
2773 |
translateLabel: true |
|
2774 |
) |
|
2775 |
(MenuItem |
|
2776 |
label: 'Push...' |
|
2777 |
itemValue: mercurialPush |
|
2778 |
translateLabel: true |
|
2779 |
) |
|
2780 |
(MenuItem |
|
2781 |
label: 'Status' |
|
2782 |
itemValue: mercurialStatus |
|
2783 |
translateLabel: true |
|
2784 |
) |
|
2785 |
(MenuItem |
|
2786 |
label: '-' |
|
2787 |
) |
|
2788 |
(MenuItem |
|
2789 |
label: 'Init' |
|
2790 |
itemValue: mercurialInit |
|
2791 |
translateLabel: true |
|
2792 |
) |
|
2793 |
) |
|
2794 |
nil |
|
2795 |
nil |
|
2796 |
) |
|
2797 |
||
2798 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2799 |
! |
|
2800 |
||
2801 |
perforceMenu |
|
2802 |
"This resource specification was automatically generated |
|
2803 |
by the MenuEditor of ST/X." |
|
2804 |
||
2805 |
"Do not manually edit this!! If it is corrupted, |
|
2806 |
the MenuEditor may not be able to read the specification." |
|
2807 |
||
2808 |
||
2809 |
" |
|
2810 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2811 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2812 |
" |
|
2813 |
||
2814 |
<resource: #menu> |
|
2815 |
||
2816 |
^ |
|
2817 |
#(Menu |
|
2818 |
( |
|
2819 |
(MenuItem |
|
2820 |
label: 'Commit' |
|
2821 |
itemValue: perforceCommit |
|
2822 |
translateLabel: true |
|
2823 |
) |
|
2824 |
) |
|
2825 |
nil |
|
2826 |
nil |
|
2827 |
) |
|
2828 |
||
2829 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2830 |
! ! |
|
11144 | 2831 |
|
3892 | 2832 |
!AbstractFileBrowser class methodsFor:'misc'! |
2833 |
||
2834 |
newLock |
|
2835 |
^ CodeExecutionLock new |
|
2836 |
! ! |
|
2837 |
||
17288 | 2838 |
!AbstractFileBrowser class methodsFor:'queries'! |
2839 |
||
2840 |
isAbstract |
|
2841 |
^ self == AbstractFileBrowser |
|
2842 |
! ! |
|
2843 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2844 |
!AbstractFileBrowser class methodsFor:'resources'! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2845 |
|
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2846 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2847 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2848 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2849 |
|
17746 | 2850 |
!AbstractFileBrowser class methodsFor:'utilities - dump'! |
4610 | 2851 |
|
17744 | 2852 |
contentsOfBytesAsDump:data base:numberBase numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
2853 |
"utility helper: generate a hexDump with addresses; |
|
2854 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2855 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2856 |
to support display of alien encoded binary data." |
|
2857 |
||
2858 |
|lines nHexLines replacementForUnprintable colsPerByte characterDecoder| |
|
2859 |
||
2860 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
2861 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
2862 |
]. |
|
17252 | 2863 |
|
2864 |
"/ used to be: |
|
2865 |
"/ replacementForUnprintable := $. |
|
2866 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2867 |
|
17744 | 2868 |
"/ cols needed per byte in the hex dump |
2869 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
2870 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2871 |
"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
|
2872 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2873 |
nHexLines := (data size + 15) // 16. |
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 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2876 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2877 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2878 |
generator:[:lineNr | |
17744 | 2879 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
2880 |
decodedChar charPrinted| |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2881 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2882 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2883 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2884 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2885 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2886 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2887 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2888 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 2889 |
|
2890 |
"/ two streams; one for the hex bytes, one for the ascii-interpretation |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2891 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2892 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2893 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2894 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2895 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2896 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2897 |
i ~~ 1 ifTrue:[ lineStream space ]. |
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 |
(startOffset + i) > data size ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2900 |
asciiLineStream nextPut:(Character space). |
17744 | 2901 |
lineStream spaces:colsPerByte. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2902 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2903 |
byte := data at:startOffset + i. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2904 |
|
17746 | 2905 |
lineStream nextPutAll:(byte printStringRadix:numberBase size:colsPerByte fill:$0). |
17744 | 2906 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2907 |
|
17744 | 2908 |
decodedChar := byte. |
2909 |
characterDecoder notNil ifTrue:[ |
|
2910 |
decodedChar := characterDecoder encode:byte. |
|
2911 |
]. |
|
2912 |
||
2913 |
charPrinted := replacementForUnprintable. |
|
2914 |
decodedChar notNil ifTrue:[ |
|
2915 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
2916 |
charPrinted := Character value:decodedChar. |
|
16188 | 2917 |
] ifFalse:[ |
17744 | 2918 |
(decodedChar between:0 and:31) ifTrue:[ |
2919 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
2920 |
"/ are perfect here, but usually not available in the font |
|
2921 |
"/ and we have currently no way of knowing if they are... |
|
2922 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
2923 |
"/ For now, write a dot.· |
|
2924 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
|
2925 |
]. |
|
16188 | 2926 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2927 |
]. |
17744 | 2928 |
asciiLineStream nextPut:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2929 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2930 |
]. |
17744 | 2931 |
line := (lineStream contents paddedTo:(addrDigits + 1 + ((colsPerByte+1)*16) + 6)) |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2932 |
, asciiLineStream contents. |
11262 | 2933 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2934 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2935 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2936 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2937 |
|
17744 | 2938 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 2939 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
17744 | 2940 |
! |
2941 |
||
17753 | 2942 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart |
17744 | 2943 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
2944 |
the iso8859-1 characters" |
|
17753 | 2945 |
|
2946 |
^ self |
|
17744 | 2947 |
contentsOfBytesAsDump:data base:16 |
2948 |
numberOfAddressDigits:addrDigits |
|
2949 |
addressStart:virtualStart |
|
17753 | 2950 |
characterEncoding:#'iso8859-1' |
11262 | 2951 |
|
2952 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 2953 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 2954 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
17744 | 2955 |
! |
2956 |
||
2957 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
2958 |
"utility helper: generate a hexDump with addresses; |
|
2959 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2960 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2961 |
to support display of alien encoded binary data." |
|
2962 |
||
2963 |
^ self |
|
2964 |
contentsOfBytesAsDump:data base:16 |
|
2965 |
numberOfAddressDigits:addrDigits |
|
2966 |
addressStart:virtualStart |
|
2967 |
characterEncoding:characterEncodingSymbol |
|
2968 |
||
2969 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
2970 |
! |
|
2971 |
||
2972 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
2973 |
"opens the file, get its contents and generates a dump for it" |
|
2974 |
||
4610 | 2975 |
|resources fileName stream data offs |
17744 | 2976 |
addrDigits lines answer sizeLimit showLastPart| |
4610 | 2977 |
|
2978 |
resources := self classResources. |
|
2979 |
||
2980 |
fileName := f baseName. |
|
2981 |
f isDirectory ifTrue:[ |
|
2982 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
2983 |
^ nil |
|
2984 |
]. |
|
2985 |
f exists ifFalse:[ |
|
2986 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2987 |
^ nil |
|
2988 |
]. |
|
2989 |
f isReadable ifFalse:[ |
|
2990 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
2991 |
^ nil |
|
2992 |
]. |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
2993 |
f fileSize > (1024*1024) ifTrue:[ |
8472 | 2994 |
limitOrNil notNil ifTrue:[ |
2995 |
sizeLimit := limitOrNil. |
|
2996 |
showLastPart := showLastPartOrNil |
|
2997 |
] ifFalse:[ |
|
2998 |
answer := Dialog |
|
2999 |
confirmWithCancel:(resources |
|
3000 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3001 |
with:(fileName contractTo:40) allBold |
|
3002 |
with:(UnitConverter fileSizeStringFor:f fileSize)) |
|
3003 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3004 |
||
3005 |
answer isNil ifTrue:[^ nil]. |
|
3006 |
answer ifTrue:[ |
|
3007 |
sizeLimit := 4 * 1024 * 1024 |
|
3008 |
]. |
|
8436 | 3009 |
]. |
4610 | 3010 |
]. |
3011 |
||
3012 |
stream := f readStream binary. |
|
8436 | 3013 |
sizeLimit notNil ifTrue:[ |
8472 | 3014 |
showLastPart == true ifTrue:[ |
3015 |
stream position:(f fileSize - sizeLimit). |
|
3016 |
]. |
|
8436 | 3017 |
data := stream nextBytes:sizeLimit. |
3018 |
] ifFalse:[ |
|
3019 |
data := stream contents. |
|
3020 |
]. |
|
4610 | 3021 |
stream close. |
3022 |
||
3023 |
offs := 0. |
|
3024 |
lines := StringCollection new. |
|
3025 |
||
3026 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3027 |
||
11262 | 3028 |
^ self |
17744 | 3029 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3030 |
numberOfAddressDigits:addrDigits |
3031 |
addressStart:0 |
|
17744 | 3032 |
characterEncoding:characterEncoding |
3033 |
||
3034 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
3035 |
! |
|
3036 |
||
3037 |
contentsOfFileAsHexDump:f |
|
3038 |
"opens the file, get its contents and generates a dump for it" |
|
3039 |
||
3040 |
^ self |
|
3041 |
contentsOfFileAsHexDump:f |
|
3042 |
withLimit:nil |
|
3043 |
lastPart:nil |
|
3044 |
characterEncoding:#'iso8859-1' |
|
3045 |
||
3046 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3047 |
! |
|
3048 |
||
3049 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3050 |
"opens the file, get its contents and generates a dump for it" |
|
3051 |
||
3052 |
^ self |
|
3053 |
contentsOfFileAsHexDump:f |
|
3054 |
withLimit:limitOrNil |
|
3055 |
lastPart:showLastPartOrNil |
|
3056 |
characterEncoding:#'iso-8859-1' |
|
3057 |
||
3058 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3059 |
! |
|
3060 |
||
3061 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3062 |
"opens the file, get its contents and generates a dump for it" |
|
3063 |
||
3064 |
^ self |
|
3065 |
contentsOfFileAsDump:f base:16 |
|
3066 |
withLimit:limitOrNil |
|
3067 |
lastPart:showLastPartOrNil |
|
3068 |
characterEncoding:characterEncoding |
|
3069 |
||
3070 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3071 |
! ! |
3072 |
||
3892 | 3073 |
!AbstractFileBrowser methodsFor:'actions'! |
3074 |
||
3075 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3076 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3077 |
Then evaluate aBlock passing the command-string as argument." |
3078 |
||
16160 | 3079 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3080 |
|
3081 |
osName := OperatingSystem platformName. |
|
3082 |
||
3083 |
box := FilenameEnterBox |
|
4414 | 3084 |
title:(resources string:'Execute %1 command:' with:osName) |
3085 |
okText:(resources string:'Execute') |
|
4523 | 3086 |
action:[:cmd | commandString := cmd]. |
3892 | 3087 |
|
3088 |
fileName notNil ifTrue:[ |
|
4414 | 3089 |
self initialCommandFor:fileName into:box. |
3892 | 3090 |
]. |
16160 | 3091 |
alwaysOpenLikeThisHolder := false asValue. |
3092 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3093 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3094 |
box open. |
3095 |
||
3096 |
"/ box destroy. |
|
3097 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3098 |
openCmd := commandString upTo:$". |
|
3099 |
suffix := fileName suffix. |
|
16306 | 3100 |
UserPreferences current |
3101 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3102 |
beModified. |
|
3103 |
self breakPoint:#cg. |
|
16160 | 3104 |
]. |
3105 |
||
4523 | 3106 |
commandString notNil ifTrue:[ |
3107 |
aBlock value:commandString |
|
3108 |
]. |
|
3109 |
||
3892 | 3110 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3111 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3112 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3113 |
! |
|
3114 |
||
3115 |
changeFileBrowserTitleTo:aString |
|
4774 | 3116 |
self |
3117 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3118 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3119 |
! |
3120 |
||
3121 |
copyFileList |
|
4774 | 3122 |
"copy the fileList to the clipBoard" |
3123 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3124 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3125 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3126 |
fileList := self |
4774 | 3127 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3128 |
ifPresentDo:[:app | app browserFileList]. |
3129 |
||
3130 |
fileList notNil ifTrue:[ |
|
3131 |
self copyFileListToClipBoard:fileList. |
|
3132 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3133 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3134 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3135 |
copyFileListToClipBoard:fileList |
4774 | 3136 |
"copy the itemList to the clipBoard" |
3137 |
||
3138 |
|stream| |
|
3139 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3140 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3141 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3142 |
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
|
3143 |
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
|
3144 |
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
|
3145 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3146 |
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
|
3147 |
(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
|
3148 |
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
|
3149 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3150 |
]. |
3892 | 3151 |
]. |
6034 | 3152 |
self window setClipboardText:stream contents. |
3892 | 3153 |
! |
3154 |
||
3155 |
copySelectedFilenames |
|
4774 | 3156 |
"copy the selected fileNames to the clipBoard" |
3157 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3158 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3159 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3160 |
fileList := self |
4774 | 3161 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3162 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3163 |
fileList notNil ifTrue:[ |
|
3164 |
self copyFileListToClipBoard:fileList. |
|
3165 |
]. |
|
3892 | 3166 |
! |
3167 |
||
10923 | 3168 |
doAddArchiver |
3169 |
|files| |
|
3170 |
||
3171 |
files := self currentSelectedFiles. |
|
3172 |
files size == 1 ifFalse:[ |
|
3173 |
Dialog information:'Select exactly one archive.'. |
|
3174 |
^ self |
|
3175 |
]. |
|
3176 |
||
3177 |
self |
|
3178 |
applicationNamed:#FileApplicationNoteBook |
|
3179 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3180 |
||
3181 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
3182 |
! |
|
3183 |
||
3892 | 3184 |
doAddTerminal |
5960 | 3185 |
|dir| |
3186 |
||
3187 |
dir := self currentDirectory. |
|
3892 | 3188 |
|
5960 | 3189 |
dir isNil ifTrue:[ |
4414 | 3190 |
dir := Filename homeDirectory |
3892 | 3191 |
]. |
4774 | 3192 |
|
5009 | 3193 |
self |
3194 |
applicationNamed:#FileApplicationNoteBook |
|
3195 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 3196 |
! |
3197 |
||
3198 |
doOpenSearchFile |
|
5961 | 3199 |
|item file| |
3200 |
||
3201 |
file := self firstSelectedFileName. |
|
3202 |
file isNil ifTrue:[ |
|
3203 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3204 |
]. |
|
3205 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3206 |
self openSearchFileOn:item. |
3207 |
! |
|
3208 |
||
3209 |
doShowFileContents |
|
5009 | 3210 |
self |
3211 |
applicationNamed:#DirectoryContentsBrowser |
|
3212 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3213 |
||
3214 |
^ nil |
|
3892 | 3215 |
! |
3216 |
||
3217 |
doShowProperties |
|
3218 |
"show long stat (file)-info" |
|
3219 |
||
3220 |
self fileGetInfo:true |
|
3221 |
! |
|
3222 |
||
14577 | 3223 |
enterAction |
3224 |
self |
|
3225 |
applicationNamed:#DirectoryContentsBrowser |
|
3226 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3227 |
! |
|
3228 |
||
5528 | 3229 |
fileEncodingDialog |
14497 | 3230 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3231 |
Files are converted to internal encoding when read, and converted back |
3232 |
to this encoding when saved. |
|
3233 |
Notice: currently, not too many encodings are supported by the system." |
|
3234 |
||
3235 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3236 |
||
3237 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3238 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3239 |
||
3240 |
bindings := IdentityDictionary new. |
|
3241 |
bindings at:#encodingList put:encodingDescr. |
|
3242 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3243 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3244 |
||
5528 | 3245 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3246 |
ifTrue:[ |
|
3247 |
idx := (bindings at:#selectedEncoding) value. |
|
3248 |
selectedEncoding := encodings at:idx. |
|
3249 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3250 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3251 |
]. |
5737 | 3252 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3253 |
]. |
3254 |
||
3255 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3256 |
! |
|
3257 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3258 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3259 |
"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
|
3260 |
|
5959 | 3261 |
|currentFileNameHolder currentSel| |
3262 |
||
3263 |
currentFileNameHolder := self currentFileNameHolder. |
|
3264 |
||
3265 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3266 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3267 |
self withWaitCursorDo:[ |
3268 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3269 |
] |
|
3270 |
]. |
|
3271 |
||
3272 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3273 |
! |
3274 |
||
11053 | 3275 |
lineEndConventionDialog |
3276 |
"open a dialog to allow change of the line end conventions |
|
3277 |
(when writing files)" |
|
3278 |
||
3279 |
|bindings| |
|
3280 |
||
3281 |
bindings := IdentityDictionary new. |
|
3282 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3283 |
||
3284 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3285 |
ifTrue:[ |
|
15208 | 3286 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3287 |
]. |
3288 |
||
3289 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3290 |
! |
|
3291 |
||
4392 | 3292 |
newTextEditor |
5009 | 3293 |
self |
3294 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3295 |
ifPresentDo:[:appl | |
3296 |
|editor files item| |
|
3297 |
||
3298 |
editor := appl newTextEditor. |
|
3299 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3300 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3301 |
editor item:item. |
|
3302 |
]. |
|
3303 |
^ editor |
|
3304 |
]. |
|
5009 | 3305 |
|
3306 |
^ nil. |
|
3307 |
! |
|
3308 |
||
3309 |
openApplByFileItem:anItem |
|
8490 | 3310 |
"/ q: is the following always wanted ? |
9267 | 3311 |
self window sensor shiftDown ifFalse:[ |
17715 | 3312 |
((anItem mimeType startsWith:'application/x-expecco-') |
3313 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3314 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3315 |
^ self. |
|
3316 |
]. |
|
3317 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3318 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3319 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3320 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3321 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3322 |
"/ ]. |
9267 | 3323 |
|
8490 | 3324 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3325 |
"/ Error handle:[:ex | |
|
3326 |
"/ ] do:[ |
|
3327 |
"/ OperatingSystem |
|
3328 |
"/ shellExecute:nil |
|
3329 |
"/ lpOperation:'open' |
|
3330 |
"/ lpFile:(anItem fileName pathName) |
|
3331 |
"/ lpParameters:nil |
|
3332 |
"/ lpDirectory:(self directory pathName) |
|
3333 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3334 |
"/ ^ self. |
|
3335 |
"/ ] |
|
3336 |
"/ ] |
|
9267 | 3337 |
]. |
5306 | 3338 |
^ self |
5009 | 3339 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3340 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3341 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3342 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3343 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3344 |
! |
3345 |
||
4392 | 3346 |
openApplForFile:aFilename |
5306 | 3347 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3348 |
! |
3349 |
||
3892 | 3350 |
openCommandResultApplication |
3351 |
||
5009 | 3352 |
self |
3353 |
applicationNamed:#FileApplicationNoteBook |
|
3354 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3355 |
||
3356 |
^ nil |
|
3892 | 3357 |
! |
3358 |
||
5010 | 3359 |
openNewTextEditorOn:anItem |
5009 | 3360 |
self |
3361 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3362 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3363 |
|
3364 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3365 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3366 |
|
5010 | 3367 |
openSearchFileOn:anItem |
5009 | 3368 |
self |
3369 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3370 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3371 |
|
3372 |
^ nil. |
|
3892 | 3373 |
! |
3374 |
||
5162 | 3375 |
openTextEditorForFile:aFilename |
3376 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3377 |
! |
|
3378 |
||
5010 | 3379 |
openTextEditorOn:anItem |
5009 | 3380 |
self |
3381 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3382 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3383 |
|
3384 |
^ nil. |
|
3892 | 3385 |
! |
3386 |
||
5010 | 3387 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3388 |
self |
3389 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3390 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3391 |
|
3392 |
^ nil. |
|
4618 | 3393 |
! |
3394 |
||
5959 | 3395 |
setCurrentFileName:aFilename |
3396 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3397 |
! |
|
3398 |
||
3399 |
setCurrentFileNames:aCollectionOfFilenames |
|
3400 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3401 |
! |
|
3402 |
||
11053 | 3403 |
tabStopConversionDialog |
3404 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3405 |
||
3406 |
|bindings| |
|
3407 |
||
3408 |
bindings := IdentityDictionary new. |
|
3409 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3410 |
||
3411 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3412 |
ifTrue:[ |
|
3413 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3414 |
]. |
|
3415 |
||
3416 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3417 |
! |
|
3418 |
||
3892 | 3419 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3420 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3421 |
aColOfFiles notNil ifTrue:[ |
5959 | 3422 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3423 |
]. |
3892 | 3424 |
! |
3425 |
||
3426 |
updateCurrentDirectory |
|
5739 | 3427 |
self updateCurrentDirectory:false |
3428 |
! |
|
3429 |
||
3430 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3431 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3432 |
|
5009 | 3433 |
self |
3434 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3435 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3436 |
self |
3437 |
applicationNamed:#DirectoryTreeBrowser |
|
3438 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3439 |
! |
3440 |
||
5739 | 3441 |
updateCurrentDirectoryWithReread |
3442 |
self updateCurrentDirectory:true |
|
3443 |
! |
|
3444 |
||
4345 | 3445 |
withActivityIndicationDo:aBlock |
3446 |
||
3447 |
self activityVisibilityChannel value:true. |
|
3448 |
[ |
|
9361 | 3449 |
self withWaitCursorDo:[ |
3450 |
aBlock value. |
|
3451 |
] |
|
4345 | 3452 |
] ensure:[ |
3453 |
self activityVisibilityChannel value:false. |
|
3454 |
] |
|
3892 | 3455 |
! ! |
3456 |
||
3457 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3458 |
||
3459 |
addBookmark |
|
3460 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3461 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3462 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3463 |
! |
3464 |
||
3465 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3466 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3467 |
self class addBookmark:path |
3892 | 3468 |
]. |
3469 |
! |
|
3470 |
||
8013 | 3471 |
editBookmarks |
3472 |
||
3473 |
| default selectedDirectories | |
|
3474 |
||
3475 |
selectedDirectories := self currentSelectedDirectories. |
|
3476 |
selectedDirectories notEmpty ifTrue:[default := selectedDirectories first]. |
|
3477 |
self class editBookmarksWithDefault: default. |
|
3478 |
! |
|
3479 |
||
3892 | 3480 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3481 |
^ self class hasBookmarks |
3892 | 3482 |
! |
3483 |
||
3484 |
hasBookmarksToRemove |
|
3485 |
|bookmarks directories| |
|
3486 |
||
3982 | 3487 |
directories := self currentSelectedDirectories. |
3892 | 3488 |
bookmarks := self class directoryBookmarks. |
17416 | 3489 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3490 |
||
3491 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3492 |
! |
3493 |
||
3494 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3495 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3496 |
self class removeBookmark:dir |
3892 | 3497 |
]. |
4679 | 3498 |
! |
3499 |
||
3500 |
saveBookmarks |
|
3501 |
self class saveBookmarks |
|
3892 | 3502 |
! ! |
3503 |
||
3504 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3505 |
||
3506 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3507 |
|cmd suffix cmdHist historySize| |
3892 | 3508 |
|
3509 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3510 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3511 |
cmdHist notNil ifTrue:[ |
3512 |
cmdHist addFirst:aCommandString. |
|
6369 | 3513 |
historySize := self class commandHistorySize. |
3514 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3515 |
cmdHist removeLast |
3516 |
] |
|
3517 |
]. |
|
3518 |
aFilename notNil ifTrue:[ |
|
3519 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3520 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3521 |
DefaultCommandPerSuffix := Dictionary new. |
|
3522 |
]. |
|
3523 |
suffix := aFilename asFilename suffix. |
|
3524 |
suffix notNil ifTrue:[ |
|
3525 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3526 |
] |
|
3527 |
] |
|
3892 | 3528 |
] |
3529 |
! |
|
3530 |
||
3531 |
doBack |
|
6286 | 3532 |
"go backward in the history" |
3892 | 3533 |
|
4022 | 3534 |
| fileName| |
3535 |
||
6369 | 3536 |
fileName := self directoryHistory goBackward. |
3892 | 3537 |
fileName notNil ifTrue:[ |
4347 | 3538 |
self gotoFile:(fileName asFilename). |
3892 | 3539 |
] |
3540 |
! |
|
3541 |
||
3542 |
doForward |
|
6286 | 3543 |
"go forward in the history" |
3892 | 3544 |
|
3964 | 3545 |
| fileName| |
3546 |
||
6369 | 3547 |
fileName := self directoryHistory goForward. |
3892 | 3548 |
fileName notNil ifTrue:[ |
4414 | 3549 |
self gotoFile:(fileName asFilename). |
4022 | 3550 |
] ifFalse:[ |
4414 | 3551 |
self enableForward value:false. |
4022 | 3552 |
|
3553 |
]. |
|
3892 | 3554 |
! ! |
3555 |
||
3556 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3557 |
||
5009 | 3558 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3559 |
|appl| |
|
3560 |
||
3561 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3562 |
appl notNil ifTrue:[ |
|
3563 |
^ aBlock value:appl |
|
3564 |
]. |
|
3565 |
^ nil. |
|
3566 |
! |
|
3567 |
||
4004 | 3568 |
directoryContentsBrowser |
3569 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3570 |
! ! |
3571 |
||
3572 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3573 |
||
3574 |
applications |
|
3575 |
^ aspects at:#applications |
|
3576 |
! |
|
3577 |
||
3578 |
backgroundProcesses |
|
3579 |
||
3580 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3581 |
! |
|
3582 |
||
4230 | 3583 |
canMake |
15259 | 3584 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3585 |
! |
3586 |
||
3892 | 3587 |
currentDirectories |
6725 | 3588 |
" returns a holder on a Collection of all currently selected directories |
3589 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3590 |
" |
3591 |
||
3592 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3593 |
! |
|
3594 |
||
6725 | 3595 |
currentDirectoriesValue |
3596 |
" returns a Collection of all currently selected directories |
|
3597 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3598 |
" |
|
3599 |
||
3600 |
^ self currentDirectories value |
|
3601 |
! |
|
3602 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3603 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3604 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3605 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3606 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3607 |
|
6725 | 3608 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3609 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3610 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3611 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3612 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3613 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3614 |
|
13856 | 3615 |
currentDirectoryDisplayed |
3616 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3617 |
||
3618 |
^self subclassResponsibility |
|
3619 |
||
3620 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3621 |
! |
|
3622 |
||
3892 | 3623 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3624 |
"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
|
3625 |
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
|
3626 |
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
|
3627 |
|
6589 | 3628 |
^ self aspectFor:#currentFileNameHolder |
3629 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3630 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3631 |
|
4692 | 3632 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3633 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3634 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3635 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3636 |
currentSel asValue |
6589 | 3637 |
] |
3638 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3639 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3640 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3641 |
newFilenames := Set new. |
6589 | 3642 |
filenames do:[:eachFilename| |
3643 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3644 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3645 |
existingFilename notNil ifTrue:[ |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3646 |
[existingFilename isRootDirectory or:[existingFilename exists]] whileFalse:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3647 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3648 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3649 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3650 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3651 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3652 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3653 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3654 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3655 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3656 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3657 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
3892 | 3658 |
! |
3659 |
||
5528 | 3660 |
defaultFileEncoding |
3661 |
^ #'iso8859-1' "/ #'utf-8' |
|
3662 |
! |
|
3663 |
||
3892 | 3664 |
enableDirectoryUp |
3665 |
||
15259 | 3666 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3667 |
! |
3668 |
||
6456 | 3669 |
enableGotoDefaultDirectory |
15259 | 3670 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3671 |
! |
3672 |
||
8168 | 3673 |
enableGotoDesktop |
14308 | 3674 |
"/ backward compatibility |
3675 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3676 |
! |
3677 |
||
9572 | 3678 |
enableGotoDesktopDirectory |
15259 | 3679 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3680 |
|
3681 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3682 |
! |
|
3683 |
||
6434 | 3684 |
enableGotoSmalltalkDirectory |
6456 | 3685 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3686 |
! |
3687 |
||
17187 | 3688 |
enableGotoSmalltalkWorkspaceDirectory |
3689 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3690 |
! |
|
3691 |
||
9677 | 3692 |
enableGotoTempDirectory |
3693 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3694 |
||
3695 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3696 |
! |
|
3697 |
||
3892 | 3698 |
enableHome |
3699 |
||
3700 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3701 |
! |
|
3702 |
||
9596 | 3703 |
enableMakeCurrentDirectory |
3704 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3705 |
||
3706 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3707 |
! |
|
3708 |
||
3892 | 3709 |
enableViewNoteBookApplication |
3710 |
||
3711 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3712 |
! |
|
3713 |
||
5528 | 3714 |
fileEncoding |
3715 |
^ self fileEncodingHolder value |
|
3716 |
! |
|
3717 |
||
3718 |
fileEncoding:newEncoding |
|
5533 | 3719 |
self fileEncodingHolder value:newEncoding. |
3720 |
||
3721 |
self |
|
3722 |
applicationNamed:#FileApplicationNoteBook |
|
3723 |
ifPresentDo:[:nb | |
|
3724 |
|appl| |
|
3725 |
||
3726 |
appl := nb selectedApplication. |
|
5535 | 3727 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 3728 |
appl fileEncoding:newEncoding |
3729 |
] |
|
3730 |
]. |
|
5528 | 3731 |
! |
3732 |
||
5737 | 3733 |
fileEncodingHolder |
3734 |
^ self |
|
3735 |
aspectFor:#fileEncodingHolder |
|
3736 |
ifAbsent:[ |
|
3737 |
self |
|
3738 |
applicationNamed:#FileApplicationNoteBook |
|
3739 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
3740 |
] |
|
3741 |
! |
|
3742 |
||
17485 | 3743 |
fileEntryFieldHolder |
3744 |
^ self subclassResponsibility. |
|
3745 |
||
3746 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
3747 |
! |
|
3748 |
||
5961 | 3749 |
firstSelectedFileName |
3750 |
|files| |
|
3751 |
||
7560 | 3752 |
files := self currentSelectedObjects. |
5961 | 3753 |
files notEmpty ifTrue:[ |
3754 |
^ files first |
|
3755 |
]. |
|
3756 |
^ nil |
|
7560 | 3757 |
|
3758 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 3759 |
! |
3760 |
||
6456 | 3761 |
gotoDefaultDirectoryIsVisible |
9596 | 3762 |
^ true. |
3763 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3764 |
||
3765 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 3766 |
! |
3767 |
||
9572 | 3768 |
gotoDesktopDirectoryIsVisible |
3769 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
3770 |
||
3771 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3772 |
||
3773 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
3774 |
! |
|
3775 |
||
4618 | 3776 |
hasFileSelection |
3777 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
3778 |
! |
|
3779 |
||
9490 | 3780 |
hasNotTwoDirectoriesSelectedHolder |
3781 |
^ self |
|
3782 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
3783 |
ifAbsent:[ |
|
3784 |
BlockValue |
|
3785 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
3786 |
argument:self currentFileNameHolder |
|
3787 |
]. |
|
3788 |
||
3789 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
3790 |
! |
|
3791 |
||
5830 | 3792 |
hasNotTwoFilesSelectedHolder |
9490 | 3793 |
^ self |
3794 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 3795 |
ifAbsent:[ |
3796 |
BlockValue |
|
3797 |
with:[:m | self hasTwoFilesSelected not] |
|
3798 |
argument:self currentFileNameHolder |
|
3799 |
]. |
|
9490 | 3800 |
|
3801 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 3802 |
! |
3803 |
||
3892 | 3804 |
hasSelection |
3805 |
||
3806 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
3807 |
! |
|
3808 |
||
9490 | 3809 |
hasTwoDirectoriesSelectedHolder |
3810 |
^ self |
|
3811 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
3812 |
ifAbsent:[ |
|
3813 |
BlockValue |
|
3814 |
with:[:m | self hasTwoDirectoriesSelected] |
|
3815 |
argument:self currentFileNameHolder |
|
3816 |
]. |
|
3817 |
||
3818 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
3819 |
! |
|
3820 |
||
4414 | 3821 |
hasTwoFilesSelectedHolder |
9490 | 3822 |
^ self |
3823 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3824 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3825 |
BlockValue |
5830 | 3826 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3827 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3828 |
]. |
9490 | 3829 |
|
3830 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 3831 |
! |
3832 |
||
11053 | 3833 |
inputTabColumnConversion |
3834 |
^ self inputTabColumnConversionHolder value |
|
3835 |
||
3836 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
3837 |
! |
|
3838 |
||
3839 |
inputTabColumnConversionHolder |
|
3840 |
^ self |
|
3841 |
aspectFor:#inputTabColumnConversionHolder |
|
3842 |
ifAbsent:[ |
|
3843 |
self |
|
3844 |
applicationNamed:#FileApplicationNoteBook |
|
3845 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
3846 |
] |
|
3847 |
||
3848 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
3849 |
! |
|
3850 |
||
3851 |
lineEndConvention |
|
15208 | 3852 |
^ self lineEndConventionHolder value asSymbol |
11053 | 3853 |
|
3854 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
3855 |
! |
|
3856 |
||
11591 | 3857 |
lineEndConvention: aSymbol |
15208 | 3858 |
self lineEndConventionHolder value: aSymbol asSymbol |
11591 | 3859 |
|
3860 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
3861 |
! |
|
3862 |
||
11053 | 3863 |
lineEndConventionHolder |
3864 |
^ self |
|
3865 |
aspectFor:#lineEndConventionHolder |
|
3866 |
ifAbsent:[ |
|
3867 |
self |
|
3868 |
applicationNamed:#FileApplicationNoteBook |
|
3869 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
3870 |
] |
|
3871 |
||
3872 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
3873 |
! |
|
3874 |
||
5737 | 3875 |
lockFileEncoding:aBoolean |
3876 |
self lockFileEncodingHolder value:aBoolean. |
|
3877 |
||
3878 |
self |
|
3879 |
applicationNamed:#FileApplicationNoteBook |
|
3880 |
ifPresentDo:[:nb | |
|
3881 |
|appl| |
|
3882 |
||
3883 |
appl := nb selectedApplication. |
|
3884 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
3885 |
appl lockFileEncoding:aBoolean |
|
3886 |
] |
|
3887 |
]. |
|
3888 |
! |
|
3889 |
||
3890 |
lockFileEncodingHolder |
|
3891 |
^ self |
|
3892 |
aspectFor:#lockFileEncodingHolder |
|
3893 |
ifAbsent:[ |
|
3894 |
self |
|
3895 |
applicationNamed:#FileApplicationNoteBook |
|
3896 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
3897 |
] |
|
3898 |
! |
|
3899 |
||
13856 | 3900 |
makeCommandHolder |
3901 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
3902 |
||
3903 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3904 |
! |
|
3905 |
||
4523 | 3906 |
notify:aString |
11108 | 3907 |
"aString is shown in the lower pane" |
3908 |
||
4523 | 3909 |
self notifyChannel value:aString |
11108 | 3910 |
|
3911 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 3912 |
! |
3913 |
||
3892 | 3914 |
notifyChannel |
3915 |
||
3916 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 3917 |
! |
3918 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3919 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3920 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3921 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3922 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3923 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3924 |
|
4071 | 3925 |
rootHolder |
3926 |
"holder, which keeps the rootHolder of the treeView |
|
3927 |
" |
|
3928 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3929 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3930 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3931 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3932 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3933 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3934 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3935 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3936 |
self aspectFor:#rootHolder put:aHolder |
3892 | 3937 |
! ! |
3938 |
||
3939 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
3940 |
||
3941 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 3942 |
"returns the model for an aspect; these are stored in a common dictionary" |
3943 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3944 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 3945 |
! |
3946 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3947 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 3948 |
"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
|
3949 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3950 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3951 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3952 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3953 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3954 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3955 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3956 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3957 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3958 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3959 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3960 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3961 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3962 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3963 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3964 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3965 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3966 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3967 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3968 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3969 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3970 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3971 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3972 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3973 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3974 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3975 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3976 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3977 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3978 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3979 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3980 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3981 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3982 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3983 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3984 |
aspectFor:something put:aValueHolder |
6284 | 3985 |
"stores the model for an aspect; these are stored in a common dictionary" |
3986 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3987 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3988 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3989 |
|
3892 | 3990 |
aspects |
6284 | 3991 |
"returns the common aspect dictionary" |
3992 |
||
3892 | 3993 |
^ aspects |
3994 |
! |
|
3995 |
||
3996 |
runtimeAspectValueFor:something |
|
3997 |
"returns the default aspect item from the class variable RuntimeAspects |
|
3998 |
" |
|
3999 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4000 |
! |
|
4001 |
||
4201 | 4002 |
saveAspectValues |
16306 | 4003 |
|prefs saveAspects aspectValue| |
4004 |
||
4005 |
prefs := UserPreferences current. |
|
4006 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4007 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4008 |
saveAspects do:[ :aspectKey | |
4201 | 4009 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4010 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4011 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4012 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4013 |
]. |
16306 | 4014 |
prefs beModified. |
4015 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4016 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4017 |
! |
4018 |
||
3892 | 4019 |
saveRuntimeAspectValues |
4020 |
|savedAspects dictionary value isHolder aspect| |
|
4021 |
||
5941 | 4022 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4023 |
dictionary := Dictionary new. |
5941 | 4024 |
savedAspects do:[:aspectKey | |
4414 | 4025 |
aspect := self perform:aspectKey. |
4026 |
isHolder := aspect isValueModel. |
|
5941 | 4027 |
isHolder ifTrue:[ |
4028 |
value := aspect value |
|
4029 |
] ifFalse:[ |
|
4030 |
value := aspect |
|
4031 |
]. |
|
4032 |
dictionary at:aspectKey |
|
4033 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4034 |
]. |
|
4035 |
RuntimeAspects := dictionary. |
|
3892 | 4036 |
! |
4037 |
||
4201 | 4038 |
userPreferencesAspectValueFor:something |
4039 |
"returns the default aspect from the Userpreferences |
|
3892 | 4040 |
" |
4201 | 4041 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4042 |
(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
|
4043 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4044 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4045 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4046 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4047 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4048 |
! ! |
4049 |
||
4011 | 4050 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4051 |
||
9015 | 4052 |
filter:aString |
4053 |
self filterModel value:aString |
|
4054 |
! |
|
4055 |
||
4018 | 4056 |
filterBackgroundColor |
4057 |
||
4058 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4059 |
! |
|
4060 |
||
4011 | 4061 |
filterBlockHolder |
4062 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4063 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4064 |
! |
4065 |
||
4066 |
filterListModel |
|
4067 |
||
4068 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4069 |
! |
|
4070 |
||
4071 |
filterModel |
|
5941 | 4072 |
|m| |
4073 |
||
4074 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4075 |
^ m |
|
4011 | 4076 |
! |
4077 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4078 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4079 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4080 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4081 |
|
4018 | 4082 |
filterValueBox |
4083 |
||
4084 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4085 |
! |
|
4086 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4087 |
makeFilterBlock |
14497 | 4088 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4089 |
to be shown" |
4090 |
||
17481 | 4091 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4092 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4093 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4094 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4095 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4096 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4097 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4098 |
filterStrings := filterStrings |
4099 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4100 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4101 |
filters := filterStrings |
12760 | 4102 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4103 |
thenCollect: |
|
4104 |
[:eachPattern | |
|
4105 |
|pattern| |
|
4106 |
||
4107 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4108 |
pattern includesMatchCharacters ifFalse:[ |
4109 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4110 |
that's how most of the other applications behave - do what most users expect" |
|
4111 |
pattern first == $* ifFalse:[pattern := '*' , pattern]. |
|
4112 |
pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4113 |
]. |
|
13856 | 4114 |
|
17481 | 4115 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
12760 | 4116 |
]. |
4117 |
||
4118 |
notFilters := filterStrings |
|
4119 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4120 |
thenCollect: |
|
4121 |
[:eachPattern | |
|
9296 | 4122 |
|pattern| |
4123 |
||
4124 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4125 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4126 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4127 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4128 |
|
12760 | 4129 |
|
4130 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4131 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4132 |
] ifFalse:[ |
12760 | 4133 |
filters isEmpty ifTrue:[ |
4134 |
filterBlock := [:name :baseName | |
|
4135 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4136 |
]. |
|
4137 |
] ifFalse:[ |
|
4138 |
notFilters isEmpty ifTrue:[ |
|
4139 |
filterBlock := [:name :baseName | |
|
4140 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4141 |
]. |
|
4142 |
] ifFalse:[ |
|
4143 |
filterBlock := [:name :baseName | |
|
4144 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4145 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4146 |
]. |
|
4147 |
] |
|
4148 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4149 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4150 |
|
4011 | 4151 |
showHidden := self showHiddenFiles value. |
4152 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4153 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4154 |
]. |
9296 | 4155 |
^ [:name :baseName | |
4156 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4157 |
|
4158 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4159 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
4018 | 4160 |
! |
4161 |
||
4162 |
shownFiles |
|
4163 |
||
4164 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4165 |
! ! |
4166 |
||
14126 | 4167 |
|
3892 | 4168 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4169 |
||
4170 |
dirHistory |
|
6369 | 4171 |
"obsolete" |
4172 |
^ self directoryHistory |
|
4173 |
! |
|
4174 |
||
4175 |
directoryHistory |
|
3952 | 4176 |
^ self class directoryHistory |
3892 | 4177 |
! |
4178 |
||
4179 |
enableBack |
|
4180 |
||
15259 | 4181 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4182 |
! |
4183 |
||
4184 |
enableFileHistory |
|
4185 |
||
15259 | 4186 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4187 |
! |
4188 |
||
4189 |
enableForward |
|
4190 |
||
15259 | 4191 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4192 |
! |
4193 |
||
4194 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4195 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4196 |
! ! |
4197 |
||
4198 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4199 |
||
4345 | 4200 |
activityVisibilityChannel |
6284 | 4201 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4202 |
|
15259 | 4203 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4204 |
! |
4205 |
||
15111 | 4206 |
alwaysUseSmalltalkTools |
4207 |
" aspect to prevent os tools to be opened on double click" |
|
4208 |
||
15259 | 4209 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4210 |
! |
4211 |
||
6602 | 4212 |
changeSetBrowserItemVisible |
4213 |
^ Screen current ctrlDown. |
|
4214 |
! |
|
4215 |
||
11135 | 4216 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4217 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4218 |
|
4219 |
"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
|
4220 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4221 |
! |
4222 |
||
13856 | 4223 |
hgMenusAreShown |
4224 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4225 |
||
4226 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4227 |
! |
|
4228 |
||
11135 | 4229 |
mercurialMenusAreShown |
11147 | 4230 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4231 |
|
4232 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4233 |
! |
|
4234 |
||
4110 | 4235 |
openAlwaysInTextEditor |
17024 | 4236 |
" aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4237 |
|
15111 | 4238 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
4110 | 4239 |
! |
4240 |
||
3892 | 4241 |
openMultipleApplicationsForType |
4242 |
||
4201 | 4243 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4244 |
open TextEditor " |
|
4245 |
||
3892 | 4246 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4247 |
! |
|
4248 |
||
11137 | 4249 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4250 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4251 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4252 |
|
4253 |
"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
|
4254 |
"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
|
4255 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4256 |
! |
4257 |
||
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
|
4258 |
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
|
4259 |
|
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
|
4260 |
^ 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
|
4261 |
|
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
|
4262 |
"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
|
4263 |
! |
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
|
4264 |
|
4201 | 4265 |
showDirectoryTree |
4266 |
||
4267 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4268 |
! |
4269 |
||
4554 | 4270 |
showDiskUsageHolder |
4271 |
|holder| |
|
4272 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4273 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4274 |
holder addDependent:self. |
4554 | 4275 |
^ holder |
4276 |
! |
|
4277 |
||
3892 | 4278 |
showHiddenFiles |
4279 |
||
9582 | 4280 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4281 |
||
4282 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4283 |
! |
4284 |
||
9108 | 4285 |
showHiddenFiles:aHolder |
4286 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4287 |
! |
|
4288 |
||
4289 |
shownFiles:aHolder |
|
4290 |
self aspectFor:#shownFiles put:aHolder. |
|
4291 |
! |
|
4292 |
||
11135 | 4293 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4294 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4295 |
|
4296 |
"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
|
4297 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4298 |
! |
4299 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4300 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4301 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4302 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4303 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4304 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4305 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4306 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4307 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4308 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4309 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4310 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4311 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4312 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4313 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4314 |
|
4648 | 4315 |
userContextAvailable |
4316 |
||
4317 |
" aspect for show group and user columns in contents view |
|
4318 |
windows provides no user context" |
|
4319 |
||
4320 |
^ OperatingSystem isMSWINDOWSlike not |
|
4321 |
! |
|
4322 |
||
3892 | 4323 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4324 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4325 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4326 |
^ self directoryContentsBrowser viewDescription |
3892 | 4327 |
! |
4328 |
||
4329 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4330 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4331 |
" |
3892 | 4332 |
|
6121 | 4333 |
|directoryContentsBrowser| |
4334 |
||
4335 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4336 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4337 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4338 |
! |
4339 |
||
4340 |
viewDirectoryDescription |
|
4341 |
||
4201 | 4342 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4343 |
on change directory " |
|
4344 |
||
3892 | 4345 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4346 |
! |
|
4347 |
||
4201 | 4348 |
viewDirsInContentsBrowser |
4349 |
||
4350 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4351 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4352 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4353 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4354 |
" |
4201 | 4355 |
! |
4356 |
||
5870 | 4357 |
viewFilesInContentsBrowser |
4358 |
||
4359 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4360 |
! |
|
4361 |
||
3892 | 4362 |
viewFilesInDirectoryTree |
4363 |
||
4201 | 4364 |
" aspect for view files in tree view (not only directories) " |
4365 |
||
3892 | 4366 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4367 |
! |
|
4368 |
||
4369 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4370 |
" aspect for show group 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 viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4373 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4374 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4375 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4376 |
" aspect for show file-type icon 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 viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4379 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4380 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4381 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4382 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4383 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4384 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4385 |
! |
4386 |
||
4387 |
viewNoteBookApplicationHolder |
|
4388 |
||
4389 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4390 |
! |
|
4391 |
||
4392 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4393 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4394 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4395 |
^ self directoryContentsBrowser viewOwner |
3892 | 4396 |
! |
4397 |
||
4398 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4399 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4400 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4401 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4402 |
! |
4403 |
||
4404 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4405 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4406 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4407 |
^ self directoryContentsBrowser viewPreview |
3892 | 4408 |
! |
4409 |
||
4410 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4411 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4412 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4413 |
^ self directoryContentsBrowser viewSize |
3892 | 4414 |
! |
4415 |
||
4974 | 4416 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4417 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4418 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4419 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4420 |
! |
4421 |
||
5312 | 4422 |
viewSizeInKiloBytes |
4423 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4424 |
||
4425 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4426 |
! |
|
4427 |
||
3892 | 4428 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4429 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4430 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4431 |
^ self directoryContentsBrowser viewTime |
3892 | 4432 |
! |
4433 |
||
4434 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4435 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4436 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4437 |
^ self directoryContentsBrowser viewType |
3892 | 4438 |
! ! |
4439 |
||
4440 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4441 |
||
4442 |
executeCommand:cmd |
|
4443 |
||
4444 |
self executeCommand:cmd inDirectory:nil |
|
4445 |
! |
|
4446 |
||
5880 | 4447 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4448 |
| nameString executionBlock| |
4449 |
||
5880 | 4450 |
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
|
4451 |
nameString := 'Execute: ', cmd. |
3892 | 4452 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4453 |
! |
|
4454 |
||
4455 |
getExecutionBlockForCommand:cmd |
|
4456 |
||
4457 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4458 |
! |
|
4459 |
||
5880 | 4460 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4461 |
| dir| |
|
4462 |
||
4463 |
dir := directoryOrNil. |
|
4464 |
directoryOrNil isNil ifTrue:[ |
|
4465 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4466 |
dir isNil ifTrue:[ |
12493 | 4467 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4468 |
AbortOperationRequest raise. |
6671 | 4469 |
^ nil |
4470 |
]. |
|
3892 | 4471 |
]. |
4523 | 4472 |
|
4473 |
^ [:stream| |
|
4474 |
stream notNil ifTrue:[ |
|
4414 | 4475 |
OperatingSystem |
4476 |
executeCommand:cmd |
|
4477 |
inputFrom:nil |
|
4478 |
outputTo:stream |
|
4479 |
errorTo:stream |
|
4480 |
inDirectory:dir |
|
16732 | 4481 |
lineWise:true |
16825 | 4482 |
showWindow:false |
4414 | 4483 |
onError:[:status| false]. |
4484 |
] |
|
4523 | 4485 |
]. |
3892 | 4486 |
! |
4487 |
||
4488 |
killAllRunningBackgroundProcesses |
|
4489 |
||
4490 |
self backgroundProcesses do:[ : process | |
|
4523 | 4491 |
self notify:'kill ', process name. |
4414 | 4492 |
process terminate. |
3892 | 4493 |
]. |
4494 |
! |
|
4495 |
||
4496 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4497 |
| stream process appl nameString| |
|
4498 |
||
4499 |
appl := self openCommandResultApplication. |
|
4500 |
stream := appl resultStream. |
|
4501 |
nameString := aString ? 'Execution Result'. |
|
4502 |
appl changeTabTo:nameString. |
|
4523 | 4503 |
|
16102 | 4504 |
process := |
4505 |
[ |
|
4506 |
[aBlock value:stream] |
|
4507 |
ensure:[ |
|
4508 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4509 |
appl process value:nil. |
|
4510 |
||
4511 |
"/ close automatically, if there was no output. |
|
4571 | 4512 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4513 |
"/ appl doClose. |
|
4514 |
"/ ] |
|
16102 | 4515 |
stream nextPutLine:'Done.'. |
4516 |
self enqueueMessage:#updateCurrentDirectory. |
|
4517 |
] |
|
4518 |
] newProcess. |
|
3892 | 4519 |
process priority:(Processor userBackgroundPriority). |
4520 |
process name:nameString. |
|
4521 |
self backgroundProcesses add:process. |
|
4522 |
appl process value:process. |
|
4523 |
process resume. |
|
4524 |
! ! |
|
4525 |
||
4526 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4527 |
||
4915 | 4528 |
currentFileNameHolderChanged |
4529 |
"/ self currentFileNameHolderChangedForCommon |
|
4530 |
! |
|
4531 |
||
4577 | 4532 |
currentFileNameHolderChangedForCommon |
5476 | 4533 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4534 |
|
7560 | 4535 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4536 |
self class currentSelection:selection. |
4734 | 4537 |
|
13521 | 4538 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4539 |
self hasSelection value:selectionNotEmpty. |
4540 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 4541 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4542 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4543 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4544 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4545 |
self currentDirectories value:newDirectories. |
4546 |
size := newDirectories size. |
|
4774 | 4547 |
rootInTreeView := self |
4548 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4549 |
ifPresentDo:[:appl | appl rootHolder]. |
4550 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4551 |
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
|
4552 |
|
4347 | 4553 |
newDirectories notEmpty ifTrue:[ |
6369 | 4554 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4555 |
]. |
5074 | 4556 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
14308 | 4557 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
6456 | 4558 |
self enableGotoDefaultDirectory value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
4559 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(self smalltalkDirectory asAbsoluteFilename))not). |
|
9572 | 4560 |
self enableGotoDesktopDirectory value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
9677 | 4561 |
self enableGotoTempDirectory value:((newDirectories includes:(self tempDirectory asAbsoluteFilename))not). |
4011 | 4562 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4563 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4564 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4565 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4566 |
self enableForward value:self canForward. |
4734 | 4567 |
self enableBack value:self canBackward. |
6095 | 4568 |
|
13856 | 4569 |
self updateCanMake. |
7560 | 4570 |
|
9677 | 4571 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4572 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4011 | 4573 |
! |
4574 |
||
4575 |
filterModelChanged |
|
4576 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4577 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4578 |
! |
4579 |
||
3892 | 4580 |
update:something with:aParameter from:changedObject |
4581 |
||
4582 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4583 |
and the things that have to be done if it runs standalone " |
|
4584 |
||
4585 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4586 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4587 |
^ self |
3892 | 4588 |
]. |
3989 | 4589 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4590 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4591 |
^ self |
3989 | 4592 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4593 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4594 |
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
|
4595 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4596 |
]. |
4011 | 4597 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4598 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4599 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4600 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4601 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4602 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4603 |
^ self |
4004 | 4604 |
]. |
4781 | 4605 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4606 |
self notify:nil. |
4781 | 4607 |
^ self |
4608 |
]. |
|
3989 | 4609 |
|
3892 | 4610 |
super update:something with:aParameter from:changedObject |
5543 | 4611 |
! |
4612 |
||
6095 | 4613 |
updateCanMake |
4614 |
|dir can| |
|
4615 |
||
4616 |
can := false. |
|
4617 |
dir := self currentDirectory. |
|
4618 |
dir notNil ifTrue:[ |
|
13856 | 4619 |
"/ Check for make |
6095 | 4620 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4621 |
can ifFalse:[ |
4622 |
can := (dir asFilename construct:'makefile') exists. |
|
4623 |
]. |
|
6095 | 4624 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4625 |
can ifFalse:[ |
|
13856 | 4626 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4627 |
] |
4628 |
]. |
|
13856 | 4629 |
can ifTrue:[ |
4630 |
self makeCommandHolder value: 'make'. |
|
4631 |
self canMake value: true. |
|
4632 |
^ self |
|
4633 |
]. |
|
4634 |
||
4635 |
"/Check for Apache ant |
|
4636 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4637 |
can := (dir asFilename construct:'build.xml') exists. |
|
4638 |
can ifTrue:[ |
|
4639 |
self makeCommandHolder value: 'ant'. |
|
4640 |
self canMake value: true. |
|
4641 |
^ self |
|
4642 |
]. |
|
4643 |
]. |
|
4644 |
||
4645 |
"/Add more here... |
|
4646 |
||
6095 | 4647 |
]. |
4648 |
self canMake value:can. |
|
13856 | 4649 |
|
4650 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4651 |
! |
4652 |
||
5543 | 4653 |
updateListAfterDelete:colOfFiles |
4654 |
self updateCurrentDirectory |
|
3892 | 4655 |
! ! |
4656 |
||
4657 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4658 |
||
4659 |
canPaste |
|
4660 |
||
15259 | 4661 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4662 |
! |
4663 |
||
4664 |
clipboard |
|
4665 |
||
4666 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4667 |
! |
|
4668 |
||
4669 |
copyFilesToClipBoard:colOfFiles |
|
4670 |
self putInClipBoard:colOfFiles as:#copy. |
|
4671 |
! |
|
4672 |
||
4673 |
cutFilesToClipBoard:colOfFiles |
|
4674 |
"defete current selected files/directories |
|
4675 |
" |
|
4676 |
self putInClipBoard:colOfFiles as:#cut. |
|
4677 |
! |
|
4678 |
||
4679 |
emptyClipBoard |
|
4680 |
||
4681 |
self clipboard files:nil. |
|
4682 |
self canPaste value:false. |
|
4683 |
! |
|
4684 |
||
4685 |
putInClipBoard:colOfFiles as:aSymbol |
|
4686 |
| stream clp| |
|
4687 |
||
4688 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4689 |
clp := self clipboard. |
|
4690 |
clp files:nil. |
|
4691 |
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
|
4692 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4693 |
stream := String writeStream. |
3892 | 4694 |
stream nextPutAll:aSymbol asString. |
4695 |
stream nextPutAll:' <'. |
|
4696 |
stream nextPutAll:colOfFiles first asString. |
|
4697 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4698 |
stream nextPutAll:' ...'. |
3892 | 4699 |
]. |
4700 |
stream nextPutAll:'> to clipboard'. |
|
4701 |
||
4523 | 4702 |
self notify:stream contents. |
3892 | 4703 |
clp files:colOfFiles. |
4704 |
self canPaste value:true. |
|
4705 |
! ! |
|
4706 |
||
4707 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
4708 |
||
4709 |
canDropFiles:dropedObjects for:filename |
|
6284 | 4710 |
|filenameDirString filenameDir| |
3892 | 4711 |
|
4712 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 4713 |
|
3892 | 4714 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 4715 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 4716 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 4717 |
|
3892 | 4718 |
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
|
4719 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
4720 |
dropedObjects do:[:aDropObject | |
6284 | 4721 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
4722 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
4723 |
"/ |
|
4724 |
"/ dropFileName := aDropObject theObject. |
|
4725 |
"/ dropFileNameString := dropFileName asString. |
|
4726 |
"/ dropFileName isDirectory ifTrue:[ |
|
4727 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4728 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
4729 |
"/ ^ false |
|
4730 |
"/ ] |
|
4731 |
"/ ] ifFalse:[ |
|
4732 |
"/ physicalPathName := dropFileName physicalPathName. |
|
4733 |
"/ (filenameDirString = dropFileName directory asString |
|
4734 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
4735 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
4736 |
"/ self notify:'Cannot drop a file into same directory'. |
|
4737 |
"/ ^ false |
|
4738 |
"/ ] |
|
4739 |
"/ ] |
|
4740 |
]. |
|
4741 |
self notify:nil. |
|
4742 |
^ true |
|
4743 |
! |
|
4744 |
||
4745 |
canDropObject:aDropObject into:aDirectory |
|
4746 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
4747 |
||
4748 |
dropFileName := aDropObject theObject. |
|
4749 |
dropFileNameString := dropFileName asString. |
|
4750 |
dropFileName isDirectory ifTrue:[ |
|
4751 |
filenameDirString := aDirectory asString. |
|
4752 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4753 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
4754 |
^ false |
|
4414 | 4755 |
] |
6284 | 4756 |
] ifFalse:[ |
4757 |
physicalPathName := dropFileName physicalPathName. |
|
4758 |
(aDirectory = dropFileName directory |
|
4759 |
or:[ aDropObject isFileInArchive not |
|
4760 |
and:[physicalPathName notNil |
|
4761 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
4762 |
self notify:'Cannot drop a file into same directory'. |
|
4763 |
^ false |
|
4764 |
] |
|
4765 |
]. |
|
4766 |
^ true. |
|
3892 | 4767 |
! |
4768 |
||
7406 | 4769 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
4770 |
^ aCollectionOfDropObjects contains:[:dropObject | dropObject isFileObject] |
|
4771 |
||
4772 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
4773 |
! |
|
4774 |
||
17202 | 4775 |
doStartDrag:arg1 in:arg2 |
4776 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 4777 |
! |
4778 |
||
7408 | 4779 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 4780 |
|fileEntryFieldHolder destDir dropObject fn d| |
4781 |
||
4782 |
fileEntryFieldHolder := self masterApplication notNil |
|
4783 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
4784 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
4785 |
||
4786 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4787 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4788 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4789 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4790 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4791 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4792 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4793 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4794 |
]. |
7990 | 4795 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4796 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4797 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4798 |
]. |
6479 | 4799 |
|
4800 |
destDir := self currentDirectory. |
|
4801 |
destDir isNil ifTrue:[^ self]. |
|
4802 |
||
8601 | 4803 |
self withWaitCursorDo:[ |
4804 |
aCollectionOfDropObjects do:[:dropObject | |
|
4805 |
|fn| |
|
4806 |
||
4807 |
dropObject isFileObject ifTrue:[ |
|
4808 |
fn := dropObject theObject asFilename. |
|
4809 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
4810 |
fn recursiveCopyTo:destDir |
8601 | 4811 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
4812 |
fn copyTo:(destDir / fn baseName ) |
8601 | 4813 |
] |
6479 | 4814 |
] |
8601 | 4815 |
]. |
4816 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4817 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4818 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4819 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4820 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4821 |
]. |
7408 | 4822 |
|
4823 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 4824 |
! ! |
4825 |
||
4826 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
4827 |
||
4828 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 4829 |
"copy to" |
4830 |
||
7635 | 4831 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
4832 |
||
4833 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
4834 |
! |
|
4835 |
||
4836 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
4837 |
"copy to" |
|
4838 |
||
4839 |
|copyOperation msg| |
|
4840 |
||
4841 |
repairCorruptedFiles ifTrue:[ |
|
4842 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
4843 |
] ifFalse:[ |
|
4844 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
4845 |
]. |
|
4846 |
copyOperation result ifTrue:[ |
|
6190 | 4847 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 4848 |
] ifFalse:[ |
7635 | 4849 |
msg := copyOperation errorString. |
6190 | 4850 |
]. |
4851 |
self notify:msg. |
|
7635 | 4852 |
^ copyOperation result |
4853 |
||
4854 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 4855 |
! |
4856 |
||
4857 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 4858 |
|copy result| |
3892 | 4859 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4860 |
self withActivityIndicationDo:[ |
5961 | 4861 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 4862 |
copy result ifTrue:[ |
4863 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
4864 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4865 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4866 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4867 |
self updateCurrentDirectory. |
3892 | 4868 |
]. |
6374 | 4869 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4870 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4871 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 4872 |
! |
4873 |
||
15569 | 4874 |
copyFromToRepairingCorruptedFiles |
4875 |
"ask for source and destination and copy the entered file. |
|
4876 |
Especially useful for raw devices to copy corrupted disks/files |
|
4877 |
" |
|
4878 |
||
4879 |
|source destination| |
|
4880 |
||
4881 |
source := Dialog |
|
4882 |
requestDirectoryName:(resources string:'Copy from:') |
|
4883 |
default:(LastMoveDestination ? self currentDirectory) |
|
4884 |
ok:(resources string:'Continue') |
|
4885 |
abort:nil. |
|
4886 |
||
4887 |
source isEmptyOrNil ifTrue:[^ self]. |
|
4888 |
source := source asFilename. |
|
4889 |
||
4890 |
destination := Dialog |
|
4891 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
4892 |
default:(LastMoveDestination ? self currentDirectory) |
|
4893 |
ok:(resources string:'Copy') |
|
4894 |
abort:nil. |
|
4895 |
||
4896 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
4897 |
destination := destination asFilename. |
|
4898 |
||
4899 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
4900 |
! |
|
4901 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4902 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 4903 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4904 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4905 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4906 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4907 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4908 |
"/ 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
|
4909 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4910 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4911 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4912 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4913 |
"/ 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
|
4914 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4915 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4916 |
"/ 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
|
4917 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4918 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4919 |
"/ 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
|
4920 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4921 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4922 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4923 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4924 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 4925 |
with:(resources string: |
4926 |
(file type == #regular |
|
4927 |
ifTrue:'file' |
|
4928 |
ifFalse:[ |
|
4929 |
file isDirectory |
|
4930 |
ifTrue:'directory' |
|
4931 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4932 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4933 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4934 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4935 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4936 |
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
|
4937 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4938 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 4939 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4940 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4941 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4942 |
request:msg |
8127 | 4943 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
4944 |
image:(WarningBox iconBitmap) |
8127 | 4945 |
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
|
4946 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4947 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4948 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4949 |
^ answer. |
17762 | 4950 |
|
4951 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 4952 |
! |
4953 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4954 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 4955 |
"copy or move aColOfSourceFiles to aDirectory. |
4956 |
Asks the used if a move or a copy is wanted. |
|
4957 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
4958 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4959 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4960 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4961 |
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
|
4962 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4963 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4964 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4965 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4966 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4967 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4968 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4969 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4970 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4971 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4972 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4973 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 4974 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4975 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4976 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4977 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4978 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4979 |
|
4745 | 4980 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4981 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4982 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4983 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4984 |
^ true. |
3892 | 4985 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4986 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4987 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4988 |
^ true. |
3892 | 4989 |
]. |
4745 | 4990 |
^ false. |
3892 | 4991 |
! |
4992 |
||
6107 | 4993 |
copySelectionTo |
4994 |
"copy the selected file(s) to another directory" |
|
4995 |
||
13704 | 4996 |
self copySelectionToRepairingCorruptedFiles:false. |
4997 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4998 |
|
4999 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5000 |
! |
|
5001 |
||
5002 |
copySelectionToRepairingCorruptedFiles |
|
5003 |
"copy the selected file(s) to another directory" |
|
5004 |
||
13704 | 5005 |
self copySelectionToRepairingCorruptedFiles:true. |
5006 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5007 |
|
5008 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5009 |
! |
|
5010 |
||
5011 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5012 |
"copy the selected file(s) to another directory" |
|
5013 |
||
6299 | 5014 |
|selectedFiles msg destination directory| |
5015 |
||
7560 | 5016 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5017 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5018 |
||
5019 |
msg := (selectedFiles size > 1) |
|
14588 | 5020 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5021 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5022 |
|
5023 |
destination := Dialog |
|
14588 | 5024 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5025 |
default:(LastMoveDestination ? self currentDirectory) |
5026 |
ok:(resources string:'Copy') |
|
5027 |
abort:nil. |
|
5028 |
||
6299 | 5029 |
destination isEmptyOrNil ifTrue:[^ self]. |
5030 |
destination := destination asFilename. |
|
5031 |
||
5032 |
destination isDirectory ifFalse:[ |
|
5033 |
selectedFiles size == 1 ifTrue:[ |
|
5034 |
directory := destination directory. |
|
5035 |
directory isDirectory ifTrue:[ |
|
5036 |
LastMoveDestination := directory. |
|
7635 | 5037 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5038 |
^ self. |
5039 |
] |
|
5040 |
] |
|
5041 |
]. |
|
5042 |
||
5043 |
LastMoveDestination := destination. |
|
7635 | 5044 |
repairingCorruptedFiles ifTrue:[ |
5045 |
selectedFiles do:[:eachFile | |
|
5046 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5047 |
]. |
|
5048 |
^ self. |
|
5049 |
] ifFalse:[ |
|
5050 |
self copyFiles:selectedFiles to:destination |
|
5051 |
] |
|
5052 |
||
5053 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5054 |
! |
5055 |
||
3892 | 5056 |
deleteFile:aFile |
6373 | 5057 |
"delete the selected files/directories" |
3892 | 5058 |
|
5059 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5060 |
! |
|
5061 |
||
5062 |
deleteFiles:colOfFiles |
|
6373 | 5063 |
"delete some files/directories" |
5064 |
||
5081 | 5065 |
^ self deleteFiles:colOfFiles confirm:true. |
5066 |
! |
|
5067 |
||
5068 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5069 |
"delete some files/directories" |
5070 |
||
5673 | 5071 |
|delete result| |
3892 | 5072 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5073 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5074 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5075 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5076 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5077 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5078 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5079 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5080 |
]. |
5673 | 5081 |
result notNil ifTrue:[ |
5082 |
result ifFalse:[ |
|
5083 |
self notify:delete errorString. |
|
5753 | 5084 |
] ifTrue:[ |
5085 |
self updateListAfterDelete:colOfFiles. |
|
5086 |
] |
|
4394 | 5087 |
]. |
5673 | 5088 |
]. |
5089 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5090 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5091 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5092 |
! |
5093 |
||
6169 | 5094 |
eraseFiles:colOfFiles |
6373 | 5095 |
"erase (clear and delete) some files/directories" |
5096 |
||
6169 | 5097 |
^ self eraseFiles:colOfFiles confirm:true. |
5098 |
! |
|
5099 |
||
5100 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5101 |
"erase (clear and delete) some files/directories" |
5102 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5103 |
|deleteOperation result fileSize| |
6169 | 5104 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5105 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5106 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5107 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5108 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5109 |
ifTrue:[ |
5110 |
result := deleteOperation result. |
|
5111 |
] ifFalse:[ |
|
5112 |
ProgressIndicator |
|
5113 |
displayProgressNotifications:'Erasing' |
|
5114 |
abortable:true |
|
5115 |
at:nil |
|
5116 |
during:[ |
|
5117 |
result := deleteOperation result. |
|
5118 |
]. |
|
5119 |
]. |
|
5120 |
||
6169 | 5121 |
result notNil ifTrue:[ |
5122 |
result ifFalse:[ |
|
8294 | 5123 |
self notify:deleteOperation errorString. |
6169 | 5124 |
] ifTrue:[ |
5125 |
self updateListAfterDelete:colOfFiles. |
|
5126 |
] |
|
5127 |
]. |
|
5128 |
]. |
|
5129 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5130 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5131 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5132 |
! |
5133 |
||
3892 | 5134 |
moveFile:aSourceFile to:aDestFile |
6373 | 5135 |
"move a file/directory" |
3892 | 5136 |
|
5137 |
|move| |
|
5138 |
||
5961 | 5139 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5140 |
move result ifTrue:[ |
15346 | 5141 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5142 |
] ifFalse:[ |
4523 | 5143 |
self notify:move errorString. |
3892 | 5144 |
]. |
5145 |
self updateCurrentDirectory. |
|
5146 |
^ move result |
|
5147 |
! |
|
5148 |
||
5149 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5150 |
"move some files to aDirectory" |
5151 |
||
3892 | 5152 |
|move| |
5153 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5154 |
self withActivityIndicationDo:[ |
5961 | 5155 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5156 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5157 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5158 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5159 |
self updateCurrentDirectory. |
3892 | 5160 |
]. |
6373 | 5161 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5162 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5163 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5164 |
! |
5165 |
||
6107 | 5166 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5167 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5168 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5169 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5170 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5171 |
destinationDirectory := Dialog |
14588 | 5172 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5173 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5174 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5175 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5176 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5177 |
|
5789 | 5178 |
LastMoveDestination := destinationDirectory. |
13704 | 5179 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5180 |
self updateCurrentDirectoryWithReread. |
|
5181 |
||
7560 | 5182 |
|
5183 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5184 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5185 |
|
3892 | 5186 |
newDirectory |
5187 |
"ask for and create a new directory" |
|
5188 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5189 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5190 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5191 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5192 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5193 |
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
|
5194 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5195 |
]. |
4521 | 5196 |
|
5197 |
"/ 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
|
5198 |
selectedFiles := self currentSelectedFiles. |
4521 | 5199 |
selectedFiles size == 1 ifTrue:[ |
5200 |
singleSelectedFile := selectedFiles first. |
|
5201 |
||
5202 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5203 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5204 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5205 |
||
5206 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5207 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5208 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5209 |
]. |
|
5210 |
]. |
|
5211 |
]. |
|
5212 |
||
5961 | 5213 |
|
4521 | 5214 |
defaultAnswer notNil ifTrue:[ |
5961 | 5215 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5216 |
] ifFalse:[ |
5961 | 5217 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5218 |
]. |
5219 |
createOp result ifFalse:[ ^ self]. |
|
5220 |
newFile := createOp createdFile. |
|
3892 | 5221 |
newFile notNil ifTrue:[ |
4414 | 5222 |
self updateCurrentDirectory. |
3892 | 5223 |
] |
5224 |
! |
|
5225 |
||
5226 |
newFile |
|
5227 |
"ask for and create a new file" |
|
5228 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5229 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5230 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5231 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5232 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5233 |
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
|
5234 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5235 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5236 |
|
3982 | 5237 |
curFile := self firstSelectedFile. |
3892 | 5238 |
curFile notNil ifTrue:[ |
4414 | 5239 |
file := curFile. |
3892 | 5240 |
] ifFalse:[ |
4414 | 5241 |
file := directory. |
3892 | 5242 |
]. |
5961 | 5243 |
create := FileOperation createFileIn:file. |
3892 | 5244 |
create result ifFalse:[ ^ self]. |
5245 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
5246 |
! |
|
5247 |
||
5248 |
newHardLink |
|
5249 |
"ask for and create a hard link (unix only)" |
|
5250 |
||
6151 | 5251 |
self newLink:#hard. |
5252 |
! |
|
5253 |
||
5254 |
newLink:typeOfLink |
|
3892 | 5255 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5256 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5257 |
| sel dir create createdFile| |
3892 | 5258 |
|
7560 | 5259 |
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
|
5260 |
(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
|
5261 |
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
|
5262 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5263 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5264 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5265 |
|
6151 | 5266 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5267 |
create result ifFalse:[ ^ self]. |
5268 |
createdFile := create createdFile. |
|
5269 |
createdFile notNil ifTrue:[ |
|
6151 | 5270 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5271 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5272 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5273 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5274 |
] |
3892 | 5275 |
]. |
7560 | 5276 |
|
5277 |
"Modified: / 04-12-2006 / 13:15:15 / cg" |
|
3892 | 5278 |
! |
5279 |
||
5280 |
newSoftLink |
|
5281 |
"ask for and create a soft link (unix only)" |
|
5282 |
||
6151 | 5283 |
self newLink:#soft. |
3892 | 5284 |
! |
5285 |
||
5286 |
pasteFiles |
|
6373 | 5287 |
"paste from clipBoard" |
5288 |
||
5289 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5290 |
|
5291 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5292 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5293 |
|
5294 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5295 |
||
3892 | 5296 |
buffer := self clipboard copy. |
3982 | 5297 |
directories := self currentSelectedDirectories. |
5880 | 5298 |
directories size ~~ 1 ifTrue:[ |
4414 | 5299 |
|box dirStringCol| |
5880 | 5300 |
|
4414 | 5301 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5302 |
box := ListSelectionBox new. |
|
6373 | 5303 |
box title:'Paste into which directory ?'. |
4414 | 5304 |
box list:dirStringCol. |
5305 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5306 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5307 |
box destroy. |
3892 | 5308 |
] ifFalse:[ |
5880 | 5309 |
destination := directories anElement. |
3892 | 5310 |
]. |
6373 | 5311 |
|
5312 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5313 |
buffer files copy do:[:aFile| |
5314 |
aFile directory = destination ifTrue:[ |
|
5315 |
buffer files remove:aFile. |
|
5316 |
]. |
|
5317 |
]. |
|
5318 |
]. |
|
5319 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5320 |
copiedFiles notEmptyOrNil ifTrue:[ |
5321 |
thisIsAFileMoveOperation ifTrue:[ |
|
5322 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5323 |
]. |
|
5324 |
||
5325 |
"/ select those pasted files. |
|
5326 |
self updateCurrentDirectory:true. |
|
5327 |
self currentFileNameHolder value:copiedFiles values. |
|
5328 |
] |
|
3892 | 5329 |
! |
5330 |
||
5331 |
renameFile:aFile |
|
5332 |
"rename the selected file(s)" |
|
5333 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5334 |
^ self renameFiles:(Array with:aFile). |
3892 | 5335 |
! |
5336 |
||
4230 | 5337 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5338 |
"rename filename to newFileString" |
5339 |
||
5340 |
|rename| |
|
5341 |
||
5961 | 5342 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5343 |
rename result ifTrue:[ |
4230 | 5344 |
aBoolean ifTrue:[ |
5345 |
self updateAndSelect:(rename renamedFiles). |
|
5346 |
]. |
|
3892 | 5347 |
] ifFalse:[ |
4523 | 5348 |
self notify:rename errorString. |
3892 | 5349 |
]. |
5350 |
^ rename result |
|
5351 |
! |
|
5352 |
||
5353 |
renameFiles:aColOfFiles |
|
6373 | 5354 |
"rename some file(s)" |
3892 | 5355 |
|
5356 |
|rename| |
|
5357 |
||
5961 | 5358 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5359 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5360 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5361 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5362 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5363 |
^ rename |
3892 | 5364 |
! |
5365 |
||
5366 |
renameSelection |
|
5367 |
"rename the selected file(s)" |
|
5368 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5369 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5370 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5371 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5372 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5373 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5374 |
]. |
7560 | 5375 |
|
5376 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5377 |
! ! |
5378 |
||
4080 | 5379 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5380 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5381 |
bookmarksMenu |
3952 | 5382 |
<resource: #programMenu> |
5383 |
||
14941 | 5384 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5385 |
! |
|
5386 |
||
5387 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5388 |
<resource: #programMenu> |
|
5389 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5390 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5391 |
|
14941 | 5392 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5393 |
|
5394 |
"/ add the bookmark items ... |
|
5395 |
bookmarks := self class directoryBookmarks. |
|
5396 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5397 |
menu addSeparator. |
7763 | 5398 |
bookmarks do:[:dirName | |
12963 | 5399 |
menu addItem:(MenuItem |
5400 |
label:dirName asString |
|
5401 |
itemValue:[ |
|
5402 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5403 |
self setCurrentFileName:dirName. |
|
5404 |
]. |
|
5405 |
]). |
|
7763 | 5406 |
]. |
5407 |
]. |
|
4080 | 5408 |
menu findGuiResourcesIn:self. |
7763 | 5409 |
^ menu |
5410 |
||
11135 | 5411 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5412 |
! |
5413 |
||
5414 |
canBackward |
|
5415 |
^ self directoryHistory canBackward. |
|
5416 |
||
5417 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5418 |
! |
|
5419 |
||
5420 |
canForward |
|
5421 |
^ self directoryHistory canForward. |
|
5422 |
||
5423 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5424 |
! |
|
5425 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5426 |
gotoBookmarksMenu |
7763 | 5427 |
<resource: #programMenu> |
5428 |
||
14941 | 5429 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5430 |
! |
5431 |
||
3892 | 5432 |
menuDirHistory:backOrForward |
7763 | 5433 |
"initialize the history menu" |
5434 |
||
3892 | 5435 |
<resource: #programMenu > |
5436 |
||
7763 | 5437 |
|hist menu pathList currentSel currentPath| |
5438 |
||
5439 |
hist := self directoryHistory. |
|
5440 |
hist isEmpty ifTrue:[^ nil]. |
|
5441 |
||
3892 | 5442 |
backOrForward == #back ifTrue:[ |
6725 | 5443 |
currentSel := self currentSelectedDirectories. |
4347 | 5444 |
currentSel size == 1 ifTrue:[ |
5445 |
currentPath := currentSel first asString. |
|
5446 |
] ifFalse:[ |
|
5447 |
currentPath := nil. |
|
5448 |
]. |
|
7763 | 5449 |
pathList := hist getBackCollection. |
3892 | 5450 |
] ifFalse:[ |
7763 | 5451 |
pathList := hist getForwardCollection. |
3892 | 5452 |
]. |
4022 | 5453 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5454 |
|
6370 | 5455 |
pathList size > 30 ifTrue:[ |
5456 |
pathList := pathList copyTo:30 |
|
5457 |
]. |
|
7763 | 5458 |
|
5459 |
menu := Menu new. |
|
5460 |
||
3964 | 5461 |
pathList do:[:aPath| |
14593 | 5462 |
menu addItem:(MenuItem |
5463 |
label:aPath |
|
5464 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5465 |
translateLabel:false). |
|
3952 | 5466 |
]. |
7763 | 5467 |
menu findGuiResourcesIn:self. |
3892 | 5468 |
^ menu |
7763 | 5469 |
|
11783 | 5470 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5471 |
! |
5472 |
||
5473 |
menuDirHistoryBack |
|
5474 |
"initialize the directory menu |
|
5475 |
" |
|
5476 |
<resource: #programMenu > |
|
5477 |
||
5478 |
^ self menuDirHistory:#back. |
|
5479 |
! |
|
5480 |
||
5481 |
menuDirHistoryForward |
|
5482 |
"initialize the directory menu |
|
5483 |
" |
|
5484 |
<resource: #programMenu > |
|
5485 |
||
5486 |
^ self menuDirHistory:#forward. |
|
3906 | 5487 |
! |
5488 |
||
5489 |
menuFileHistory |
|
5490 |
"initialize the file history menu |
|
5491 |
" |
|
5492 |
<resource: #programMenu > |
|
5493 |
||
7763 | 5494 |
|menu hist text removeItem| |
3906 | 5495 |
|
5496 |
hist := self fileHistory. |
|
5497 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5498 |
|
7763 | 5499 |
menu := Menu new. |
5500 |
||
5501 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5502 |
aFileItem fileName exists ifTrue:[ |
12963 | 5503 |
menu addItem:(MenuItem |
5504 |
label: aFileItem fileName asString |
|
14593 | 5505 |
itemValue: |
5506 |
[ |
|
5507 |
self setCurrentFileName:(aFileItem fileName). |
|
5508 |
self openApplByFileItem:aFileItem |
|
5509 |
] |
|
5510 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5511 |
] ifFalse:[ |
7763 | 5512 |
"/ remove all not existing history entries |
5513 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5514 |
] |
3906 | 5515 |
]. |
7763 | 5516 |
menu addSeparator. |
5517 |
||
4080 | 5518 |
removeItem := MenuItem new. |
5519 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5520 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5521 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5522 |
removeItem label:text. |
11783 | 5523 |
removeItem |
5524 |
itemValue:[ |
|
5525 |
self fileHistory removeAll. |
|
5526 |
self enableFileHistory value:false. |
|
5527 |
]. |
|
3906 | 5528 |
menu addItem:removeItem. |
7763 | 5529 |
menu findGuiResourcesIn:self. |
3906 | 5530 |
^ menu |
7763 | 5531 |
|
11783 | 5532 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5533 |
! |
5534 |
||
4080 | 5535 |
sortMenu |
5536 |
<resource: #programMenu > |
|
5537 |
||
5538 |
|menu| |
|
5539 |
||
7763 | 5540 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5541 |
menu findGuiResourcesIn:self. |
5542 |
^ menu |
|
7763 | 5543 |
|
5544 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5545 |
! |
5546 |
||
5547 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5548 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5549 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5550 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5551 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5552 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5553 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5554 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5555 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5556 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5557 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5558 |
^ spec |
4080 | 5559 |
! |
5560 |
||
5561 |
viewInContentsBrowserMenu |
|
5009 | 5562 |
self |
5563 |
applicationNamed:#DirectoryContentsBrowser |
|
5564 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5565 |
||
5566 |
^ nil. |
|
4080 | 5567 |
! |
5568 |
||
3952 | 5569 |
visitedDirectoriesMenu |
5570 |
<resource: #programMenu > |
|
5571 |
||
5572 |
|menu histCopy text removeItem| |
|
5573 |
||
7763 | 5574 |
histCopy := self directoryHistory. |
5575 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5576 |
||
3952 | 5577 |
menu := Menu new. |
7763 | 5578 |
|
5579 |
histCopy do:[:aFile| |
|
12963 | 5580 |
menu addItem:(MenuItem |
5581 |
label:aFile asString |
|
5582 |
itemValue:[ |
|
5583 |
self setCurrentFileName:(aFile path asFilename). |
|
5584 |
]). |
|
7763 | 5585 |
]. |
5586 |
menu addSeparator. |
|
5587 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5588 |
"/ 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
|
5589 |
text := (resources string:'Clear History'). |
3952 | 5590 |
removeItem := MenuItem new. |
4040 | 5591 |
removeItem translateLabel:true. |
3952 | 5592 |
removeItem label:text. |
11783 | 5593 |
removeItem |
5594 |
itemValue:[ |
|
5595 |
self directoryHistory removeAll. |
|
5596 |
self enableForward value:self canForward. |
|
5597 |
self enableBack value:self canBackward. |
|
5598 |
]. |
|
7763 | 5599 |
|
3952 | 5600 |
menu addItem:removeItem. |
7763 | 5601 |
menu findGuiResourcesIn:self. |
3952 | 5602 |
^ menu |
7763 | 5603 |
|
11783 | 5604 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5605 |
! ! |
5606 |
||
5880 | 5607 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5608 |
||
5609 |
doCompareTwoFiles |
|
5610 |
self openDiffView. |
|
5611 |
! |
|
5612 |
||
5613 |
doGoDirectoryUp |
|
5960 | 5614 |
| upDir directory rootInTreeView| |
5880 | 5615 |
|
5616 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5617 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5618 |
directory := self currentDirectory. |
5619 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5620 |
] ifFalse:[ |
5621 |
rootInTreeView := self |
|
5622 |
applicationNamed:#DirectoryTreeBrowser |
|
5623 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5624 |
directory := rootInTreeView value asFilename. |
5625 |
]. |
|
5626 |
upDir := directory directory. |
|
5959 | 5627 |
self setCurrentFileName:upDir. |
5880 | 5628 |
! |
5629 |
||
5630 |
doGotoDefaultDirectory |
|
5631 |
self gotoFile:(Filename defaultDirectory). |
|
5632 |
! |
|
5633 |
||
8091 | 5634 |
doGotoDesktopDirectory |
5635 |
self gotoFile:(Filename desktopDirectory). |
|
5636 |
! |
|
5637 |
||
5880 | 5638 |
doGotoHomeDirectory |
8091 | 5639 |
self gotoFile:(Filename homeDirectory). |
5880 | 5640 |
! |
5641 |
||
6434 | 5642 |
doGotoSmalltalkDirectory |
5643 |
self gotoFile:(self smalltalkDirectory). |
|
5644 |
! |
|
5645 |
||
17187 | 5646 |
doGotoSmalltalkWorkspaceDirectory |
5647 |
self gotoFile:(UserPreferences current workspaceDirectory). |
|
5648 |
! |
|
5649 |
||
9677 | 5650 |
doGotoTempDirectory |
5651 |
self gotoFile:(self tempDirectory). |
|
5652 |
||
5653 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5654 |
! |
|
5655 |
||
9596 | 5656 |
doMakeCurrentDirectory |
17582 | 5657 |
<resource: #obsolete> |
5658 |
||
5659 |
"/ no longer |
|
5660 |
^ self |
|
5661 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
5662 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 5663 |
|
5664 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 5665 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 5666 |
! |
5667 |
||
5880 | 5668 |
fileGetInfo:longInfo |
5669 |
"get info on selected file - show it in a box" |
|
5670 |
||
5671 |
|string box updater| |
|
5672 |
||
5673 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5674 |
string notNil ifTrue:[ |
|
5675 |
box := InfoBox title:string. |
|
5676 |
updater := [ |
|
5677 |
[true] whileTrue:[ |
|
5678 |
Delay waitForSeconds:2. |
|
5679 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5680 |
string isNil ifTrue:[ ^ self]. |
|
5681 |
box title:string |
|
5682 |
] |
|
5683 |
] fork. |
|
5684 |
box show. |
|
5685 |
updater terminate. |
|
5686 |
box destroy |
|
5687 |
] |
|
6434 | 5688 |
! |
5689 |
||
17686 | 5690 |
showDeltaBetweenTwoImageFiles |
5691 |
|i1 i2 delta| |
|
5692 |
||
5693 |
i1 := Image fromFile:(self selectedFileNames first). |
|
5694 |
i2 := Image fromFile:(self selectedFileNames second). |
|
5695 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
5696 |
ImageView openOn:delta. |
|
5697 |
||
5698 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
5699 |
! |
|
5700 |
||
6434 | 5701 |
smalltalkDirectory |
8590 | 5702 |
|stxPath| |
6434 | 5703 |
|
5704 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 5705 |
stxPath isNil ifTrue:[ |
5706 |
^ Filename currentDirectory |
|
5707 |
]. |
|
5708 |
^ stxPath asFilename directory. |
|
9677 | 5709 |
! |
5710 |
||
5711 |
tempDirectory |
|
5712 |
^ Filename tempDirectory. |
|
5713 |
||
5714 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 5715 |
! ! |
5716 |
||
11139 | 5717 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
5718 |
||
14262 | 5719 |
addDirToJavaSourcePath |
5720 |
"add the current path to java's sourcePath |
|
5721 |
(only available with ST/J System" |
|
5722 |
||
5723 |
Java addToSourcePath:self currentDirectory pathName |
|
5724 |
||
5725 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
5726 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
5727 |
! |
|
5728 |
||
11139 | 5729 |
copyFiles |
5730 |
self |
|
5731 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
5732 |
! |
|
5733 |
||
5734 |
cutFiles |
|
5735 |
self |
|
5736 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
5737 |
! |
|
5738 |
||
5739 |
deleteFiles |
|
5740 |
self |
|
5741 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
5742 |
! |
|
5743 |
||
5744 |
eraseFiles |
|
5745 |
self |
|
5746 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
5747 |
! |
|
5748 |
||
14262 | 5749 |
fileAddToJavaSourcePath |
5750 |
"add the current path to java's sourcePath |
|
5751 |
(only available with ST/J System" |
|
5752 |
||
5753 |
self currentSelectedObjects do:[:each | |
|
5754 |
Java addToSourcePath:(each pathName) |
|
5755 |
]. |
|
5756 |
||
5757 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
5758 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
5759 |
! |
|
5760 |
||
11139 | 5761 |
openSettingsDialog |
5762 |
|dialog| |
|
5763 |
||
5764 |
dialog := FileBrowserV2SettingsDialog new. |
|
5765 |
dialog settingsDialog:self. |
|
5766 |
dialog allButOpen. |
|
5767 |
dialog doReload. |
|
5768 |
dialog openWindow |
|
5769 |
! |
|
5770 |
||
5771 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
5772 |
|files dirs| |
|
5773 |
||
5774 |
files := self currentSelectedFiles. |
|
5775 |
files notEmpty ifTrue:[ |
|
5776 |
aBlock value:files. |
|
5777 |
] ifFalse:[ |
|
5778 |
dirs := self currentSelectedDirectories. |
|
5779 |
dirs notEmpty ifTrue:[ |
|
5780 |
aBlock value:dirs. |
|
5781 |
]. |
|
5782 |
]. |
|
5783 |
! ! |
|
5784 |
||
5785 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
5786 |
||
5787 |
openAboutThisApplication |
|
5788 |
"opens an about box for this application." |
|
5789 |
||
5790 |
Dialog aboutClass:self class. |
|
5791 |
! |
|
5792 |
||
5793 |
openHTMLDocument:relativeDocPath |
|
5794 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
5795 |
! ! |
|
5796 |
||
5797 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 5798 |
|
15905 | 5799 |
canCvsAddAndCommit |
5800 |
||
5801 |
|selectedFiles| |
|
5802 |
||
5803 |
selectedFiles := self currentSelectedObjects. |
|
5804 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
5805 |
! |
|
5806 |
||
5807 |
canRemoveCVSContainer |
|
5808 |
^ self currentSelectedFiles |
|
5809 |
contains:[:fileName| |
|
5810 |
|dirOfFile cvsDir| |
|
5811 |
||
5812 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
5813 |
cvsDir := dirOfFile construct:'CVS'. |
|
5814 |
cvsDir isDirectory |
|
5815 |
]. |
|
5816 |
! |
|
5817 |
||
12777 | 5818 |
commitFilesToCVS:files |
5819 |
|numFiles| |
|
5820 |
||
5821 |
(numFiles := files size) > 0 ifTrue:[ |
|
5822 |
self withActivityIndicationDo:[ |
|
5823 |
self cvsCommitFiles:files |
|
5824 |
] |
|
5825 |
] |
|
5826 |
! |
|
5827 |
||
3892 | 5828 |
cvsAddAndCommit |
4849 | 5829 |
self cvsAddAndCommitAsBinary:false |
5830 |
! |
|
5831 |
||
5832 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 5833 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 5834 |
|
5835 |
log := Dialog |
|
11139 | 5836 |
requestText:(resources string:'Enter initial log message:') |
4414 | 5837 |
lines:10 |
5838 |
columns:70 |
|
5839 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
5840 |
log isNil ifTrue:[^ self]. |
3892 | 5841 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5842 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5843 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5844 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5845 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5846 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5847 |
|
8588 | 5848 |
binArg := ''. |
5849 |
asBinary ifTrue:[ |
|
5850 |
binArg := '-kb '. |
|
5851 |
]. |
|
3982 | 5852 |
sel := self currentSelectedFiles. |
11139 | 5853 |
executionBlock := |
5854 |
[:stream | |
|
5855 |
log notNil ifTrue:[ |
|
17416 | 5856 |
sel notEmptyOrNil ifTrue:[ |
11139 | 5857 |
sel do:[:fn | |
5858 |
|nameArg| |
|
5859 |
||
5860 |
nameArg := '"',fn baseName,'"'. |
|
5861 |
||
5862 |
dir := self getDirWithoutFileName:fn. |
|
5863 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
5864 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5865 |
||
5866 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5867 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 5868 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
5869 |
"/ support and need the 'admin -kb' command. |
|
5870 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
5871 |
asBinary ifTrue:[ |
|
5872 |
cmd := ('cvs admin -kb ' , nameArg). |
|
5873 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5874 |
||
5875 |
cmd := ('cvs upd ' , nameArg). |
|
5876 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5877 |
]. |
|
5878 |
] |
|
5879 |
] |
|
5880 |
] |
|
5881 |
]. |
|
4107 | 5882 |
nameString := 'Command> cvs add and commit'. |
3892 | 5883 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 5884 |
|
17416 | 5885 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 5886 |
! |
5887 |
||
4849 | 5888 |
cvsAddBinaryAndCommit |
5889 |
self cvsAddAndCommitAsBinary:true |
|
5890 |
! |
|
5891 |
||
3892 | 5892 |
cvsCommit |
12777 | 5893 |
|selectedFiles| |
3892 | 5894 |
|
3982 | 5895 |
selectedFiles:= self currentSelectedFiles. |
12777 | 5896 |
self cvsCommitFiles:selectedFiles |
5897 |
! |
|
5898 |
||
5899 |
cvsCommitFiles:files |
|
5900 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
5901 |
||
5902 |
nFiles := files size. |
|
5903 |
nFiles == 0 ifTrue:[^ self]. |
|
5904 |
||
5905 |
nFiles == 1 ifTrue:[ |
|
5906 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 5907 |
] ifFalse:[ |
12777 | 5908 |
nFiles > 1 ifTrue:[ |
5909 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 5910 |
] ifFalse:[ |
6627 | 5911 |
msg := resources string:'Enter log message for checkIn' |
4414 | 5912 |
] |
3892 | 5913 |
]. |
5914 |
||
5915 |
log := Dialog |
|
4414 | 5916 |
requestText:msg |
5917 |
lines:10 |
|
5918 |
columns:70 |
|
5919 |
initialAnswer:nil. |
|
3892 | 5920 |
|
4663 | 5921 |
log isNil ifTrue:[^ self]. |
12777 | 5922 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5923 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5924 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 5925 |
"/ save the log message into another tempFile ... |
13121 | 5926 |
s := FileStream newTemporary. |
5927 |
logTmp := s fileName. |
|
12777 | 5928 |
s nextPutAll:log. |
5929 |
s close. |
|
5930 |
||
5931 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5932 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5933 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5934 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5935 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5936 |
executionBlock := [:stream | |
12777 | 5937 |
[ |
5938 |
files do:[:fn | |
|
5939 |
| dir nameArg cmd | |
|
5940 |
||
5941 |
nameArg := '"',fn baseName,'"'. |
|
5942 |
dir := fn directory. |
|
5943 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
5944 |
stream showCR:fn pathName. |
|
5945 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 5946 |
] |
12777 | 5947 |
] ensure:[ |
5948 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5949 |
]. |
|
4107 | 5950 |
]. |
5951 |
nameString := 'Command> cvs commit'. |
|
5952 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 5953 |
! |
5954 |
||
14527 | 5955 |
cvsCommitFolder |
5956 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
5957 |
||
5958 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
5959 |
||
5960 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
5961 |
log := Dialog |
|
5962 |
requestText:msg |
|
5963 |
lines:10 |
|
5964 |
columns:70 |
|
5965 |
initialAnswer:nil. |
|
5966 |
||
5967 |
log isNil ifTrue:[^ self]. |
|
5968 |
log := log replChar:$" withString:'\"'. |
|
5969 |
||
5970 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5971 |
"/ save the log message into another tempFile ... |
|
5972 |
s := FileStream newTemporary. |
|
5973 |
logTmp := s fileName. |
|
5974 |
s nextPutAll:log. |
|
5975 |
s close. |
|
5976 |
||
5977 |
logArg := '-F "', logTmp pathName, '"'. |
|
5978 |
] ifFalse:[ |
|
5979 |
logArg := '-m ''' , log , ''''. |
|
5980 |
]. |
|
5981 |
||
5982 |
executionBlock := [:stream | |
|
5983 |
[ |
|
5984 |
|cmd| |
|
5985 |
||
5986 |
cmd := 'cvs commit ',logArg. |
|
5987 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5988 |
] ensure:[ |
|
5989 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5990 |
]. |
|
5991 |
]. |
|
5992 |
||
5993 |
nameString := 'Command> cvs commit'. |
|
5994 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
5995 |
! |
|
5996 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5997 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5998 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5999 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6000 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6001 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6002 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6003 |
|
15589 | 6004 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6005 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6006 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6007 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6008 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6009 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6010 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6011 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6012 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6013 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6014 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6015 |
|
15211 | 6016 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6017 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6018 |
||
6019 |
|toRemove updateRunning executionBlock nameString| |
|
6020 |
||
6021 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6022 |
self killAllRunningBackgroundProcesses. |
|
6023 |
toRemove := OrderedCollection new. |
|
6024 |
||
6025 |
executionBlock := |
|
6026 |
[:stream | |
|
6027 |
|cmd logArg prevDir prevFiles| |
|
6028 |
||
6029 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6030 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6031 |
] ifFalse:[ |
|
6032 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6033 |
]. |
|
6034 |
prevFiles := ''. |
|
6035 |
||
6036 |
filesToRemove do:[:fileName | |
|
6037 |
|dir file| |
|
6038 |
||
6039 |
dir := fileName directory. |
|
6040 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6041 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6042 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6043 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6044 |
prevFiles := ''. |
|
6045 |
]. |
|
6046 |
||
17116 | 6047 |
OsError handle:[:ex| |
15211 | 6048 |
"was not able to remove it" |
6049 |
| lastError msg | |
|
6050 |
lastError := OperatingSystem lastErrorString. |
|
6051 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6052 |
lastError isNil ifFalse:[ |
|
6053 |
msg := msg , '\\(' , lastError , ')' |
|
6054 |
]. |
|
6055 |
Dialog warn:msg withCRs |
|
6056 |
] do:[ |
|
6057 |
(fileName isSymbolicLink) ifFalse:[ |
|
6058 |
fileName remove. |
|
6059 |
file := fileName baseName. |
|
6060 |
cmd := ('cvs remove -f "',file,'"'). |
|
6061 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6062 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6063 |
] |
|
6064 |
]. |
|
6065 |
prevDir := dir. |
|
6066 |
prevFiles := prevFiles,' ',file. |
|
6067 |
]. |
|
6068 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6069 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6070 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6071 |
]. |
|
6072 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6073 |
filesToRemove size > 1 ifTrue:[ |
|
6074 |
nameString := nameString, ' ...'. |
|
6075 |
]. |
|
6076 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6077 |
! |
|
3892 | 6078 |
|
6079 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6080 |
|files| |
6081 |
||
6082 |
files := self currentSelectedFiles copy. |
|
6083 |
self removeFilesAndCVSContainers:files |
|
3892 | 6084 |
! |
6085 |
||
9338 | 6086 |
cvsRevisionLog |
6087 |
| cmd sel executionBlock nameString| |
|
6088 |
||
6089 |
sel := self currentSelectedObjects. |
|
6090 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6091 |
||
6092 |
executionBlock := [:stream | |
|
6093 |
sel do:[:fn | |
|
6094 |
| dir nameArg | |
|
6095 |
||
6096 |
nameArg := '"',fn baseName,'"'. |
|
6097 |
dir := fn directory. |
|
6098 |
cmd := 'cvs log ' , nameArg. |
|
6099 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6100 |
] |
|
6101 |
]. |
|
6102 |
nameString := 'Command> cvs log'. |
|
6103 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6104 |
! |
|
6105 |
||
8562 | 6106 |
cvsTagSelection |
12856 | 6107 |
|tag tags cmd| |
6108 |
||
6109 |
tag := Dialog |
|
6110 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6111 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6112 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6113 |
||
6114 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6115 |
|
6116 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6117 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6118 |
] ifFalse:[ |
|
6119 |
cmd := 'cvs'. |
|
6120 |
]. |
|
6121 |
||
12856 | 6122 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6123 |
tags do:[:eachTag | |
|
6124 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6125 |
bindWith:cmd |
|
12858 | 6126 |
with:(eachTag withoutSeparators) |
12856 | 6127 |
with:(self makeFileNameArgumentString)) |
6128 |
]. |
|
8562 | 6129 |
! |
6130 |
||
3892 | 6131 |
cvsUpdateAll |
6132 |
| cmd | |
|
6133 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6134 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6135 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6136 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6137 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6138 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6139 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6140 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6141 |
! |
6142 |
||
6143 |
cvsUpdateAllRecursive |
|
6144 |
| cmd | |
|
6145 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6146 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6147 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6148 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6149 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6150 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6151 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6152 |
! |
6153 |
||
6154 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6155 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6156 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6157 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6158 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6159 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6160 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6161 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6162 |
|
15589 | 6163 |
stream := CharacterWriteStream new. |
8563 | 6164 |
stream |
6165 |
nextPutAll:cmd; |
|
6166 |
nextPutAll:' upd '; |
|
6167 |
nextPutAll:(self makeFileNameArgumentString). |
|
6168 |
||
6169 |
self executeCommand:stream contents. |
|
6170 |
! |
|
6171 |
||
6172 |
makeFileNameArgumentString |
|
6173 |
|stream| |
|
6174 |
||
15589 | 6175 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6176 |
self currentSelectedFiles do:[: file | |
8563 | 6177 |
stream nextPut:$". |
4414 | 6178 |
stream nextPutAll:file baseName. |
8563 | 6179 |
stream nextPutAll:'" '. |
6180 |
]. |
|
6181 |
^ stream contents. |
|
12493 | 6182 |
! |
6183 |
||
6184 |
removeFilesAndCVSContainers:files |
|
6185 |
|numFiles question aswer| |
|
6186 |
||
6187 |
(numFiles := files size) > 0 ifTrue:[ |
|
6188 |
numFiles > 1 ifTrue:[ |
|
6189 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6190 |
] ifFalse:[ |
|
6191 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6192 |
]. |
|
6193 |
||
6194 |
aswer := Dialog |
|
6195 |
confirm:question withCRs |
|
6196 |
yesLabel:(resources string:'Remove') |
|
6197 |
noLabel:(resources string:'Cancel'). |
|
6198 |
||
6199 |
aswer ifTrue:[ |
|
6200 |
self withActivityIndicationDo:[ |
|
6201 |
self cvsRemoveAndRemoveFromCVS:files |
|
6202 |
] |
|
6203 |
] |
|
6204 |
] |
|
3892 | 6205 |
! ! |
6206 |
||
14126 | 6207 |
|
11139 | 6208 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6209 |
||
6210 |
mercurialAdd |
|
6211 |
|executionBlock sel maxCmdSize| |
|
6212 |
||
6213 |
maxCmdSize := 512. |
|
6214 |
||
6215 |
sel := self currentSelectedObjects. |
|
6216 |
sel isEmptyOrNil ifTrue:[ |
|
6217 |
^ self |
|
6218 |
]. |
|
6219 |
||
6220 |
executionBlock := |
|
6221 |
[:stream | |
|
6222 |
|prevDir cmd| |
|
6223 |
||
6224 |
prevDir := nil. |
|
6225 |
sel do:[:fn | |
|
6226 |
|nameArg dir| |
|
6227 |
||
6228 |
nameArg := '"',fn baseName,'"'. |
|
6229 |
dir := fn directory. |
|
6230 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6231 |
"/ flush |
|
6232 |
cmd notNil ifTrue:[ |
|
6233 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6234 |
cmd := nil. |
|
6235 |
] |
|
6236 |
]. |
|
6237 |
cmd isNil ifTrue:[ |
|
6238 |
cmd := 'hg add'. |
|
6239 |
]. |
|
6240 |
cmd := cmd,' ',nameArg. |
|
6241 |
prevDir := dir. |
|
6242 |
]. |
|
6243 |
cmd notNil ifTrue:[ |
|
6244 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6245 |
cmd := nil. |
|
6246 |
]. |
|
6247 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6248 |
]. |
|
6249 |
||
6250 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6251 |
||
6252 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6253 |
! |
|
6254 |
||
6255 |
mercurialCommit |
|
6256 |
|dir executionBlock| |
|
6257 |
||
6258 |
"/ dir := self currentDirectory. |
|
6259 |
dir := self directoryContentsBrowser directory. |
|
6260 |
executionBlock := |
|
6261 |
[:stream | |
|
6262 |
(self getExecutionBlockForCommand:'hg commit' |
|
6263 |
inDirectory:dir) value:stream. |
|
6264 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6265 |
]. |
11139 | 6266 |
|
6267 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6268 |
||
6269 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6270 |
! |
|
6271 |
||
11144 | 6272 |
mercurialInit |
6273 |
|dir executionBlock| |
|
6274 |
||
6275 |
dir := self directoryContentsBrowser directory. |
|
6276 |
||
6277 |
(Dialog confirm:(resources |
|
6278 |
string:'Initialize new Mercurial Repository in %1?' |
|
6279 |
with:dir baseName)) ifFalse:[^ self]. |
|
6280 |
||
6281 |
executionBlock := |
|
6282 |
[:stream | |
|
6283 |
(self getExecutionBlockForCommand:('hg init') |
|
6284 |
inDirectory:dir) value:stream. |
|
6285 |
]. |
|
6286 |
||
6287 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6288 |
||
6289 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6290 |
! |
|
6291 |
||
11139 | 6292 |
mercurialPush |
6293 |
|destination dir executionBlock| |
|
6294 |
||
6295 |
destination := Dialog request:'Mercurial Repository' |
|
6296 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6297 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6298 |
||
6299 |
LastMercurialRepository := destination. |
|
6300 |
||
6301 |
dir := self directoryContentsBrowser directory. |
|
6302 |
executionBlock := |
|
6303 |
[:stream | |
|
6304 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6305 |
inDirectory:dir) value:stream. |
|
6306 |
]. |
|
6307 |
||
6308 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6309 |
||
6310 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6311 |
! |
|
6312 |
||
6313 |
mercurialStatus |
|
6314 |
|executionBlock sel maxCmdSize| |
|
6315 |
||
6316 |
maxCmdSize := 512. |
|
6317 |
||
6318 |
sel := self currentSelectedObjects. |
|
6319 |
sel isEmptyOrNil ifTrue:[ |
|
6320 |
^ self |
|
6321 |
]. |
|
6322 |
||
6323 |
executionBlock := |
|
6324 |
[:stream | |
|
6325 |
|prevDir cmd| |
|
6326 |
||
6327 |
prevDir := nil. |
|
6328 |
sel do:[:fn | |
|
6329 |
|nameArg dir| |
|
6330 |
||
6331 |
nameArg := '"',fn baseName,'"'. |
|
6332 |
dir := fn directory. |
|
6333 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6334 |
"/ flush |
|
6335 |
cmd notNil ifTrue:[ |
|
6336 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6337 |
cmd := nil. |
|
6338 |
] |
|
6339 |
]. |
|
6340 |
cmd isNil ifTrue:[ |
|
6341 |
cmd := 'hg status'. |
|
6342 |
]. |
|
6343 |
cmd := cmd,' ',nameArg. |
|
6344 |
prevDir := dir. |
|
6345 |
]. |
|
6346 |
cmd notNil ifTrue:[ |
|
6347 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6348 |
cmd := nil. |
|
6349 |
]. |
|
6350 |
]. |
|
6351 |
||
6352 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6353 |
||
6354 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6355 |
! ! |
6356 |
||
4849 | 6357 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6358 |
|
8510 | 6359 |
allFilesInSelectedDirectoriesForWhich:aBlock |
6360 |
|directories allFiles| |
|
6361 |
||
6362 |
directories := self currentSelectedDirectories. |
|
6363 |
directories isEmpty ifTrue:[^ self]. |
|
6364 |
||
6365 |
allFiles := OrderedCollection new. |
|
6366 |
directories do:[:dir| |
|
6367 |
[ |
|
6368 |
|fileNames| |
|
6369 |
||
6370 |
fileNames := dir directoryContents. |
|
6371 |
fileNames notNil ifTrue:[ |
|
6372 |
fileNames := fileNames |
|
6373 |
collect:[:fn | dir construct:fn] |
|
6374 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
6375 |
allFiles addAll:fileNames. |
|
6376 |
] |
|
6377 |
] on:FileStream openErrorSignal do:[:ex| |
|
6378 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
|
6379 |
with:ex pathName |
|
6380 |
with:ex description). |
|
6381 |
ex proceedWith:nil. |
|
6382 |
]. |
|
6383 |
]. |
|
6384 |
||
6385 |
^ allFiles |
|
6386 |
! |
|
6387 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6388 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6389 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6390 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6391 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6392 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6393 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6394 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6395 |
"/ 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
|
6396 |
"/ 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
|
6397 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6398 |
conv := OrderedCollection new. |
4722 | 6399 |
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
|
6400 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6401 |
outSuffix = 'png' ifTrue:[ |
4722 | 6402 |
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
|
6403 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6404 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6405 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6406 |
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
|
6407 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6408 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6409 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6410 |
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
|
6411 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6412 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6413 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6414 |
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
|
6415 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6416 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6417 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6418 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6419 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6420 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6421 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6422 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6423 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6424 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6425 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6426 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6427 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6428 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6429 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6430 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6431 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6432 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6433 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6434 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6435 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6436 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6437 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6438 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6439 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6440 |
|
4367 | 6441 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6442 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6443 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6444 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6445 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6446 |
self convertImageToSuffix:'jpg' |
4531 | 6447 |
! |
6448 |
||
6449 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6450 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6451 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6452 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6453 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6454 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6455 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6456 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6457 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6458 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6459 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6460 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6461 |
fileName isDirectory ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6462 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6463 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6464 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6465 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6466 |
outFile exists ifTrue:[ |
4722 | 6467 |
|answer| |
6468 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6469 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6470 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6471 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6472 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6473 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6474 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6475 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6476 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6477 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6478 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6479 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6480 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6481 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6482 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6483 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6484 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6485 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6486 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6487 |
]. |
9493
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 |
self updateAndSelect:nil. |
4367 | 6490 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6491 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6492 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6493 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6494 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6495 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6496 |
"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
|
6497 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6498 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6499 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6500 |
self convertImageToSuffix:'xpm' |
4367 | 6501 |
! |
6502 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6503 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6504 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6505 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6506 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6507 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6508 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6509 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6510 |
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
|
6511 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6512 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6513 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6514 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6515 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6516 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6517 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6518 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6519 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6520 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6521 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6522 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6523 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6524 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6525 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6526 |
]. |
13121 | 6527 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6528 |
XPMReader save:image onStream:tempStreamXPM. |
|
6529 |
tempStreamXPM close. |
|
6530 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6531 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6532 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6533 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6534 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6535 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6536 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6537 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6538 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6539 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6540 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6541 |
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
|
6542 |
|
13121 | 6543 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6544 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6545 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6546 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6547 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6548 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6549 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6550 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6551 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6552 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6553 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6554 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6555 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6556 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6557 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6558 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6559 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6560 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6561 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6562 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6563 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6564 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6565 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6566 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6567 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6568 |
] ifCurtailed:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6569 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6570 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6571 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6572 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6573 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6574 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6575 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6576 |
|
3892 | 6577 |
createProjectAndOpenProjectBrowser |
6578 |
|nm f s directory| |
|
6579 |
||
6580 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6581 |
directory := self currentDirectory. |
3892 | 6582 |
nm := directory baseName. |
6583 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6584 |
f exists ifTrue:[ |
|
4414 | 6585 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6586 |
^ self. |
|
3892 | 6587 |
]. |
6588 |
s := f writeStream. |
|
6589 |
s nextPutAll:' |
|
6590 |
name ''' , nm , ''' |
|
6591 |
type #classLibrary |
|
6592 |
package #''private:' , nm , ''' |
|
6593 |
prerequisites nil |
|
6594 |
||
6595 |
classes #( ) |
|
6596 |
'. |
|
6597 |
s close. |
|
6598 |
ProjectBrowser openOnFile:f. |
|
6599 |
! |
|
6600 |
||
5880 | 6601 |
doExecuteCommand |
6602 |
"execute an OperatingSystem-command" |
|
6603 |
||
6604 |
| action fileName| |
|
6605 |
||
6606 |
fileName := self firstSelectedFile. |
|
6607 |
action := [:command | |
|
6608 |
self addToCommandHistory:command for:fileName. |
|
6609 |
self executeCommand:command. |
|
6610 |
]. |
|
6611 |
self askForCommandFor:fileName thenDo:action |
|
6612 |
! |
|
6613 |
||
6614 |
doExecuteScript |
|
16941 | 6615 |
"execute a Smalltalk script" |
5880 | 6616 |
|
6617 |
|textHolder dialog template dummyClass dummyInstance| |
|
6618 |
||
6619 |
template := |
|
6620 |
'"/ Smalltalk script: |
|
6621 |
||
16084 | 6622 |
"/ the following variables are accessible: |
5880 | 6623 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6624 |
"/ selectedFiles (= ...) |
|
6625 |
"/ |
|
6626 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6627 |
"/ |
|
6628 |
"/ Useful operations are: |
|
6629 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6630 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6631 |
"/ directory directory |
|
6632 |
"/ |
|
6633 |
"/ example: move all files which match a aarticular pattern to |
|
6634 |
"/ a separate directory: |
|
6635 |
"/ |
|
6636 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6637 |
"/ |
|
6638 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6639 |
"/ |
|
6640 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6641 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6642 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6643 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6644 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6645 |
"/ newDir := directory construct:prefix. |
|
6646 |
"/ newDir exists ifFalse:[ |
|
6647 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6648 |
"/ newDir makeDirectory. |
|
6649 |
"/ ]. |
|
6650 |
"/ ]. |
|
6651 |
"/ newDir exists ifTrue:[ |
|
6652 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6653 |
"/ newFile := newDir construct:rest. |
|
6654 |
"/ oldFile moveTo:newFile |
|
6655 |
"/ ] |
|
6656 |
"/ ] |
|
6657 |
"/ ] |
|
6658 |
'. |
|
6659 |
||
6660 |
LastScriptBlockString isNil ifTrue:[ |
|
6661 |
LastScriptBlockString := template. |
|
6662 |
]. |
|
6663 |
||
6664 |
textHolder := ValueHolder new. |
|
6665 |
dialog := Dialog |
|
6666 |
forRequestText:(resources string:'Enter script') |
|
6667 |
editViewClass:CodeView |
|
6668 |
lines:25 |
|
6669 |
columns:70 |
|
6670 |
initialAnswer:LastScriptBlockString |
|
6671 |
model:textHolder. |
|
6672 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
6673 |
dialog open. |
|
6674 |
dialog accepted ifFalse:[^ self]. |
|
6675 |
||
6676 |
LastScriptBlockString := textHolder value. |
|
6677 |
||
6678 |
Class classConventionViolationConfirmationQuerySignal |
|
6679 |
answer:true |
|
6680 |
do:[ |
|
6681 |
dummyClass := Object class |
|
6682 |
name:#Dummy |
|
6683 |
inEnvironment:nil |
|
6684 |
subclassOf:Object |
|
6685 |
instanceVariableNames:'directory selectedFiles' |
|
6686 |
variable:false |
|
6687 |
words:true |
|
6688 |
pointers:true |
|
6689 |
classVariableNames:'' |
|
6690 |
poolDictionaries:'' |
|
6691 |
category:#dummyCategory |
|
6692 |
comment:nil |
|
6693 |
changed:true. |
|
6694 |
]. |
|
6695 |
||
6696 |
dummyInstance := dummyClass basicNew. |
|
6697 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
6698 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
6699 |
||
6700 |
Compiler |
|
6701 |
evaluate:textHolder value |
|
6702 |
in:nil |
|
6703 |
receiver:dummyInstance |
|
6704 |
notifying:nil |
|
6705 |
logged:false |
|
6706 |
ifFail:[] |
|
6707 |
compile:true. |
|
6708 |
||
6709 |
"/ fileName := self firstSelectedFile. |
|
6710 |
"/ action := [:command | |
|
6711 |
"/ self addToCommandHistory:command for:fileName. |
|
6712 |
"/ self executeCommand:command. |
|
6713 |
"/ ]. |
|
6714 |
"/ self askForCommandFor:fileName thenDo:action |
|
6715 |
! |
|
6716 |
||
4230 | 6717 |
doMake |
7938 | 6718 |
|dir cmd| |
4230 | 6719 |
|
13856 | 6720 |
cmd := self makeCommandHolder value. |
6721 |
||
6722 |
"Make" |
|
6723 |
cmd = 'make' ifTrue:[ |
|
6724 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6725 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6726 |
dir notNil ifTrue:[ |
|
6727 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
6728 |
cmd := 'bmake.bat'. |
|
6729 |
] |
|
7938 | 6730 |
] |
13856 | 6731 |
]. |
6732 |
self executeCommand:cmd. |
|
6733 |
^self. |
|
6734 |
]. |
|
6735 |
||
6736 |
"Apache ant" |
|
6737 |
cmd = 'ant' ifTrue:[ |
|
6738 |
self executeCommand:cmd. |
|
6739 |
^self. |
|
6740 |
]. |
|
6741 |
||
6742 |
"Add more here..." |
|
6743 |
||
6744 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 6745 |
! |
6746 |
||
8256 | 6747 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6748 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6749 |
(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
|
6750 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6751 |
|
8256 | 6752 |
|destDir| |
6753 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6754 |
(CBrowser isNil or:[ CBrowser::Browser isNil ]) ifTrue:[ |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6755 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6756 |
]. |
8256 | 6757 |
destDir := self currentDirectory. |
6758 |
CBrowser::Browser openIn:destDir pathName |
|
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6759 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6760 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6761 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
8256 | 6762 |
! |
6763 |
||
7829 | 6764 |
doOpenExplorer |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6765 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6766 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6767 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
7829 | 6768 |
! |
6769 |
||
12473 | 6770 |
doOpenFinder |
6771 |
self currentDirectory asFilename openFinder |
|
6772 |
||
6773 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
6774 |
! |
|
6775 |
||
12811 | 6776 |
doOpenMonticelloBrowser |
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6777 |
MCMczReader isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/monticello']. |
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6778 |
|
12811 | 6779 |
self withWaitCursorDo:[ |
6780 |
self currentSelectedFiles do:[:fn | |
|
6781 |
|version snapshot| |
|
6782 |
||
6783 |
fn suffix asLowercase = 'mcz' ifTrue:[ |
|
6784 |
version := MCMczReader versionFromFile:fn. |
|
6785 |
snapshot := version snapshot. |
|
6786 |
(Tools::ChangeSetBrowser2 |
|
6787 |
on: snapshot asChangeSet |
|
6788 |
label: version info name) |
|
6789 |
beTwoColumn; |
|
6790 |
targetNamespace:nil; |
|
6791 |
targetPackage:nil; |
|
6792 |
open |
|
6793 |
] |
|
6794 |
] |
|
6795 |
] |
|
6796 |
! |
|
6797 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6798 |
doOpenSettings |
8168 | 6799 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6800 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6801 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6802 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6803 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6804 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6805 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6806 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6807 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6808 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6809 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6810 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6811 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6812 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6813 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6814 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6815 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6816 |
|
7104 | 6817 |
editMode:aSymbol |
6818 |
self |
|
6819 |
applicationNamed:#FileApplicationNoteBook |
|
6820 |
ifPresentDo:[:appl | |
|
6821 |
|subApp| |
|
6822 |
||
6823 |
subApp := appl selectedApplication. |
|
6824 |
subApp notNil ifTrue:[ |
|
6825 |
^ subApp perform:aSymbol |
|
6826 |
] |
|
6827 |
]. |
|
6828 |
||
6829 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
6830 |
! |
|
6831 |
||
6832 |
editModeInsert |
|
6833 |
self editMode:#editModeInsert |
|
6834 |
||
6835 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
6836 |
! |
|
6837 |
||
6838 |
editModeInsertAndSelect |
|
6839 |
self editMode:#editModeInsertAndSelect |
|
6840 |
||
6841 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
6842 |
! |
|
6843 |
||
6844 |
editModeOverwrite |
|
6845 |
self editMode:#editModeOverwrite |
|
6846 |
||
6847 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
6848 |
! |
|
6849 |
||
15528 | 6850 |
fetchFileByURL |
6851 |
|url destinationFilename| |
|
6852 |
||
6853 |
url := Dialog request:'URL to Fetch:' initialAnswer:'http://host/path'. |
|
6854 |
url isEmptyOrNil ifTrue:[^ self]. |
|
6855 |
url := url asURL. |
|
6856 |
||
6857 |
destinationFilename := Dialog request:'Download As:' initialAnswer:(UnixFilename named:url path) baseName. |
|
6858 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
|
6859 |
||
6860 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
6861 |
destinationFilename exists ifTrue:[ |
|
6862 |
|answer| |
|
6863 |
||
6864 |
answer := Dialog |
|
6865 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
6866 |
default:false. |
|
6867 |
answer ~~ true ifTrue:[^ self]. |
|
6868 |
]. |
|
6869 |
self withActivityIndicationDo:[ |
|
6870 |
self notify:(resources string:'Fetching %1' with:url). |
|
6871 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
6872 |
self notify:nil. |
|
6873 |
] |
|
6874 |
||
6875 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
|
6876 |
! |
|
6877 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6878 |
fileContentsAsByteArray |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6879 |
|file| |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6880 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6881 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6882 |
file isNil ifTrue:[^ self ]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6883 |
file asFilename fileSize > (1024*1024) ifTrue:[ |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6884 |
file asFilename fileSize > (128*1024*1024) ifTrue:[ |
11889 | 6885 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6886 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6887 |
]. |
11889 | 6888 |
(Dialog confirm:(resources string:'File is big - proceed ?')) ifFalse:[^ self]. |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6889 |
]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6890 |
file asFilename binaryContentsOfEntireFile inspect |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6891 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6892 |
|
3892 | 6893 |
fileFileIn |
6894 |
"fileIn the selected file(s)" |
|
6895 |
||
6896 |
self fileFileInLazy:false |
|
6897 |
! |
|
6898 |
||
7324 | 6899 |
fileFileIn:aFilename lazy:lazy |
6900 |
"fileIn a file" |
|
6901 |
||
6902 |
self withActivityIndicationDo:[ |
|
6903 |
self notify:('File in:', aFilename asFilename baseName). |
|
6904 |
self singleFileFileIn:aFilename lazy:lazy. |
|
6905 |
self notify:nil. |
|
6906 |
] |
|
6907 |
||
6908 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
6909 |
! |
|
6910 |
||
3892 | 6911 |
fileFileInLazy |
6912 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
6913 |
||
6914 |
self fileFileInLazy:true |
|
6915 |
! |
|
6916 |
||
6917 |
fileFileInLazy:lazy |
|
6918 |
"fileIn the selected file(s)" |
|
6919 |
||
7324 | 6920 |
self currentSelectedFiles do:[:fileName | |
6921 |
self fileIn:fileName lazy:lazy |
|
6922 |
]. |
|
6923 |
||
6924 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 6925 |
! |
6926 |
||
12497 | 6927 |
fileFileInPackage |
6928 |
"assuming the current directory is a package directory, load it" |
|
6929 |
||
6930 |
|packageDir dir path top packageID| |
|
6931 |
||
6932 |
"/ find a reasonable package-id (walk up until we find stx) |
|
6933 |
path := ''. |
|
6934 |
dir := packageDir := self currentDirectory. |
|
6935 |
||
6936 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
6937 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
6938 |
path := dir baseName , '/' , path. |
|
6939 |
dir := dir directory. |
|
6940 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6941 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 6942 |
"/ should ask the user for a packageID and proceed... |
6943 |
^ self. |
|
6944 |
]. |
|
6945 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6946 |
packageID := path copyButLast:1. |
12497 | 6947 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
6948 |
! |
|
6949 |
||
3892 | 6950 |
fileFileInToNameSpace |
6951 |
"fileIn the selected file(s)<into a nameSpace" |
|
6952 |
||
6953 |
|ns listOfKnownNameSpaces| |
|
6954 |
||
6955 |
listOfKnownNameSpaces := Set new. |
|
6956 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
6957 |
allNameSpaces |
4414 | 6958 |
do:[:eachNameSpace | |
6959 |
listOfKnownNameSpaces add:eachNameSpace name |
|
6960 |
]. |
|
3892 | 6961 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
6962 |
||
6963 |
ns := Dialog |
|
4414 | 6964 |
request:'During fileIn, new classes are created in nameSpace:' |
6965 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
6966 |
list:listOfKnownNameSpaces. |
|
3892 | 6967 |
ns isEmptyOrNil ifTrue:[^ self]. |
6968 |
||
6969 |
LastEnforcedNameSpace := ns. |
|
6970 |
ns := NameSpace name:ns. |
|
6971 |
||
6972 |
Class nameSpaceQuerySignal |
|
4414 | 6973 |
answer:ns |
6974 |
do:[ |
|
6975 |
self fileFileInLazy:false |
|
6976 |
] |
|
3892 | 6977 |
! |
6978 |
||
6979 |
fileFindAllDuplicates |
|
6980 |
"scan directory and all subdirs for duplicate files" |
|
6981 |
||
6982 |
|fileNames dir infoDir filesBySize |
|
6983 |
result info dirPrefix myName stream textBox maxLength directories| |
|
6984 |
||
6985 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6986 |
self withActivityIndicationDo:[ |
4414 | 6987 |
result := Dictionary new. |
6988 |
myName := self class name asString. |
|
6989 |
directories := self currentSelectedDirectories. |
|
6990 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 6991 |
|
4414 | 6992 |
dir := directories first. |
3892 | 6993 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6994 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6995 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6996 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 6997 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
6998 |
with:ex pathName |
|
6999 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7000 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7001 |
]. |
4765 | 7002 |
fileNames := fileNames |
7003 |
collect:[:fn | dir construct:fn] |
|
7004 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 7005 |
|
7006 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7007 |
infoDir := Dictionary new. |
7008 |
fileNames do:[:fn | |
|
7009 |
infoDir at:fn put:(fn fileSize) |
|
7010 |
]. |
|
7011 |
||
14497 | 7012 |
"/ for each, get the file's size. |
4414 | 7013 |
"/ in a first pass, look for files of the same size and |
7014 |
"/ compare them ... |
|
3892 | 7015 |
|
7016 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7017 |
filesBySize := Dictionary new. |
7018 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7019 |
|entry| |
|
7020 |
||
7021 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7022 |
entry add:fn. |
|
7023 |
]. |
|
7024 |
||
7025 |
"/ any of same size ? |
|
3892 | 7026 |
|
7027 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7028 |
filesBySize do:[:entry | |
7029 |
|files| |
|
7030 |
||
7031 |
entry size > 1 ifTrue:[ |
|
7032 |
files := entry asArray. |
|
7033 |
1 to:files size-1 do:[:idx1 | |
|
7034 |
idx1+1 to:files size do:[:idx2 | |
|
7035 |
|fn1 fn2| |
|
7036 |
||
7037 |
fn1 := files at:idx1. |
|
7038 |
fn2 := files at:idx2. |
|
3892 | 7039 |
|
7040 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7041 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7042 |
"/ compare the files |
|
7043 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7044 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7045 |
result at:fn1 put:fn2. |
7046 |
] |
|
7047 |
] |
|
7048 |
] |
|
7049 |
] |
|
7050 |
] |
|
7051 |
]. |
|
3892 | 7052 |
|
7053 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7054 |
dirPrefix := dir pathName. |
7055 |
result := result associations. |
|
7056 |
result := result collect:[:assoc | |
|
7057 |
|f1 f2| |
|
7058 |
||
7059 |
f1 := assoc key name. |
|
7060 |
f2 := assoc value name. |
|
7061 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7062 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7063 |
]. |
|
7064 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7065 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7066 |
]. |
|
7067 |
f1 < f2 ifTrue:[ |
|
7068 |
f2 -> f1 |
|
7069 |
] ifFalse:[ |
|
7070 |
f1 -> f2 |
|
7071 |
] |
|
7072 |
]. |
|
7073 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7074 |
||
7075 |
info := OrderedCollection new. |
|
7076 |
result do:[:assoc | |
|
7077 |
info add:(assoc key , ' same as ' , assoc value) |
|
7078 |
]. |
|
7079 |
info isEmpty ifTrue:[ |
|
11889 | 7080 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7081 |
^ self. |
4414 | 7082 |
]. |
3892 | 7083 |
]. |
7084 |
||
15589 | 7085 |
stream := CharacterWriteStream new. |
11688 | 7086 |
stream nextPutAllLines:info. |
5542 | 7087 |
|
3892 | 7088 |
textBox := TextBox new. |
7089 |
textBox initialText:(stream contents). |
|
5542 | 7090 |
stream close. |
11889 | 7091 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7092 |
textBox readOnly:true. |
7093 |
textBox noCancel. |
|
11889 | 7094 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7095 |
maxLength := 10. |
7096 |
info do:[: el | |
|
4414 | 7097 |
maxLength := maxLength max:(el size). |
3892 | 7098 |
]. |
7099 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7100 |
textBox maxExtent:Screen current extent. |
7101 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7102 |
|
11688 | 7103 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7104 |
! |
7105 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7106 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7107 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7108 |
|
10306 | 7109 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7110 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7111 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7112 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7113 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7114 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7115 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7116 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7117 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7118 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7119 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7120 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7121 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7122 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7123 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7124 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7125 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7126 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7127 |
eachFile isDirectory ifFalse:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7128 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7129 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7130 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7131 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7132 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7133 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7134 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7135 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7136 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7137 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7138 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7139 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7140 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7141 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7142 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7143 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7144 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7145 |
|
15589 | 7146 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7147 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7148 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7149 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7150 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7151 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7152 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7153 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7154 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7155 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7156 |
]. |
10306 | 7157 |
stream nextPutLine:'Files without duplicates:'. |
7158 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7159 |
do:[:origFile | |
|
7160 |
|sameFiles| |
|
7161 |
||
7162 |
sameFiles := samePerFile at:origFile. |
|
7163 |
sameFiles isEmpty ifTrue:[ |
|
7164 |
stream nextPutLine:origFile baseName. |
|
7165 |
]. |
|
7166 |
]. |
|
7167 |
||
7168 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7169 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7170 |
LastMustMatchPattern := mustHaveMatches. |
|
7171 |
||
7172 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7173 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7174 |
do:[:origFile | |
|
7175 |
|sameFiles| |
|
7176 |
||
7177 |
sameFiles := samePerFile at:origFile. |
|
7178 |
sameFiles notEmpty ifTrue:[ |
|
7179 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7180 |
stream nextPutLine:origFile baseName. |
|
7181 |
] |
|
7182 |
]. |
|
7183 |
]. |
|
7184 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7185 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7186 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7187 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7188 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7189 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7190 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7191 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7192 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7193 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7194 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7195 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7196 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7197 |
|
3892 | 7198 |
fileFindDuplicates |
7199 |
"scan directory for duplicate files" |
|
7200 |
||
8510 | 7201 |
|infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
7202 |
||
7203 |
directories := self currentSelectedDirectories. |
|
3892 | 7204 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7205 |
self withActivityIndicationDo:[ |
4355 | 7206 |
result := Dictionary new. |
7207 |
||
7208 |
directories := self currentSelectedDirectories. |
|
7209 |
directories isEmpty ifTrue:[^ self]. |
|
7210 |
||
8510 | 7211 |
allFiles := self allFilesInSelectedDirectoriesForWhich:[:f | true]. |
4355 | 7212 |
|
7213 |
infoDir := Dictionary new. |
|
7214 |
allFiles do:[:fn | |
|
7215 |
infoDir at:fn put:(fn info) |
|
7216 |
]. |
|
7217 |
||
14497 | 7218 |
"/ for each, get the file's size. |
4355 | 7219 |
"/ in a first pass, look for files of the same size and |
7220 |
"/ compare them ... |
|
7221 |
||
7222 |
filesBySize := Dictionary new. |
|
7223 |
infoDir keysAndValuesDo:[:fn :info | |
|
7224 |
|sz entry| |
|
7225 |
||
7226 |
sz := info size. |
|
7227 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7228 |
entry add:fn. |
|
7229 |
]. |
|
7230 |
||
7231 |
"/ any of same size ? |
|
7232 |
||
7233 |
filesBySize do:[:entry | |
|
7234 |
|files| |
|
7235 |
||
7236 |
entry size > 1 ifTrue:[ |
|
7237 |
files := entry asArray. |
|
7238 |
1 to:files size-1 do:[:idx1 | |
|
7239 |
idx1+1 to:files size do:[:idx2 | |
|
7240 |
|fn1 fn2| |
|
7241 |
||
7242 |
fn1 := files at:idx1. |
|
7243 |
fn2 := files at:idx2. |
|
7244 |
||
7245 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
7246 |
"/ compare the files |
|
7247 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7248 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 7249 |
result at:fn1 put:fn2. |
7250 |
] |
|
7251 |
] |
|
7252 |
] |
|
7253 |
] |
|
7254 |
] |
|
7255 |
]. |
|
7256 |
||
7257 |
result := result associations. |
|
7258 |
result := result collect:[:assoc | |
|
7259 |
|f1 f2| |
|
7260 |
||
7261 |
f1 := assoc key asString. |
|
7262 |
f2 := assoc value asString. |
|
7263 |
f1 < f2 ifTrue:[ |
|
7264 |
f2 -> f1 |
|
7265 |
] ifFalse:[ |
|
7266 |
f1 -> f2 |
|
7267 |
] |
|
7268 |
]. |
|
5789 | 7269 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
7270 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 7271 |
|
7272 |
info := OrderedCollection new. |
|
7273 |
size := self getBestDirectory asString size. |
|
7274 |
result do:[:assoc | |
|
7275 |
|fn1 fn2| |
|
7276 |
||
7277 |
fn1 := assoc key. |
|
7278 |
fn2 := assoc value. |
|
7279 |
size > 1 ifTrue:[ |
|
7280 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
7281 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
7282 |
]. |
|
7283 |
(fn1 includes:Character space) ifTrue:[ |
|
7284 |
fn1 := '"' , fn1 , '"' |
|
7285 |
]. |
|
7286 |
(fn2 includes:Character space) ifTrue:[ |
|
7287 |
fn2 := '"' , fn2 , '"' |
|
7288 |
]. |
|
7289 |
info add:(fn1 , ' same as ' , fn2) |
|
7290 |
]. |
|
7291 |
info isEmpty ifTrue:[ |
|
5543 | 7292 |
Dialog information:'No duplicate files found.'. |
7293 |
^ self. |
|
4355 | 7294 |
]. |
3892 | 7295 |
]. |
15589 | 7296 |
stream := CharacterWriteStream new. |
11688 | 7297 |
stream nextPutAllLines:info. |
7298 |
||
15589 | 7299 |
titleStream := CharacterWriteStream with:'File duplicates in directory'. |
3892 | 7300 |
directories size == 1 ifTrue:[ |
12602 | 7301 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7302 |
] ifFalse:[ |
4535 | 7303 |
titleStream nextPutLine:'ies: '. |
4355 | 7304 |
directories do:[:dir| |
7305 |
size > 1 ifTrue:[ |
|
7306 |
titleStream nextPutAll:'..'. |
|
4535 | 7307 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 7308 |
] ifFalse:[ |
4535 | 7309 |
titleStream nextPutLine:(dir asString). |
4355 | 7310 |
]. |
7311 |
] |
|
3892 | 7312 |
]. |
5543 | 7313 |
|
3892 | 7314 |
textBox := TextBox new. |
7315 |
textBox initialText:(stream contents). |
|
7316 |
textBox title:(titleStream contents). |
|
7317 |
textBox readOnly:true. |
|
7318 |
textBox noCancel. |
|
14715 | 7319 |
stream := WriteStream on:''. |
7320 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7321 |
directories do:[ :aDirectory | |
4355 | 7322 |
stream nextPutAll:aDirectory baseName. |
7323 |
stream space. |
|
4050 | 7324 |
]. |
4170 | 7325 |
textBox label:stream contents. |
3892 | 7326 |
maxLength := 10. |
7327 |
info do:[: el | |
|
4355 | 7328 |
maxLength := maxLength max:(el size). |
3892 | 7329 |
]. |
5092 | 7330 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7331 |
textBox maxExtent:Screen current extent. |
|
4355 | 7332 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7333 |
|
11688 | 7334 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7335 |
! |
7336 |
||
7337 |
fileFindFile |
|
5961 | 7338 |
|filename| |
7339 |
||
7340 |
filename := self firstSelectedFileName. |
|
7341 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7342 |
filename := Filename homeDirectory. |
3892 | 7343 |
]. |
4101 | 7344 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7345 |
! |
7346 |
||
8510 | 7347 |
fileFindSimilarImages |
7348 |
"scan directory for similar image files" |
|
7349 |
||
8512 | 7350 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7351 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7352 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7353 |
self withWaitCursorDo:[ |
8510 | 7354 |
self withActivityIndicationDo:[ |
7355 |
result := Dictionary new. |
|
7356 |
||
7357 |
directories := self currentSelectedDirectories. |
|
7358 |
directories isEmpty ifTrue:[^ self]. |
|
7359 |
||
13714 | 7360 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7361 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7362 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7363 |
||
8510 | 7364 |
"/ for each, get the color histogram |
7365 |
histogramsV := Dictionary new. |
|
7366 |
histogramsH := Dictionary new. |
|
7367 |
imageFiles do:[:fn | |
|
7368 |
|hist image| |
|
7369 |
||
7370 |
image := Image fromFile:fn. |
|
7371 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7372 |
hist := ImageColorHistogram new forImage:image. |
|
7373 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7374 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7375 |
]. |
|
7376 |
||
7377 |
similarH := Dictionary new. |
|
7378 |
similarV := Dictionary new. |
|
7379 |
similar := Dictionary new. |
|
7380 |
||
8512 | 7381 |
(self firstSelectedFile notNil |
7382 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7383 |
ifFalse:[ imageFiles ]) |
|
7384 |
do:[:eachFile1 | |
|
8510 | 7385 |
|setOfSimilar distancesV distancesH| |
7386 |
||
7387 |
distancesV := OrderedCollection new. |
|
7388 |
distancesH := OrderedCollection new. |
|
7389 |
setOfSimilar := OrderedCollection new. |
|
7390 |
||
7391 |
imageFiles do:[:eachFile2 | |
|
7392 |
|v1 v2 dV dH| |
|
7393 |
||
7394 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7395 |
v1 := histogramsV at:eachFile1. |
|
7396 |
v2 := histogramsV at:eachFile2. |
|
7397 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7398 |
distancesV add:(eachFile2 -> dV). |
|
7399 |
v1 := histogramsH at:eachFile1. |
|
7400 |
v2 := histogramsH at:eachFile2. |
|
7401 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7402 |
distancesH add:(eachFile2 -> dH). |
|
7403 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7404 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7405 |
]. |
7406 |
] |
|
7407 |
]. |
|
7408 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7409 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7410 |
similarV at:eachFile1 put:distancesV. |
|
7411 |
similarH at:eachFile1 put:distancesH. |
|
7412 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7413 |
]. |
|
7414 |
||
7415 |
similar isEmpty ifTrue:[ |
|
7416 |
Dialog information:'No similarities found.'. |
|
7417 |
^ self. |
|
7418 |
]. |
|
7419 |
]. |
|
7420 |
||
15589 | 7421 |
stream := CharacterWriteStream new. |
8512 | 7422 |
alreadyPrinted := Set new. |
7423 |
||
7424 |
imageFiles do:[:eachFile | |
|
7425 |
|eachSet| |
|
7426 |
||
7427 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7428 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7429 |
eachSet notNil ifTrue:[ |
|
7430 |
stream nextPutLine:eachFile pathName. |
|
7431 |
eachSet do:[:info | |
|
7432 |
|fn2 dist| |
|
7433 |
||
7434 |
fn2 := info key. |
|
7435 |
dist := info value. |
|
7436 |
stream nextPutAll:' '. |
|
7437 |
stream nextPutAll:fn2 pathName. |
|
7438 |
stream nextPutLine:' (',dist printString,')'. |
|
7439 |
alreadyPrinted add:fn2. |
|
7440 |
]. |
|
7441 |
stream cr. |
|
7442 |
]. |
|
8510 | 7443 |
]. |
7444 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7445 |
]. |
8510 | 7446 |
|
7447 |
textBox := TextBox new. |
|
7448 |
textBox initialText:(stream contents). |
|
7449 |
textBox title:'File similarities:'. |
|
7450 |
textBox readOnly:true. |
|
7451 |
textBox noCancel. |
|
7452 |
||
7453 |
textBox label:'File similarities'. |
|
7454 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7455 |
textBox maxExtent:Screen current extent. |
|
7456 |
textBox openModeless. "/ showAtPointer. |
|
7457 |
||
7458 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7459 |
! |
|
7460 |
||
4618 | 7461 |
fileHexDump |
17744 | 7462 |
|file item| |
4618 | 7463 |
|
7464 |
file := self firstSelectedFile. |
|
7465 |
file notNil ifTrue:[ |
|
7466 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7467 |
self |
7468 |
applicationNamed:#FileApplicationNoteBook |
|
7469 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7470 |
]. |
17744 | 7471 |
|
7472 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 7473 |
! |
7474 |
||
7324 | 7475 |
fileIn:aFilename |
7476 |
"fileIn a file" |
|
7477 |
||
7478 |
self fileIn:aFilename lazy:false |
|
7479 |
||
7480 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7481 |
! |
|
7482 |
||
7483 |
fileIn:aFilename lazy:lazy |
|
7484 |
"fileIn a file" |
|
7485 |
||
7486 |
self withActivityIndicationDo:[ |
|
7487 |
self notify:('File in:', aFilename asFilename baseName). |
|
7488 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7489 |
self notify:nil. |
|
7490 |
] |
|
7491 |
||
7492 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7493 |
! |
|
7494 |
||
4930 | 7495 |
filterSelectedFiles:whichFilter |
7496 |
|selectedFiles numFiles msg filterBlock| |
|
7497 |
||
7560 | 7498 |
selectedFiles := self currentSelectedObjects. |
4930 | 7499 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7500 |
||
7501 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7502 |
numFiles > 1 ifTrue:[ |
|
7503 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7504 |
]. |
|
7505 |
||
7506 |
(Dialog |
|
6352 | 7507 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7508 |
initialAnswer:false |
7509 |
) ifFalse:[ |
|
7510 |
^ self |
|
7511 |
]. |
|
7512 |
||
7513 |
whichFilter == #rot13 ifTrue:[ |
|
7514 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7515 |
]. |
|
7516 |
"/ add more here... |
|
7517 |
||
7518 |
filterBlock isNil ifTrue:[ |
|
7519 |
self information:'No such filter: ' , whichFilter. |
|
7520 |
^ self. |
|
7521 |
]. |
|
7522 |
||
7523 |
selectedFiles do:[:fileName | |
|
7524 |
|s| |
|
7525 |
||
7526 |
self notify:('Processing:', fileName baseName). |
|
7527 |
fileName isDirectory ifFalse:[ |
|
7528 |
[ |
|
7529 |
|inFile outFile in out| |
|
7530 |
||
7531 |
inFile := fileName asFilename. |
|
7532 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7533 |
||
7534 |
[ |
|
7535 |
|charIn charOut| |
|
7536 |
||
7537 |
in := inFile readStream. |
|
7538 |
out := outFile writeStream. |
|
7539 |
[in atEnd] whileFalse:[ |
|
7540 |
charIn := in next. |
|
7541 |
charOut := filterBlock value:charIn. |
|
7542 |
out nextPut:charOut. |
|
7543 |
]. |
|
13683 | 7544 |
out close. out:= nil. |
4930 | 7545 |
outFile renameTo:inFile. |
7546 |
] ensure:[ |
|
7547 |
out notNil ifTrue:[ out close ]. |
|
7548 |
in notNil ifTrue:[ in close ]. |
|
7549 |
outFile delete. |
|
7550 |
] |
|
7551 |
] on:FileStream openErrorSignal do:[:ex| |
|
7552 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7553 |
]. |
|
7554 |
] |
|
7555 |
]. |
|
6190 | 7556 |
self notify:nil. |
7560 | 7557 |
|
7558 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7559 |
! |
7560 |
||
9784 | 7561 |
forEachParsedXmlFileDo:aBlock |
7562 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7563 |
||
7564 |
self withActivityIndicationDo:[ |
|
7565 |
| selectedFiles xmlDocument | |
|
7566 |
||
7567 |
selectedFiles:= self currentSelectedFiles. |
|
7568 |
selectedFiles do:[:fileName | |
|
7569 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7570 |
Dialog |
7571 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7572 |
title:'XML Error'. |
|
9784 | 7573 |
^ self. |
7574 |
] do:[ |
|
7575 |
|s d magic encoder document| |
|
7576 |
||
7577 |
s := fileName asFilename readStream. |
|
14012 | 7578 |
[ |
7579 |
s binary. |
|
7580 |
magic := (s next:2). |
|
7581 |
magic = #[254 255] ifTrue:[ |
|
7582 |
"/ UTF16BE |
|
7583 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7584 |
] ifFalse:[ |
|
7585 |
magic = #[255 254] ifTrue:[ |
|
7586 |
"/ UTF16LE |
|
7587 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7588 |
]. |
|
7589 |
]. |
|
7590 |
] ensure:[ |
|
7591 |
s close. |
|
7592 |
]. |
|
9784 | 7593 |
document notNil ifTrue:[ |
7594 |
xmlDocument := XML::XMLParser |
|
7595 |
processDocumentString:document |
|
7596 |
beforeScanDo:[:parse| parse validate:false]. |
|
7597 |
] ifFalse:[ |
|
7598 |
xmlDocument := XML::XMLParser |
|
7599 |
processDocumentInFilename:fileName |
|
7600 |
beforeScanDo:[:parse| parse validate:false]. |
|
7601 |
] |
|
7602 |
]. |
|
7603 |
aBlock value:xmlDocument. |
|
7604 |
]. |
|
7605 |
] |
|
7606 |
||
7607 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7608 |
! |
|
7609 |
||
8832 | 7610 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7611 |
|numItems path files| |
|
7612 |
||
7613 |
files := self currentSelectedFiles. |
|
7614 |
||
7615 |
(numItems := files size) > 2 ifTrue:[ |
|
7616 |
(self |
|
7617 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7618 |
with:numItems)) ifFalse:[^ self]. |
|
7619 |
]. |
|
7620 |
||
7621 |
self withActivityIndicationDo:[ |
|
7622 |
files do:[:fileName | |
|
7623 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7624 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7625 |
path := fileName name. |
8832 | 7626 |
] ifFalse:[ |
7627 |
path := fileName pathName. |
|
7628 |
]. |
|
7629 |
aBlock value:path |
|
7630 |
] |
|
7631 |
]. |
|
7632 |
]. |
|
17239 | 7633 |
|
7634 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7635 |
! |
7636 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7637 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7638 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7639 |
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
|
7640 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7641 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7642 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7643 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7644 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7645 |
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
|
7646 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7647 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7648 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7649 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7650 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7651 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7652 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7653 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7654 |
]. |
13677 | 7655 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7656 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7657 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7658 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7659 |
|
15211 | 7660 |
generatePatchInstallerForSelectedFiles |
7661 |
"generate an expecco patch, which installs the selected file(s). |
|
7662 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7663 |
||
7664 |
|dialog targetDirHolder targetDir |
|
7665 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7666 |
||
7667 |
targetDirHolder := '.' asValue. |
|
7668 |
generateSignedPatchHolder := true asValue. |
|
7669 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7670 |
||
7671 |
dialog := Dialog new. |
|
7672 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7673 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
7674 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
7675 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
7676 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
7677 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
7678 |
dialog addAbortAndOkButtons. |
|
7679 |
dialog open. |
|
7680 |
||
7681 |
dialog accepted ifFalse:[^ self]. |
|
7682 |
||
7683 |
targetDir := targetDirHolder value asFilename. |
|
7684 |
patchFileName := patchFileNameHolder value asFilename. |
|
7685 |
||
7686 |
self withActivityIndicationDo:[ |
|
7687 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
7688 |
||
7689 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
7690 |
outStream := patchFileName writeStream. |
|
7691 |
outStream nextPutAll:' |
|
7692 |
|patchStream zipArchive| |
|
7693 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
7694 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
7695 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
7696 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
7697 |
patchStream setToEnd. "/ to force fileIn to finish |
|
7698 |
!! |
|
7699 |
||
7700 |
!! !! |
|
7701 |
||
7702 |
'. |
|
7703 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
7704 |
||
7705 |
self currentSelectedFiles do:[:fn | |
|
7706 |
|inStream signatureFilename| |
|
7707 |
||
7708 |
inStream := fn asFilename readStream. |
|
7709 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
7710 |
inStream close. |
|
7711 |
]. |
|
7712 |
||
16975 | 7713 |
zipArchive close. |
15211 | 7714 |
|
7715 |
generateSignedPatchHolder value ifTrue:[ |
|
7716 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
7717 |
||
7718 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
7719 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
7720 |
signatureFilename contents:pkcs7SignedData. |
|
7721 |
]. |
|
7722 |
self notify:nil. |
|
7723 |
] |
|
7724 |
! |
|
13783 | 7725 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7726 |
generateSignaturesForSelectedFiles |
13783 | 7727 |
"generate signed pkcs7 files from the contents of the selected files. |
7728 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7729 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7730 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7731 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7732 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7733 |
|
8646 | 7734 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7735 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7736 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 7737 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7738 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7739 |
]. |
13677 | 7740 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7741 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7742 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7743 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7744 |
|
9784 | 7745 |
inspectXmlFile |
7746 |
"Show an XML file - either in an XMLInspector or fall back to |
|
7747 |
a plain inspector on the XML tree" |
|
7748 |
||
7749 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
7750 |
XML::XMLInspector notNil ifTrue:[ |
|
7751 |
XML::XMLInspector openOn:xmlDocument. |
|
7752 |
] ifFalse:[ |
|
7753 |
"fall back..." |
|
7754 |
xmlDocument inspect. |
|
7755 |
] |
|
7756 |
]. |
|
7757 |
||
7758 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
7759 |
! |
|
7760 |
||
3892 | 7761 |
installAllAsAutoloaded |
7762 |
"install all classes found here as autoloaded classes" |
|
7763 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7764 |
self installAllAsAutoloadedRecursive:false |
3892 | 7765 |
! |
7766 |
||
6521 | 7767 |
installAllAsAutoloadedRecursive |
7768 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
7769 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7770 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7771 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7772 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7773 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7774 |
"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
|
7775 |
|
6521 | 7776 |
[ |
15507 | 7777 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
7778 |
|installAction| |
|
7779 |
||
7780 |
installAction := |
|
7781 |
[:fn | |
|
7782 |
(fn suffix = 'st') ifTrue:[ |
|
7783 |
self notify:('Install as autoloaded: ', fn baseName). |
|
7784 |
self installAsAutoloaded:fn. |
|
7785 |
] |
|
7786 |
]. |
|
7787 |
||
7788 |
self withActivityIndicationDo:[ |
|
7789 |
self currentSelectedDirectories do:[:dir| |
|
7790 |
aBoolean ifTrue:[ |
|
7791 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
7792 |
] ifFalse:[ |
|
7793 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 7794 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7795 |
]. |
15507 | 7796 |
self notify:nil. |
7797 |
]. |
|
7798 |
] |
|
6521 | 7799 |
] fork. |
7800 |
! |
|
7801 |
||
3892 | 7802 |
installAsAutoloaded:aFilename |
7803 |
"install aFilename as autoloaded class" |
|
7804 |
||
13292 | 7805 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
7806 |
||
7807 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 7808 |
! |
7809 |
||
15211 | 7810 |
joinSelectedFiles |
7811 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
7812 |
||
7813 |
selectedFiles := self currentSelectedObjects. |
|
7814 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
7815 |
||
7816 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
7817 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
7818 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
7819 |
outFile := selectedFiles first directory construct:outFileName. |
|
7820 |
||
7821 |
outStream := outFile writeStream. |
|
7822 |
||
7823 |
selectedFiles do:[:fileName | |
|
7824 |
|inStream| |
|
7825 |
||
7826 |
self notify:('Adding:', fileName baseName). |
|
7827 |
inStream := fileName readStream. |
|
7828 |
inStream copyToEndInto:outStream. |
|
7829 |
inStream close. |
|
7830 |
]. |
|
7831 |
outStream close. |
|
7832 |
self notify:nil. |
|
7833 |
||
7834 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
7835 |
! |
|
4558 | 7836 |
|
6292 | 7837 |
loadImageThenDo:aBlock |
3892 | 7838 |
|img path files| |
7839 |
||
3982 | 7840 |
files := self currentSelectedFiles. |
3892 | 7841 |
files isEmpty ifTrue:[ ^ self]. |
7842 |
files do:[:fileName | |
|
4414 | 7843 |
path := fileName. |
7844 |
path isDirectory ifFalse:[ |
|
7845 |
img := Image fromFile:(path pathName). |
|
7846 |
img notNil ifTrue:[ |
|
6292 | 7847 |
aBlock value:img |
4414 | 7848 |
] ifFalse:[ |
15346 | 7849 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 7850 |
] |
7851 |
] |
|
3892 | 7852 |
]. |
7853 |
! |
|
7854 |
||
13089 | 7855 |
loadSignatureSupport |
7856 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 7857 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 7858 |
]. |
7859 |
! |
|
7860 |
||
3892 | 7861 |
openASN1Browser |
7862 |
||
7863 |
self openTool:OSI::ASN1Browser |
|
7864 |
! |
|
7865 |
||
7866 |
openAppletViewer |
|
7867 |
|numItems files| |
|
7868 |
||
3982 | 7869 |
files := self currentSelectedFiles. |
3892 | 7870 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 7871 |
(self |
7872 |
confirm:(resources string:'open for each of the %1 items ?' |
|
7873 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 7874 |
]. |
7875 |
||
7876 |
Java startupJavaSystem. |
|
7877 |
"/ Java markAllClassesUninitialized. |
|
7878 |
"/ Java initAllStaticFields. |
|
7879 |
"/ Java initAllClasses. |
|
7880 |
||
7881 |
files do:[:fileName | |
|
4414 | 7882 |
|p path| |
7883 |
||
7884 |
path := fileName. |
|
7885 |
path isDirectory ifFalse:[ |
|
7886 |
p := Java |
|
7887 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
7888 |
argumentString:path pathName. |
|
7889 |
p resume. |
|
7890 |
] |
|
3892 | 7891 |
]. |
7892 |
! |
|
7893 |
||
7894 |
openCBrowser |
|
6031 | 7895 |
|dir files| |
5880 | 7896 |
|
7897 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7898 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7899 |
self withActivityIndicationDo:[ |
7560 | 7900 |
files := self currentSelectedObjects. |
6031 | 7901 |
files notEmptyOrNil ifTrue:[ |
7902 |
CBrowser::Browser openOn:files first. |
|
7903 |
] ifFalse:[ |
|
7904 |
CBrowser::Browser openIn:dir. |
|
7905 |
] |
|
3892 | 7906 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7907 |
|
7560 | 7908 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 7909 |
! |
7910 |
||
4230 | 7911 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7912 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7913 |
|
4230 | 7914 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7915 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 7916 |
with:#openOnFile: |
7917 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7918 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7919 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 7920 |
! |
7921 |
||
3892 | 7922 |
openChangesBrowser |
7923 |
"open a change browser on the selected file(s)" |
|
7924 |
||
7925 |
self openTool:(UserPreferences current changesBrowserClass) |
|
7926 |
! |
|
7927 |
||
7928 |
openDiffView |
|
15215 | 7929 |
"open a diff-view on the two selected files" |
7930 |
||
7931 |
|name1 name2 files title |
|
7932 |
defaultName defaultDir| |
|
6460 | 7933 |
|
7934 |
files := self currentSelectedObjects. |
|
3892 | 7935 |
files isEmpty ifTrue:[ |
6460 | 7936 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 7937 |
^ self. |
3892 | 7938 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7939 |
|
3892 | 7940 |
(files size == 2) ifTrue:[ |
4414 | 7941 |
name1 := files last. |
7942 |
name2 := files first. |
|
3892 | 7943 |
] ifFalse:[ |
4414 | 7944 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 7945 |
LastFileDiffFile exists ifTrue:[ |
7946 |
name1 := LastFileDiffFile. |
|
7947 |
]. |
|
7948 |
"/ | directory | |
|
7949 |
"/ directory := self currentDirectory. |
|
7950 |
"/ directory notNil ifTrue:[ |
|
7951 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
7952 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
7953 |
"/ name1 := lastFile. |
|
7954 |
"/ ] |
|
7955 |
"/ ] |
|
4414 | 7956 |
]. |
7957 |
name2 := files first. |
|
6460 | 7958 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 7959 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 7960 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 7961 |
name1 := DialogBox |
7962 |
requestFileName:title |
|
7963 |
default:defaultName |
|
6460 | 7964 |
ok:(resources string:'OK') |
7965 |
abort:(resources string:'Compare against File List') |
|
4414 | 7966 |
pattern:'*' |
11052 | 7967 |
fromDirectory:defaultDir. |
3892 | 7968 |
]. |
15215 | 7969 |
self openDiffViewOn:name1 and:name2 |
7970 |
||
7971 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
7972 |
! |
|
7973 |
||
7974 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
7975 |
"open a diff-view on two files" |
|
7976 |
||
7977 |
|file1 file2 text1 text2 d err nm l1 sameContents msg| |
|
7978 |
||
7979 |
file1 := fileArg1. |
|
7980 |
file2 := fileArg2. |
|
3892 | 7981 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7982 |
self withWaitCursorDo:[ |
15215 | 7983 |
(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
|
7984 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 7985 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 7986 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7987 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7988 |
] ifFalse:[ |
15215 | 7989 |
file1 := file1 asFilename. |
7990 |
LastFileDiffFile := file1. |
|
7991 |
file1 isReadable ifFalse:[ |
|
7992 |
nm := file1. |
|
7993 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7994 |
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
|
7995 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7996 |
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
|
7997 |
]. |
4414 | 7998 |
]. |
15215 | 7999 |
l1 := file1 pathName |
4414 | 8000 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8001 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8002 |
err isNil ifTrue:[ |
15215 | 8003 |
file2 isReadable ifFalse:[ |
8004 |
nm := file2. |
|
8005 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8006 |
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
|
8007 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8008 |
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
|
8009 |
]. |
4414 | 8010 |
]. |
8011 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8012 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8013 |
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
|
8014 |
^ self |
6176 | 8015 |
]. |
8016 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8017 |
self withActivityIndicationDo:[ |
15215 | 8018 |
((file1 notNil and:[file1 fileSize > (1024*1024*32)]) |
8019 |
or:[ file2 fileSize > (1024*1024*32) ]) ifTrue:[ |
|
8020 |
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
|
8021 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8022 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8023 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8024 |
during:[ |
15215 | 8025 |
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
|
8026 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8027 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8028 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8029 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8030 |
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
|
8031 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8032 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8033 |
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
|
8034 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8035 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8036 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8037 |
|
15215 | 8038 |
file1 notNil ifTrue:[ |
8039 |
file1 isDirectory ifTrue:[ |
|
8040 |
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
|
8041 |
] ifFalse:[ |
15215 | 8042 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8043 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8044 |
]. |
15215 | 8045 |
file2 isDirectory ifTrue:[ |
8046 |
text2 := file2 directoryContents asString. |
|
6460 | 8047 |
] ifFalse:[ |
15215 | 8048 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8049 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8050 |
text1 = text2 ifTrue:[ |
15215 | 8051 |
(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
|
8052 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8053 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8054 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8055 |
]. |
16911 | 8056 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8057 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8058 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8059 |
openOn:text1 label:l1 |
15215 | 8060 |
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
|
8061 |
d topView label:(resources string:'File Differences'). |
6460 | 8062 |
] |
4414 | 8063 |
] |
3892 | 8064 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8065 |
|
11494 | 8066 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
3892 | 8067 |
! |
8068 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8069 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8070 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8071 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8072 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8073 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8074 |
files := self currentSelectedObjects. |
11108 | 8075 |
files notEmpty ifTrue:[ |
8076 |
name1 := files first asFilename. |
|
8077 |
name1 asFilename isDirectory ifFalse:[ |
|
8078 |
name1 := name1 directory |
|
8079 |
]. |
|
8080 |
]. |
|
8081 |
||
8082 |
(files size == 2) ifTrue:[ |
|
8083 |
name2 := files second. |
|
8084 |
] ifFalse:[ |
|
8085 |
(files size ~= 1) ifTrue:[ |
|
8086 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8087 |
^ self. |
|
8088 |
]. |
|
8089 |
name2 := Dialog |
|
8090 |
requestDirectoryName:(resources |
|
8091 |
string:'Recursive compare "%1" with folder:' |
|
8092 |
with:name1 asFilename baseName) |
|
8093 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8094 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8095 |
LastFileDiffDirectory := name2. |
|
8096 |
]. |
|
8097 |
name2 := name2 asFilename. |
|
8098 |
||
8099 |
name2 asFilename isDirectory ifFalse:[ |
|
8100 |
name2 := name2 directory |
|
8101 |
]. |
|
8102 |
||
8103 |
self |
|
8104 |
applicationNamed:#FileApplicationNoteBook |
|
8105 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8106 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8107 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8108 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8109 |
|
3892 | 8110 |
openEditor |
8111 |
self openTool:EditTextView |
|
8112 |
! |
|
8113 |
||
4957 | 8114 |
openGV |
8115 |
self openOSCommandWithFiles:'gv' |
|
8116 |
! |
|
8117 |
||
3892 | 8118 |
openHTMLReader |
8119 |
||
8120 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8121 |
! |
|
8122 |
||
8123 |
openImageEditor |
|
6292 | 8124 |
[ |
8125 |
self loadImageThenDo:[:img | img edit] |
|
8126 |
] fork |
|
3892 | 8127 |
! |
8128 |
||
8129 |
openImageInspector |
|
6292 | 8130 |
[ |
8131 |
self loadImageThenDo:[:img | img inspect] |
|
8132 |
] fork |
|
3892 | 8133 |
! |
8134 |
||
8135 |
openImagePreview |
|
5778 | 8136 |
[ |
8137 |
self |
|
6292 | 8138 |
loadImageThenDo: |
5778 | 8139 |
[:img | |
8140 |
|i top viewer| |
|
8141 |
||
8142 |
top := StandardSystemView new. |
|
8143 |
||
8144 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8145 |
i := img. |
|
8146 |
top extent:200@200. |
|
8147 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8148 |
top openAndWait. |
|
8149 |
||
8150 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8151 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8152 |
]. |
|
8153 |
viewer image:i. |
|
8154 |
]. |
|
3892 | 8155 |
] fork |
8156 |
! |
|
8157 |
||
8158 |
openMP3Player |
|
8159 |
|file| |
|
8160 |
||
3982 | 8161 |
file := self currentSelectedFiles. |
3892 | 8162 |
(file isEmpty) ifTrue:[ |
4414 | 8163 |
^ self. |
3892 | 8164 |
]. |
8165 |
file := file first. |
|
8166 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8167 |
! |
|
8168 |
||
4957 | 8169 |
openOSCommandWithFiles:command |
8170 |
|files fileNames| |
|
8171 |
||
8172 |
files := self currentSelectedFiles. |
|
8173 |
(files isEmpty) ifTrue:[ |
|
8174 |
^ self. |
|
8175 |
]. |
|
8176 |
||
8177 |
fileNames := files collect:[:each | |
|
8178 |
'"' , each asFilename pathName , '"' |
|
8179 |
]. |
|
8180 |
||
8181 |
[ |
|
8182 |
OperatingSystem |
|
4959 | 8183 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8184 |
inDirectory:(files first asFilename directory). |
|
4957 | 8185 |
] fork |
8186 |
! |
|
8187 |
||
4820 | 8188 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8189 |
|files fileNames cmd arg| |
4820 | 8190 |
|
8191 |
files := self currentSelectedFiles. |
|
8192 |
(files isEmpty) ifTrue:[ |
|
8193 |
^ self. |
|
8194 |
]. |
|
12972 | 8195 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8196 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8197 |
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
|
8198 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8199 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8200 |
|
4820 | 8201 |
fileNames := |
8202 |
files |
|
8203 |
collect: |
|
8204 |
[:each | |
|
8205 |
'"' , each asFilename pathName , '"' |
|
8206 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8207 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8208 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8209 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8210 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8211 |
]. |
4820 | 8212 |
|
4950 | 8213 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8214 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8215 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8216 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8217 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8218 |
! |
8219 |
||
4958 | 8220 |
openRP |
8221 |
self openOSCommandWithFiles:'realplay' |
|
8222 |
! |
|
8223 |
||
8426 | 8224 |
openResourceFileEditor |
8225 |
||
8226 |
self |
|
8227 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8228 |
with: #openOnFile: |
|
8229 |
! |
|
8230 |
||
3892 | 8231 |
openSlideShow |
5880 | 8232 |
|dir| |
8233 |
||
8234 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8235 |
dir isNil ifTrue:[^ self]. |
|
8236 |
||
3892 | 8237 |
CodingExamples_GUI::SlideShow openIn:dir. |
8238 |
! |
|
8239 |
||
8240 |
openSnapshotImageBrowser |
|
4491 | 8241 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8242 |
||
3892 | 8243 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8244 |
! |
|
8245 |
||
8246 |
openTerminal |
|
5880 | 8247 |
|dir| |
8248 |
||
8249 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8250 |
|
5300 | 8251 |
TerminalApplication notNil ifTrue:[ |
8252 |
TerminalApplication openIn:dir |
|
8253 |
] ifFalse:[ |
|
8254 |
VT100TerminalView openShellIn:dir. |
|
8255 |
]. |
|
3892 | 8256 |
! |
8257 |
||
8258 |
openTool:aToolClass |
|
8259 |
"open a tool on the selected file(s)" |
|
8260 |
||
8261 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8262 |
! |
|
8263 |
||
8264 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8265 |
"open a tool on the selected file(s)" |
|
8266 |
||
8267 |
^ self |
|
4414 | 8268 |
openTool:aToolClass |
8269 |
with:#openOn: |
|
8270 |
ignoreDirectories:ignoreDirs |
|
3892 | 8271 |
! |
8272 |
||
8426 | 8273 |
openTool:aToolClass with:aSelector |
8274 |
"open a tool on the selected file(s)" |
|
8275 |
||
8276 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8277 |
! |
|
8278 |
||
3892 | 8279 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8280 |
"open a tool on the selected file(s)" |
|
8281 |
||
8832 | 8282 |
|tool| |
3892 | 8283 |
|
8284 |
aToolClass isNil ifTrue:[ |
|
4414 | 8285 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8286 |
^ nil. |
|
3892 | 8287 |
]. |
8832 | 8288 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8289 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8290 |
]. |
8291 |
^ tool |
|
8832 | 8292 |
! |
8293 |
||
8294 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8295 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8296 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8297 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8298 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8299 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8300 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8301 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8302 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8303 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8304 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8305 |
]. |
3892 | 8306 |
! |
8307 |
||
6022 | 8308 |
openWorkspace |
8309 |
self |
|
8310 |
openTool:WorkspaceApplication |
|
8311 |
with:#openOnFile: |
|
8312 |
ignoreDirectories:true |
|
8313 |
! |
|
8314 |
||
4950 | 8315 |
openXV |
4957 | 8316 |
self openOSCommandWithFiles:'xv' |
4950 | 8317 |
! |
8318 |
||
3892 | 8319 |
openZipTool |
5880 | 8320 |
|zipTool| |
3892 | 8321 |
|
8322 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8323 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8324 |
]. |
8325 |
! |
|
8326 |
||
8327 |
readAbbrevFile |
|
8328 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8329 |
||
5880 | 8330 |
|directories| |
3892 | 8331 |
|
3982 | 8332 |
directories := self currentSelectedDirectories. |
3892 | 8333 |
directories isEmpty ifTrue:[^ self]. |
8334 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8335 |
self withActivityIndicationDo:[ |
5880 | 8336 |
directories do:[:eachDir | |
8337 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8338 |
] |
|
5828 | 8339 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8340 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8341 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8342 |
! |
8343 |
||
6460 | 8344 |
readAndShowResources |
8345 |
self withActivityIndicationDo:[ |
|
8346 |
| selectedFiles| |
|
8347 |
||
8348 |
selectedFiles:= self currentSelectedFiles. |
|
8349 |
selectedFiles do:[:fileName | |
|
8350 |
resources := ResourcePack fromFile:fileName. |
|
8351 |
resources inspect. |
|
8352 |
]. |
|
8353 |
] |
|
8354 |
! |
|
8355 |
||
3892 | 8356 |
singleFileFileIn:fileName lazy:lazy |
8357 |
"fileIn the selected file(s)" |
|
8358 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8359 |
|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
|
8360 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8361 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8362 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8363 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8364 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8365 |
[ |
4345 | 8366 |
(ObjectFileLoader notNil |
5491 | 8367 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8368 |
AbortOperationRequest catch:[ |
8369 |
|p| |
|
8370 |
||
8371 |
"/ |
|
8372 |
"/ look if already loaded ... then unload first |
|
8373 |
"/ |
|
8374 |
p := fileName pathName. |
|
8375 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8376 |
(Dialog confirm:(resources |
|
8377 |
string:'%1 is already loaded; load anyway ?' |
|
8378 |
with:p)) ifFalse:[ |
|
8379 |
^ self |
|
8380 |
]. |
|
8381 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8382 |
Transcript showCR:notifyString. |
|
4523 | 8383 |
self notify:notifyString. |
4345 | 8384 |
ObjectFileLoader unloadObjectFile:p. |
8385 |
]. |
|
8386 |
||
8387 |
notifyString := 'loading ' , p , ' ...'. |
|
8388 |
Transcript showCR:notifyString. |
|
4523 | 8389 |
self notify:notifyString. |
12426 | 8390 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8391 |
notifyString := 'Error: could not load ' , p. |
|
8392 |
Transcript showCR:notifyString. |
|
8393 |
self notify:notifyString. |
|
8394 |
] ifFalse:[ |
|
8395 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8396 |
]. |
|
4345 | 8397 |
] |
8398 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8399 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8400 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8401 |
aStream := fileName readStreamOrNil. |
4345 | 8402 |
aStream notNil ifTrue:[ |
8403 |
aStream fileInBinary. |
|
8404 |
] |
|
8405 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8406 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8407 |
"/ loading a java class file |
8408 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8409 |
JavaClassReader loadFile:fileName |
4345 | 8410 |
] |
8411 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8412 |
"/ loading a sif (smalltalk interchange format) file |
|
8413 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8414 |
SmalltalkInterchangeFileManager newForFileIn |
|
8415 |
fileName: fileName pathName; |
|
8416 |
fileIn. |
|
8417 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8418 |
Parcel isNil ifTrue:[ |
|
8419 |
Dialog warn:'Parcel support not loaded.' |
|
8420 |
] ifFalse:[ |
|
8421 |
Parcel loadParcelFrom: fileName pathName |
|
8422 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8423 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8424 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8425 |
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
|
8426 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8427 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8428 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8429 |
(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
|
8430 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8431 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8432 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8433 |
] |
4345 | 8434 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8435 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8436 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8437 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8438 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8439 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8440 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8441 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8442 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8443 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8444 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8445 |
Error handle:[:ex | |
15675 | 8446 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8447 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8448 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8449 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8450 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8451 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8452 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8453 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8454 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8455 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8456 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8457 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8458 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8459 |
] |
4345 | 8460 |
] |
8461 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8462 |
]]]] |
4345 | 8463 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8464 |
] 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
|
8465 |
|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
|
8466 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8467 |
isRedef := false. |
12684 | 8468 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8469 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8470 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8471 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8472 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8473 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8474 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8475 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8476 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8477 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8478 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8479 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8480 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8481 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8482 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8483 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8484 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8485 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8486 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8487 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8488 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8489 |
sender := ex suspendedContext. |
17024 | 8490 |
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
|
8491 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8492 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8493 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8494 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8495 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8496 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8497 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8498 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8499 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8500 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8501 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8502 |
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
|
8503 |
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
|
8504 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8505 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8506 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8507 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8508 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8509 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8510 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8511 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8512 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8513 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8514 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8515 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8516 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8517 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8518 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8519 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8520 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8521 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8522 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8523 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8524 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8525 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8526 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8527 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8528 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8529 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8530 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8531 |
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
|
8532 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8533 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8534 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8535 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8536 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8537 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8538 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8539 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8540 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8541 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8542 |
(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
|
8543 |
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
|
8544 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8545 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8546 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8547 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8548 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8549 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8550 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8551 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8552 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8553 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8554 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8555 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8556 |
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
|
8557 |
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
|
8558 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8559 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8560 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8561 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8562 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8563 |
] |
7040 | 8564 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8565 |
"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
|
8566 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8567 |
! |
8568 |
||
4558 | 8569 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8570 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8571 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8572 |
||
8573 |
bufferSize := 32*1024. |
|
8574 |
||
8575 |
inStream := infile readStream. |
|
8576 |
||
8577 |
bytesPerSplit := kiloBytes * 1024. |
|
8578 |
||
8579 |
remaining := infile fileSize. |
|
8580 |
splitIndex := 1. |
|
8581 |
[remaining > 0] whileTrue:[ |
|
8582 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8583 |
outStream := outFile asFilename writeStream. |
|
8584 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8585 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8586 |
buffer := ByteArray new:bufferSize. |
|
8587 |
n := inStream |
|
8588 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8589 |
into:buffer |
|
8590 |
startingAt:1. |
|
8591 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8592 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8593 |
remaining := remaining - n. |
|
8594 |
]. |
|
8595 |
outStream close. |
|
8596 |
splitIndex := splitIndex + 1. |
|
8597 |
]. |
|
8598 |
inStream close. |
|
8599 |
! |
|
8600 |
||
15906 | 8601 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
8602 |
|splitIndex line |
|
8603 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
8604 |
||
8605 |
inStream := infile readStream. |
|
8606 |
||
8607 |
splitIndex := 1. |
|
8608 |
[inStream atEnd] whileFalse:[ |
|
8609 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8610 |
outStream := outFile asFilename writeStream. |
|
8611 |
remainingLinesInThisOutfile := numberOfLines. |
|
8612 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
8613 |
line := inStream nextLine. |
|
15910 | 8614 |
outStream nextPutLine:line. |
15906 | 8615 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
8616 |
]. |
|
8617 |
outStream close. |
|
8618 |
splitIndex := splitIndex + 1. |
|
8619 |
]. |
|
8620 |
inStream close. |
|
8621 |
! |
|
8622 |
||
4558 | 8623 |
splitSelectedFiles |
6264 | 8624 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 8625 |
|
12871 | 8626 |
selectedFiles := self currentSelectedFiles. |
4558 | 8627 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8628 |
||
6265 | 8629 |
msg := (numFiles > 1) |
8630 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
8631 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 8632 |
|
6352 | 8633 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 8634 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
8635 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 8636 |
kiloBytes isNil ifTrue:[^ self]. |
8637 |
||
8638 |
selectedFiles do:[:fileName | |
|
8639 |
self notify:('Splitting:', fileName baseName). |
|
8640 |
fileName isDirectory ifFalse:[ |
|
8641 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
8642 |
] |
|
8643 |
]. |
|
6190 | 8644 |
self notify:nil. |
6265 | 8645 |
|
7560 | 8646 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 8647 |
! |
8648 |
||
15906 | 8649 |
splitSelectedFilesByLines |
8650 |
|selectedFiles numFiles msg numLinesString numLines| |
|
8651 |
||
8652 |
selectedFiles := self currentSelectedFiles. |
|
8653 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8654 |
||
8655 |
msg := (numFiles > 1) |
|
8656 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
8657 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
8658 |
||
8659 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8660 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
8661 |
||
8662 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
8663 |
numLines isNil ifTrue:[^ self]. |
|
8664 |
||
8665 |
selectedFiles do:[:fileName | |
|
8666 |
self notify:('Splitting:', fileName baseName). |
|
8667 |
fileName isDirectory ifFalse:[ |
|
8668 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
|
8669 |
] |
|
8670 |
]. |
|
8671 |
self notify:nil. |
|
8672 |
! |
|
8673 |
||
15211 | 8674 |
truncateSelectedFilesToZeroSize |
8675 |
|selectedFiles numFiles msg| |
|
8676 |
||
8677 |
selectedFiles := self currentSelectedObjects. |
|
8678 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8679 |
||
8680 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
8681 |
numFiles > 1 ifTrue:[ |
|
8682 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
8683 |
]. |
|
8684 |
||
8685 |
(Dialog |
|
8686 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
8687 |
initialAnswer:false |
|
8688 |
) ifFalse:[ |
|
8689 |
^ self |
|
8690 |
]. |
|
8691 |
||
8692 |
selectedFiles do:[:fileName | |
|
8693 |
|s| |
|
8694 |
||
8695 |
self notify:('Truncating:', fileName baseName). |
|
8696 |
fileName isDirectory ifFalse:[ |
|
8697 |
[ |
|
8698 |
s := fileName writeStream. |
|
8699 |
s close. |
|
8700 |
] on:FileStream openErrorSignal do:[:ex| |
|
8701 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
8702 |
]. |
|
8703 |
] |
|
8704 |
]. |
|
8705 |
self notify:nil. |
|
8706 |
||
8707 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
8708 |
! ! |
|
3892 | 8709 |
|
4849 | 8710 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 8711 |
|
8712 |
anySTFilesPresent |
|
8713 |
^ self anyFilesPresentWithSuffix:'st' |
|
8714 |
! |
|
8715 |
||
8716 |
canCreateNewProject |
|
8717 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
12811 | 8718 |
^ self currentSelectedFiles contains:[:fileName| |
8719 |
| suffix| |
|
8720 |
suffix := fileName suffix asLowercase. |
|
8721 |
(suffix = 'prj' or:[suffix = 'st']) |
|
8722 |
] |
|
3892 | 8723 |
! |
8724 |
||
8725 |
canDoTerminal |
|
8726 |
||
8727 |
^ OperatingSystem isUNIXlike |
|
8728 |
or:[OperatingSystem isMSWINDOWSlike] |
|
8729 |
! |
|
8730 |
||
8731 |
canDoTerminalAndSystemIsDOS |
|
8732 |
||
8733 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
8734 |
! |
|
8735 |
||
8736 |
canDoTerminalAndSystemIsUnix |
|
8737 |
||
8738 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
8739 |
! |
|
8740 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8741 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8742 |
"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
|
8743 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8744 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8745 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8746 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8747 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8748 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8749 |
|
12811 | 8750 |
canOpenMonticelloBrowser |
8751 |
^ self currentSelectedFiles |
|
8752 |
contains:[:fileName| |
|
8753 |
fileName suffix asLowercase = 'mcz' |
|
8754 |
] |
|
8755 |
! |
|
8756 |
||
3892 | 8757 |
canReadAbbrevFile |
8758 |
||
5960 | 8759 |
|currentDirectory| |
3892 | 8760 |
|
8761 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 8762 |
currentDirectory := self currentDirectory. |
8763 |
^ currentDirectory notNil |
|
8764 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 8765 |
! |
8766 |
||
8767 |
canRemoveFromSourcePath |
|
8768 |
||
8769 |
^ false |
|
8770 |
! |
|
8771 |
||
13089 | 8772 |
cannotGenerateSignatureFiles |
8773 |
^ self canGenerateSignatureFiles not |
|
8774 |
! |
|
8775 |
||
3892 | 8776 |
hasASN1 |
8777 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 8778 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 8779 |
|
8780 |
! |
|
8781 |
||
8782 |
hasASN1AndSelection |
|
8783 |
^ [ self hasSelection value |
|
17416 | 8784 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 8785 |
and:[OSI::ASN1Parser notNil |
8786 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 8787 |
|
8788 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 8789 |
! |
8790 |
||
8791 |
hasCBrowser |
|
8792 |
^ [ CBrowser::Browser notNil ] |
|
8793 |
! |
|
8794 |
||
8795 |
hasJava |
|
8796 |
||
14298 | 8797 |
^ [ JavaVM notNil |
8798 |
and:[JavaClassReader notNil |
|
8799 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8800 |
! |
8801 |
||
8802 |
hasJavaAndSelection |
|
8803 |
||
12871 | 8804 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8805 |
and:[JavaClassReader notNil |
8806 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8807 |
! |
8808 |
||
8809 |
hasMP3Player |
|
8810 |
||
8811 |
^ [ MP3PlayerApplication notNil |
|
4414 | 8812 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 8813 |
! |
8814 |
||
8815 |
hasMP3PlayerAndSelection |
|
8816 |
||
12871 | 8817 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8818 |
and:[ self hasMP3Player value]] |
3892 | 8819 |
! |
8820 |
||
8426 | 8821 |
hasResourceFileSelected |
12871 | 8822 |
^ (self currentSelectedFiles) |
8823 |
contains:[:fn | |
|
12811 | 8824 |
fn suffix asLowercase = 'rs' |
8825 |
]. |
|
8426 | 8826 |
! |
8827 |
||
3892 | 8828 |
hasSlideShow |
8829 |
||
8830 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
8831 |
! |
|
8832 |
||
8833 |
hasSnapshotSelection |
|
8834 |
||
8835 |
^ [ |
|
4414 | 8836 |
| files | |
8426 | 8837 |
|
4414 | 8838 |
files := self currentSelectedFiles. |
8839 |
((files size == 1) |
|
8840 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 8841 |
] |
8842 |
! |
|
8843 |
||
7869 | 8844 |
hasXml |
9206 | 8845 |
^ [ XML::XMLParser notNil ] |
7869 | 8846 |
! |
8847 |
||
8848 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
8849 |
"/ 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
|
8850 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 8851 |
|
8426 | 8852 |
^ [ |
8853 |
|sel fileName| |
|
7869 | 8854 |
|
8855 |
sel := self currentSelectedFiles. |
|
8856 |
sel size == 1 ifTrue:[ |
|
8857 |
fileName := sel first. |
|
8858 |
fileName notNil ifTrue:[ |
|
15936 | 8859 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 8860 |
] ifFalse:[ |
8861 |
false |
|
8862 |
] |
|
8863 |
] ifFalse:[ |
|
8864 |
false |
|
8865 |
] |
|
8866 |
] |
|
8867 |
! |
|
8868 |
||
3892 | 8869 |
hasZipFileSelected |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8870 |
|sel fileName suff| |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8871 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8872 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8873 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8874 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8875 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8876 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8877 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8878 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8879 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8880 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8881 |
^ fileName mimeTypeOfContents = 'application/x-zip-compressed' |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8882 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8883 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8884 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8885 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8886 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8887 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8888 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8889 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 8890 |
! |
8891 |
||
8892 |
javaSupportLoaded |
|
8893 |
||
8894 |
^ false |
|
8895 |
! ! |
|
8896 |
||
14126 | 8897 |
|
8898 |
||
3906 | 8899 |
!AbstractFileBrowser methodsFor:'presentation'! |
8900 |
||
8901 |
getModeString:modeBits |
|
8902 |
"convert file-mode bits into a more user-friendly string. |
|
8903 |
This is wrong here - should be moved into OperatingSystem." |
|
8904 |
||
8905 |
^ self getModeString:modeBits |
|
4414 | 8906 |
with:#( 'owner:' $r $w $x |
8907 |
' group:' $r $w $x |
|
8908 |
' others:' $r $w $x ) |
|
3906 | 8909 |
! |
8910 |
||
8911 |
getModeString:modeBits with:texts |
|
8912 |
"convert file-mode bits into a more user-friendly string. |
|
8913 |
This is wrong here - should be moved into OperatingSystem." |
|
8914 |
||
8915 |
|bits modeString| |
|
8916 |
||
8917 |
bits := modeBits bitAnd:8r777. |
|
8918 |
modeString := ''. |
|
8919 |
||
8920 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
8921 |
with: texts do:[:bitMask :access | |
|
4414 | 8922 |
|ch| |
8923 |
||
8924 |
bitMask isNil ifTrue:[ |
|
8925 |
modeString := modeString , access |
|
8926 |
] ifFalse:[ |
|
8927 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
8928 |
ch := $- |
|
8929 |
] ifFalse:[ |
|
8930 |
ch := access |
|
8931 |
]. |
|
8932 |
modeString := modeString copyWith:ch |
|
8933 |
] |
|
3906 | 8934 |
]. |
8935 |
^ modeString |
|
8936 |
! ! |
|
8937 |
||
5880 | 8938 |
!AbstractFileBrowser methodsFor:'private'! |
8939 |
||
8940 |
theSingleSelectedDirectoryOrHomeDir |
|
8941 |
|dir| |
|
8942 |
||
5888 | 8943 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 8944 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
8945 |
^ dir. |
|
8946 |
! |
|
8947 |
||
8948 |
theSingleSelectedDirectoryOrNil |
|
8949 |
|dirs| |
|
8950 |
||
8951 |
dirs := self currentSelectedDirectories. |
|
8952 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8953 |
^ dirs anElement. |
|
14577 | 8954 |
! |
8955 |
||
8956 |
theSingleSelectedFileOrNil |
|
8957 |
|dirs| |
|
8958 |
||
8959 |
dirs := self currentSelectedFiles. |
|
8960 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8961 |
^ dirs anElement. |
|
5880 | 8962 |
! ! |
8963 |
||
3892 | 8964 |
!AbstractFileBrowser methodsFor:'queries'! |
8965 |
||
8256 | 8966 |
cBrowserLoaded |
8967 |
^ CBrowser::Browser notNil |
|
8968 |
! |
|
8969 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8970 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8971 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8972 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8973 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8974 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8975 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8976 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8977 |
"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
|
8978 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8979 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8980 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8981 |
|
3906 | 8982 |
getFileInfoStringForFirstSelectedFile:longInfo |
8983 |
"get stat info on selected file - return a string which can be |
|
8984 |
shown in a box" |
|
8985 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
8986 |
|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
|
8987 |
sizeString fileSize tAccess tModification buffer| |
3906 | 8988 |
|
7560 | 8989 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
8990 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 8991 |
filename := selFiles first. |
8992 |
||
8364 | 8993 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8994 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8995 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8996 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8997 |
]. |
8364 | 8998 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
8999 |
buffer := Text writeStream. |
4765 | 9000 |
|
9001 |
buffer |
|
9002 |
nextPutAll:'filename: '; |
|
9003 |
nextPutLine:filename asString. |
|
9004 |
||
8364 | 9005 |
OperatingSystem isMSDOSlike ifTrue: [ |
9006 |
(info alternativeName notNil |
|
9007 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
9008 |
buffer nextPutAll:'shortname: '. |
|
9009 |
buffer nextPutLine:info alternativeName. |
|
9010 |
] |
|
9011 |
]. |
|
9012 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9013 |
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
|
9014 |
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
|
9015 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9016 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9017 |
]. |
4765 | 9018 |
buffer |
9019 |
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
|
9020 |
nextPutLine:(info path ? '???'). |
3906 | 9021 |
] 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
|
9022 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9023 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9024 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9025 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9026 |
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
|
9027 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9028 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9029 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9030 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9031 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9032 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9033 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9034 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9035 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9036 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9037 |
fileSize > 1024 ifTrue:[ |
8172 | 9038 |
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
|
9039 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9040 |
]. |
4765 | 9041 |
buffer nextPutLine:sizeString. |
3906 | 9042 |
|
9043 |
modeBits := info mode. |
|
9044 |
modeString := self getModeString:modeBits. |
|
4765 | 9045 |
|
9046 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 9047 |
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
|
9048 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 9049 |
]. |
4765 | 9050 |
buffer |
9051 |
cr; |
|
9052 |
nextPutAll:'owner: '; |
|
9053 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
9054 |
||
3906 | 9055 |
longInfo ifTrue:[ |
4765 | 9056 |
buffer |
9057 |
nextPutAll:'group: '; |
|
9058 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9059 |
||
9060 |
tAccess := info accessTime. |
|
9061 |
buffer |
|
9062 |
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
|
9063 |
nextPutAll:tAccess asDate printString; |
4765 | 9064 |
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
|
9065 |
nextPutLine:tAccess asTime printString. |
4765 | 9066 |
|
9067 |
tModification := info modificationTime. |
|
9068 |
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
|
9069 |
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
|
9070 |
nextPutAll:tModification asDate printString; |
4765 | 9071 |
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
|
9072 |
nextPutLine:tModification asTime printString. |
3906 | 9073 |
]. |
4765 | 9074 |
^ buffer contents |
7560 | 9075 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9076 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9077 |
! |
9078 |
||
8510 | 9079 |
hasImageColorHistogram |
9080 |
^ ImageColorHistogram notNil |
|
9081 |
! |
|
9082 |
||
17686 | 9083 |
hasImageHistogram |
9084 |
^ ImageAlgorithms notNil |
|
9085 |
||
9086 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9087 |
! |
|
9088 |
||
10258 | 9089 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9090 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9091 |
|
9092 |
"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
|
9093 |
"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
|
9094 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9095 |
! |
9096 |
||
3892 | 9097 |
initialCommandFor:fileName into:aBox |
9098 |
"set a useful initial command for execute box." |
|
9099 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
9100 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 9101 |
! |
9102 |
||
9103 |
isAbstractFileBrowser |
|
9104 |
||
9105 |
^ true |
|
9106 |
! |
|
9107 |
||
9108 |
systemIsDOS |
|
9109 |
||
9110 |
^ OperatingSystem isMSDOSlike |
|
9111 |
! |
|
9112 |
||
12473 | 9113 |
systemIsOSX |
9114 |
||
9115 |
^ OperatingSystem isOSXlike |
|
9116 |
! |
|
9117 |
||
3892 | 9118 |
systemIsUnix |
9119 |
^ OperatingSystem isUNIXlike |
|
14980 | 9120 |
! |
9121 |
||
9122 |
systemSupportsVolumes |
|
9123 |
||
9124 |
^ OperatingSystem supportsVolumes |
|
3892 | 9125 |
! ! |
9126 |
||
9127 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9128 |
||
9129 |
allItemsOfCurrentDirectory |
|
5009 | 9130 |
self |
4774 | 9131 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9132 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9133 |
||
9134 |
^ nil |
|
3892 | 9135 |
! |
9136 |
||
9137 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9138 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9139 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9140 |
(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
|
9141 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9142 |
]. |
9143 |
^ false. |
|
9144 |
! |
|
9145 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9146 |
commonPrefixOfSelectedFiles |
4773 | 9147 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9148 |
|
7560 | 9149 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9150 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9151 |
|
4772 | 9152 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 9153 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9154 |
stringCol from:2 do:[:el| |
4773 | 9155 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9156 |
]. |
4773 | 9157 |
^ firstPre asFilename |
7560 | 9158 |
|
9159 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9160 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9161 |
|
12481 | 9162 |
compressTabsOnSave |
9163 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9164 |
when saving. |
|
9165 |
Default is true" |
|
9166 |
||
9167 |
^ true |
|
9168 |
! |
|
9169 |
||
3892 | 9170 |
currentFilesAreInSameDirectory |
9171 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9172 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9173 |
! |
9174 |
||
9175 |
currentFilesHasDirectories |
|
9176 |
||
6725 | 9177 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9178 |
! |
9179 |
||
3982 | 9180 |
directoriesForFiles:aFileCol |
11743 | 9181 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9182 |
! |
9183 |
||
3892 | 9184 |
fileListIsEmpty |
5009 | 9185 |
self |
9186 |
applicationNamed:#DirectoryContentsBrowser |
|
9187 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9188 |
||
9189 |
^ nil. |
|
3892 | 9190 |
! |
9191 |
||
9192 |
fileListIsNotEmpty |
|
9193 |
||
9194 |
^ self fileListIsEmpty not. |
|
9195 |
! |
|
9196 |
||
9197 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9198 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9199 |
|
9200 |
| file1 file2 | |
|
9201 |
||
6284 | 9202 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9203 |
file1 := aFilename1 asFilename. |
9204 |
file2 := aFilename2 asFilename. |
|
6284 | 9205 |
|
3892 | 9206 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9207 |
|
3892 | 9208 |
((file1 isDirectory) |
9209 |
and:[(file2 isDirectory) |
|
9210 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9211 |
^ file1 baseName = file2 baseName |
3892 | 9212 |
]. |
3982 | 9213 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9214 |
! |
9215 |
||
9216 |
getAllFilesAsStringCollection |
|
5009 | 9217 |
self |
9218 |
applicationNamed:#DirectoryContentsBrowser |
|
9219 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9220 |
||
9221 |
^ nil |
|
3892 | 9222 |
! |
9223 |
||
9224 |
getBestDirectory |
|
9225 |
||
9226 |
|selFiles stringCol firstPre| |
|
9227 |
||
6725 | 9228 |
selFiles := self currentSelectedDirectories. |
3892 | 9229 |
selFiles isEmpty ifTrue:[^ nil]. |
9230 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 9231 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 9232 |
firstPre := stringCol at:1. |
9233 |
stringCol from:2 do:[:el| |
|
4414 | 9234 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 9235 |
]. |
9236 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 9237 |
firstPre removeLast. |
3892 | 9238 |
]. |
9239 |
^ firstPre asFilename |
|
9240 |
! |
|
9241 |
||
9242 |
getDirWithoutFileName:aFileName |
|
9243 |
||
9244 |
| dir | |
|
9245 |
aFileName isNil ifTrue:[ |
|
4414 | 9246 |
^ aFileName. |
3892 | 9247 |
]. |
9248 |
dir := aFileName asFilename. |
|
9249 |
dir isDirectory ifFalse:[ |
|
4414 | 9250 |
dir := dir directory. |
3892 | 9251 |
]. |
9252 |
^ dir. |
|
9253 |
! |
|
9254 |
||
9255 |
getInfoItem |
|
9256 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9257 |
This file is automatically shown when a directory is entered. |
3892 | 9258 |
You can add more names below if you like." |
9259 |
||
5880 | 9260 |
|dir| |
9261 |
||
9262 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9263 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9264 |
|
16778 | 9265 |
#( |
3892 | 9266 |
'.dir.info' |
9267 |
'README' |
|
9268 |
'ReadMe' |
|
9269 |
'Readme' |
|
9270 |
'readme' |
|
9271 |
'read.me' |
|
9272 |
'Read.me' |
|
9273 |
'READ.ME' |
|
9274 |
'README.TXT' |
|
15915 | 9275 |
'README.txt' |
3892 | 9276 |
'readme.txt' |
9277 |
'Readme.txt' |
|
9278 |
'Info.txt' |
|
9279 |
'info.txt' |
|
9280 |
'INFO.TXT' |
|
15915 | 9281 |
'INFO.txt' |
16778 | 9282 |
) do:[:f | |
5883 | 9283 |
|n| |
4414 | 9284 |
|
5880 | 9285 |
n := dir construct:f. |
4414 | 9286 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
9287 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
9288 |
] |
|
3892 | 9289 |
]. |
9290 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9291 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9292 |
|
12497 | 9293 |
hasPackageDirectorySelected |
9294 |
|dir| |
|
9295 |
||
9296 |
dir := self currentDirectory. |
|
9297 |
^ dir notNil |
|
9298 |
and:[ dir exists |
|
9299 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9300 |
! |
|
9301 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9302 |
parentDirectoriesOfCurrentFiles |
11743 | 9303 |
^ self currentSelectedObjects |
9304 |
collect:[:file | file directory] as:Set |
|
7560 | 9305 |
|
9306 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9307 |
! |
9308 |
||
9309 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9310 |
^ true. "/ the code below is too slow for a menu enabling operation |
9311 |
||
9312 |
"/ |directories| |
|
9313 |
"/ |
|
9314 |
"/ directories := self currentDirectories value. |
|
9315 |
"/ directories do:[:dir| |
|
9316 |
"/ [ |
|
9317 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9318 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9319 |
"/ ] |
|
9320 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9321 |
"/ ]. |
|
9322 |
"/ ^ false. |
|
6586 | 9323 |
! |
9324 |
||
9325 |
recursiveAnySTFilesPresent |
|
9326 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9327 |
! ! |
9328 |
||
9329 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9330 |
||
9331 |
currentSelectedDirectories |
|
6725 | 9332 |
^ self currentDirectoriesValue. |
3982 | 9333 |
! |
9334 |
||
9335 |
currentSelectedFiles |
|
12824 | 9336 |
^ self currentSelectedObjects reject:[:file | file isDirectory]. |
7560 | 9337 |
|
9338 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9339 |
! |
9340 |
||
6460 | 9341 |
currentSelectedObjects |
9342 |
^ self currentFileNameHolder value |
|
9343 |
! |
|
9344 |
||
3982 | 9345 |
firstSelectedFile |
7560 | 9346 |
^ self currentSelectedObjects |
12102 | 9347 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9348 |
ifNone:[]. |
7560 | 9349 |
|
9350 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9351 |
! |
9352 |
||
9490 | 9353 |
hasOnlyDirectoriesSelected |
9354 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9355 |
||
9356 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9357 |
! |
|
9358 |
||
4414 | 9359 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9360 |
|
7560 | 9361 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9362 |
||
9363 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9364 |
! |
9365 |
||
9490 | 9366 |
hasTwoDirectoriesSelected |
9367 |
||
9368 |
^ self currentSelectedObjects size == 2 |
|
9369 |
and:[self hasOnlyDirectoriesSelected] |
|
9370 |
||
9371 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9372 |
! |
|
9373 |
||
4414 | 9374 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9375 |
|
7560 | 9376 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9377 |
and:[self hasOnlyFilesSelected] |
7560 | 9378 |
|
9379 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9380 |
! |
9381 |
||
9382 |
selectNextFile |
|
9383 |
self |
|
9384 |
applicationNamed:#DirectoryContentsBrowser |
|
9385 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9386 |
! |
|
9387 |
||
9388 |
selectPreviousFile |
|
9389 |
self |
|
9390 |
applicationNamed:#DirectoryContentsBrowser |
|
9391 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
3892 | 9392 |
! ! |
9393 |
||
3964 | 9394 |
!AbstractFileBrowser methodsFor:'sorting'! |
9395 |
||
3989 | 9396 |
currentSortOrder |
4027 | 9397 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 9398 |
! |
9399 |
||
9400 |
sortBlockHolder |
|
9401 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9402 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9403 |
selector:#fileName |
|
9404 |
sortCaseless:self sortCaseless value |
|
9405 |
sortReverse:false) asValue. |
|
3989 | 9406 |
]. |
9407 |
! |
|
9408 |
||
9409 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9410 |
|v| |
4027 | 9411 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9412 |
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
|
9413 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9414 |
^ v. |
3989 | 9415 |
! |
9416 |
||
9417 |
sortCaseless |
|
4201 | 9418 |
" aspect for sort caseless " |
3989 | 9419 |
|
13000 | 9420 |
^ self |
9421 |
aspectFor:#sortCaseless |
|
9422 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9423 |
! |
9424 |
||
4074 | 9425 |
sortDirectoriesBeforeFiles |
9426 |
||
4201 | 9427 |
" aspect for sort directories always before files" |
4074 | 9428 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9429 |
! |
|
9430 |
||
3989 | 9431 |
sortFileListsBy:instanceName |
9432 |
||
9433 |
self sortFileListsBy:instanceName withReverse:true |
|
9434 |
! |
|
9435 |
||
9436 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9437 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9438 |
|
9439 |
aSymbol := instanceName asSymbol. |
|
4027 | 9440 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9441 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9442 |
currentSortOrder := self currentSortOrder value. |
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9443 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9444 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9445 |
currentSortOrder at:#column put:aSymbol. |
9446 |
currentSortOrder at:#reverse put:false. |
|
9447 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9448 |
] ifFalse:[ |
4343 | 9449 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9450 |
"/ sort caseless changed |
|
9451 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9452 |
] ifFalse:[ |
|
9453 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9454 |
"/ same column like before - change sort order ifReverse is true |
|
9455 |
aBoolean ifTrue:[ |
|
9456 |
isReverse := currentSortOrder at:#reverse. |
|
9457 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9458 |
]. |
|
9459 |
] ifFalse:[ |
|
9460 |
"/ another column - remark column |
|
9461 |
currentSortOrder at:#column put:aSymbol. |
|
9462 |
] |
|
9463 |
] |
|
3964 | 9464 |
]. |
4027 | 9465 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9466 |
|
5383 | 9467 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9468 |
selector:instanceName |
|
9469 |
sortCaseless:sortCaselessLocal |
|
9470 |
sortReverse:(currentSortOrder at:#reverse). |
|
9471 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9472 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9473 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
3964 | 9474 |
! ! |
9475 |
||
3892 | 9476 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9477 |
||
16720 | 9478 |
initializeAspects |
9479 |
aspects := IdentityDictionary new. |
|
9480 |
aspects at:#applications put:(IdentityDictionary new). |
|
9481 |
! |
|
9482 |
||
3892 | 9483 |
makeDependent |
4074 | 9484 |
self filterModel addDependent:self. |
4004 | 9485 |
self currentFileNameHolder addDependent:self. |
4074 | 9486 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9487 |
self sortCaseless addDependent:self. |
4011 | 9488 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9489 |
self rootHolder addDependent:self. |
3892 | 9490 |
! |
9491 |
||
9492 |
masterApplication:anApplication |
|
9493 |
||
9494 |
masterApplication isNil ifTrue:[ |
|
4414 | 9495 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9496 |
aspects := anApplication aspects |
|
9497 |
] ifFalse:[ |
|
9498 |
aspects isNil ifTrue:[ |
|
16721 | 9499 |
self initializeAspects. |
4414 | 9500 |
] |
9501 |
]. |
|
9502 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9503 |
"/ self makeDependent. |
3892 | 9504 |
]. |
3952 | 9505 |
^ super masterApplication:anApplication. |
3892 | 9506 |
! |
9507 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9508 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9509 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9510 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9511 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9512 |
|
3892 | 9513 |
postOpenWith:aBuilder |
9514 |
||
9515 |
super postOpenWith:aBuilder. |
|
14655 | 9516 |
"/ now done for all windowGroups by the group itself |
9517 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9518 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9519 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9520 |
! ! |
9521 |
||
9522 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9523 |
||
9524 |
files |
|
9525 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9526 |
||
9527 |
^ files |
|
9528 |
! |
|
9529 |
||
9530 |
files:something |
|
9531 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9532 |
||
9533 |
files := something. |
|
9534 |
! |
|
9535 |
||
9536 |
method |
|
9537 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9538 |
||
9539 |
^ method |
|
9540 |
! |
|
9541 |
||
9542 |
method:something |
|
9543 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9544 |
||
9545 |
method := something. |
|
9546 |
! ! |
|
9547 |
||
9548 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9549 |
||
9550 |
locked |
|
9551 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
9552 |
||
9553 |
locked isNil ifTrue:[ |
|
4414 | 9554 |
locked := false. |
3892 | 9555 |
]. |
9556 |
^ locked |
|
9557 |
! ! |
|
9558 |
||
9559 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
9560 |
||
9561 |
doIfUnLocked:aBlock |
|
9562 |
||
9563 |
self locked ifFalse:[ |
|
4414 | 9564 |
aBlock value. |
3892 | 9565 |
]. |
9566 |
! |
|
9567 |
||
9568 |
doLocked:aBlock |
|
9569 |
||
9570 |
locked := true. |
|
4004 | 9571 |
aBlock ensure:[ |
4414 | 9572 |
locked := false. |
4004 | 9573 |
] |
3892 | 9574 |
! ! |
9575 |
||
3952 | 9576 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
9577 |
||
6369 | 9578 |
defaultHistorySize |
9579 |
^ 50 |
|
3892 | 9580 |
! ! |
9581 |
||
6371 | 9582 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 9583 |
|
9584 |
new |
|
6371 | 9585 |
^ (super new) initializeHistory. |
6369 | 9586 |
! ! |
9587 |
||
9588 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
9589 |
||
9590 |
historySize |
|
9591 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
9592 |
^ historySize |
|
9593 |
! |
|
9594 |
||
9595 |
historySize:aNumber |
|
9596 |
historySize := aNumber |
|
4032 | 9597 |
! ! |
9598 |
||
3892 | 9599 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
9600 |
||
3952 | 9601 |
addToHistory:aPath |
15803 | 9602 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9603 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9604 |
pathToAdd := aPath. |
15803 | 9605 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9606 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 9607 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9608 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9609 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9610 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9611 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9612 |
self backForwardListAdd:pathToAdd. |
3952 | 9613 |
item isNil ifTrue:[ |
4347 | 9614 |
" not already in history" |
6369 | 9615 |
self size >= self historySize ifTrue:[ |
4347 | 9616 |
self removeLast. |
9617 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9618 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 9619 |
] ifFalse:[ |
4347 | 9620 |
"already been there before; move the entry to |
9621 |
the beginning, so it will fall out later." |
|
9622 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9623 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9624 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9625 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9626 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 9627 |
! |
9628 |
||
4347 | 9629 |
backForwardListAdd:aPath |
9630 |
|pathIndex| |
|
9631 |
||
9632 |
pathIndex := backForwardList indexOf:aPath. |
|
9633 |
pathIndex == 0 ifTrue:[ |
|
9634 |
" a new path comes in remove forward paths " |
|
9635 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
9636 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
9637 |
]. |
|
9638 |
] ifFalse:[ |
|
9639 |
backForwardList remove:aPath. |
|
9640 |
pathIndex <= backForwardIndex ifTrue:[ |
|
9641 |
backForwardIndex := backForwardIndex - 1. |
|
9642 |
] |
|
4022 | 9643 |
]. |
4347 | 9644 |
backForwardList add:aPath afterIndex:backForwardIndex. |
9645 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 9646 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 9647 |
backForwardList removeFirst. |
9648 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 9649 |
]. |
4347 | 9650 |
! |
9651 |
||
9652 |
goBackward |
|
4288 | 9653 |
"return the first path of the backward list; |
9654 |
remove it from the back list and add it ti the forward list." |
|
4022 | 9655 |
|
4347 | 9656 |
|retPath| |
9657 |
||
9658 |
self canBackward ifTrue:[ |
|
9659 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
9660 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 9661 |
]. |
4022 | 9662 |
^ retPath. |
9663 |
! |
|
9664 |
||
9665 |
goForward |
|
4288 | 9666 |
"return the first path of the forward list; |
9667 |
remove it from the list." |
|
4022 | 9668 |
|
4347 | 9669 |
|retPath| |
9670 |
||
9671 |
self canForward ifTrue:[ |
|
9672 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9673 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 9674 |
]. |
4022 | 9675 |
^ retPath. |
9676 |
! |
|
9677 |
||
9678 |
resetForwardBackward |
|
9679 |
||
4347 | 9680 |
self initialize |
4022 | 9681 |
! |
9682 |
||
9683 |
setPosition:aPosition for:aPath |
|
9684 |
||
9685 |
self do:[:item| |
|
4414 | 9686 |
item path = aPath ifTrue:[ |
9687 |
item position:aPosition. |
|
9688 |
] |
|
4022 | 9689 |
]. |
3892 | 9690 |
! ! |
9691 |
||
4870 | 9692 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 9693 |
|
6371 | 9694 |
initializeHistory |
4032 | 9695 |
|
4347 | 9696 |
backForwardList := OrderedCollection new. |
9697 |
self reverseDo:[:el| |
|
9698 |
backForwardList add:el path. |
|
9699 |
]. |
|
9700 |
backForwardIndex := backForwardList size. |
|
4032 | 9701 |
! ! |
9702 |
||
3892 | 9703 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
9704 |
||
4288 | 9705 |
canBackward |
4347 | 9706 |
|
9707 |
^ backForwardIndex > 1 |
|
4288 | 9708 |
! |
9709 |
||
3892 | 9710 |
canForward |
4347 | 9711 |
|
9712 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
9713 |
! |
|
9714 |
||
9715 |
getBackCollection |
|
9716 |
||
9717 |
| backCol | |
|
9718 |
||
9719 |
backCol := OrderedCollection new. |
|
9720 |
self canBackward ifTrue:[ |
|
9721 |
| tmpCol | |
|
9722 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
9723 |
tmpCol reverseDo:[ :el| |
|
9724 |
backCol add:el. |
|
9725 |
] |
|
9726 |
]. |
|
9727 |
^ backCol |
|
3952 | 9728 |
! |
9729 |
||
9730 |
getForwardCollection |
|
9731 |
||
4347 | 9732 |
| forwCol | |
9733 |
||
9734 |
forwCol := OrderedCollection new. |
|
9735 |
self canForward ifTrue:[ |
|
9736 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
9737 |
]. |
|
9738 |
^ forwCol |
|
3952 | 9739 |
! |
9740 |
||
9741 |
getItemFor:aPath |
|
6627 | 9742 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
9743 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
9744 |
"/ ^ nil. |
|
3952 | 9745 |
! |
9746 |
||
9747 |
getPositionFor:aPath |
|
9748 |
||
9749 |
|item| |
|
9750 |
||
9751 |
item := self getItemFor:aPath. |
|
9752 |
||
9753 |
item notNil ifTrue:[ |
|
4414 | 9754 |
^ item position. |
3952 | 9755 |
]. |
9756 |
^ nil |
|
9757 |
! |
|
9758 |
||
9759 |
includesPath:aPath |
|
6627 | 9760 |
^ self contains:[:item | item path = aPath]. |
9761 |
||
9762 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
9763 |
"/ ^ false. |
|
4347 | 9764 |
! |
9765 |
||
9766 |
nextBackwardItem |
|
9767 |
"return the first path of the backward list" |
|
9768 |
||
9769 |
|retPath| |
|
9770 |
||
9771 |
self canBackward ifTrue:[ |
|
9772 |
retPath := backForwardList at:backForwardIndex. |
|
9773 |
]. |
|
9774 |
^ retPath. |
|
9775 |
! |
|
9776 |
||
9777 |
nextForwardItem |
|
9778 |
"return the first path of the forward list" |
|
9779 |
||
9780 |
|retPath| |
|
9781 |
||
9782 |
self canForward ifTrue:[ |
|
9783 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9784 |
]. |
|
9785 |
^ retPath. |
|
3952 | 9786 |
! ! |
9787 |
||
9788 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
9789 |
||
9790 |
path:aPath |
|
9791 |
||
9792 |
^ self new path:aPath |
|
9793 |
! ! |
|
9794 |
||
9795 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
9796 |
||
6433 | 9797 |
asFilename |
9798 |
^ path asFilename |
|
9799 |
! |
|
9800 |
||
3952 | 9801 |
path |
9802 |
"return the value of the instance variable 'path' (automatically generated)" |
|
9803 |
||
9804 |
^ path |
|
9805 |
! |
|
9806 |
||
9807 |
path:something |
|
9808 |
"set the value of the instance variable 'path' (automatically generated)" |
|
9809 |
||
9810 |
path := something. |
|
9811 |
! |
|
9812 |
||
9813 |
position |
|
9814 |
"return the value of the instance variable 'position' (automatically generated)" |
|
9815 |
||
9816 |
^ position |
|
9817 |
! |
|
9818 |
||
9819 |
position:something |
|
9820 |
"set the value of the instance variable 'position' (automatically generated)" |
|
9821 |
||
9822 |
position := something. |
|
9823 |
! |
|
9824 |
||
9825 |
printString |
|
9826 |
||
9827 |
^ self path asString |
|
3892 | 9828 |
! ! |
9829 |
||
9830 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
9831 |
||
9832 |
withValue:aValue isHolder:aBoolean |
|
9833 |
||
9834 |
| instance | |
|
9835 |
||
9836 |
instance := self basicNew. |
|
9837 |
instance value:aValue. |
|
9838 |
instance isHolder:aBoolean. |
|
9839 |
^ instance |
|
9840 |
! ! |
|
9841 |
||
9842 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
9843 |
||
9844 |
isHolder |
|
9845 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
9846 |
||
9847 |
^ isHolder |
|
9848 |
! |
|
9849 |
||
9850 |
isHolder:something |
|
9851 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
9852 |
||
9853 |
isHolder := something. |
|
9854 |
! |
|
9855 |
||
9856 |
value |
|
9857 |
"return the value of the instance variable 'value' (automatically generated)" |
|
9858 |
||
9859 |
^ value |
|
9860 |
! |
|
9861 |
||
9862 |
value:something |
|
9863 |
"set the value of the instance variable 'value' (automatically generated)" |
|
9864 |
||
9865 |
value := something. |
|
9866 |
! ! |
|
9867 |
||
9868 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
9869 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9870 |
version |
15803 | 9871 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9872 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9873 |
|
8832 | 9874 |
version_CVS |
15803 | 9875 |
^ '$Header$' |
3892 | 9876 |
! ! |
12094 | 9877 |