author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 Jan 2013 11:15:09 +0000 | |
branch | jv |
changeset 12401 | 4714b9640528 |
parent 12308 | 5d9291c0fc27 |
parent 11886 | 0c039c26ad7b |
child 12431 | 9f0c59c742d5 |
permissions | -rw-r--r-- |
9972 | 1 |
" |
10085 | 2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
9972 | 4 |
|
10085 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9972 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
HierarchicalList subclass:#BookmarkList |
|
29 |
instanceVariableNames:'fileName' |
|
12221
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
30 |
classVariableNames:'BrowserBookmarks WorkspaceBookmarks WebBookmarks FileBookmarks' |
9972 | 31 |
poolDictionaries:'' |
32 |
category:'Interface-Bookmarks' |
|
33 |
! |
|
34 |
||
35 |
!BookmarkList class methodsFor:'documentation'! |
|
36 |
||
37 |
copyright |
|
38 |
" |
|
10085 | 39 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
40 |
Copyright (c) 2009-2010 eXept Software AG |
|
41 |
||
42 |
Permission is hereby granted, free of charge, to any person |
|
43 |
obtaining a copy of this software and associated documentation |
|
44 |
files (the 'Software'), to deal in the Software without |
|
45 |
restriction, including without limitation the rights to use, |
|
46 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
47 |
copies of the Software, and to permit persons to whom the |
|
48 |
Software is furnished to do so, subject to the following |
|
49 |
conditions: |
|
9972 | 50 |
|
10085 | 51 |
The above copyright notice and this permission notice shall be |
52 |
included in all copies or substantial portions of the Software. |
|
53 |
||
54 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
55 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
56 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
57 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
58 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
59 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
60 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
61 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9972 | 62 |
" |
63 |
! ! |
|
64 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
65 |
|
9972 | 66 |
!BookmarkList class methodsFor:'instance creation'! |
67 |
||
68 |
decodeFromLiteralArray:anArray |
|
69 |
||
11886
0c039c26ad7b
comment/format in: #decodeFromLiteralArray:
Claus Gittinger <cg@exept.de>
parents:
10911
diff
changeset
|
70 |
(anArray size == 3 and: [anArray second == #root:]) ifFalse:[ |
0c039c26ad7b
comment/format in: #decodeFromLiteralArray:
Claus Gittinger <cg@exept.de>
parents:
10911
diff
changeset
|
71 |
self breakPoint: #jv. |
0c039c26ad7b
comment/format in: #decodeFromLiteralArray:
Claus Gittinger <cg@exept.de>
parents:
10911
diff
changeset
|
72 |
^ super decodeFromLiteralArray:anArray |
0c039c26ad7b
comment/format in: #decodeFromLiteralArray:
Claus Gittinger <cg@exept.de>
parents:
10911
diff
changeset
|
73 |
]. |
9972 | 74 |
|
75 |
^self new root: anArray third decodeAsLiteralArray |
|
76 |
||
77 |
"Created: / 23-05-2011 / 14:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
78 |
! |
|
79 |
||
80 |
new |
|
81 |
"return an initialized instance" |
|
82 |
||
83 |
^ super new initialize. |
|
84 |
||
85 |
"Modified: / 23-05-2011 / 13:57:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
86 |
! |
|
87 |
||
88 |
readFrom: aStream onError: aBlock |
|
89 |
||
90 |
| litArray | |
|
91 |
^[ |
|
92 |
litArray := Compiler evaluate: aStream contents asString. |
|
93 |
litArray decodeAsLiteralArray. |
|
94 |
] on: Error do: [ |
|
95 |
aBlock value. |
|
96 |
nil |
|
97 |
] |
|
98 |
||
99 |
"Created: / 23-05-2011 / 15:58:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
100 |
! |
|
101 |
||
102 |
readFromFile: aStringOrFilename |
|
103 |
||
104 |
| bookmarks file | |
|
105 |
file := aStringOrFilename asFilename. |
|
106 |
file exists ifFalse: |
|
107 |
[self error: ('File does %1 not exists' bindWith: file pathName)]. |
|
108 |
bookmarks := self readFrom: file readStream onError: |
|
109 |
[self error: ('Cannot parse %1 not exists' bindWith: file pathName)]. |
|
110 |
bookmarks fileName: file pathName. |
|
111 |
^bookmarks |
|
112 |
||
113 |
"Created: / 23-05-2011 / 16:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
114 |
! |
|
115 |
||
116 |
readFromFile: aStringOrFilename onError: aBlock |
|
10864 | 117 |
| bookmarks file | |
9972 | 118 |
|
119 |
file := aStringOrFilename asFilename. |
|
10864 | 120 |
file exists ifFalse: [^aBlock value]. |
121 |
bookmarks := self readFrom: file readStream onError: [^aBlock value]. |
|
122 |
bookmarks isNil ifTrue: [^aBlock value]. |
|
9972 | 123 |
bookmarks fileName: file pathName. |
124 |
^bookmarks |
|
125 |
||
126 |
"Created: / 23-05-2011 / 16:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
127 |
"Modified: / 02-06-2011 / 19:43:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10864 | 128 |
"Modified: / 18-11-2011 / 14:32:24 / cg" |
9972 | 129 |
! ! |
130 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
131 |
|
9972 | 132 |
!BookmarkList class methodsFor:'accessing'! |
133 |
||
12221
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
134 |
forFileBrowser |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
135 |
FileBookmarks isNil ifTrue:[ |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
136 |
self initializeFileBookmarks |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
137 |
]. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
138 |
^ FileBookmarks |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
139 |
|
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
140 |
"Created: / 04-04-2012 / 12:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
141 |
! |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
142 |
|
9972 | 143 |
forSystemBrowser |
144 |
||
145 |
BrowserBookmarks isNil ifTrue: |
|
146 |
[self initializeBrowserBookmarks]. |
|
147 |
^BrowserBookmarks |
|
148 |
||
149 |
"Created: / 23-05-2011 / 10:10:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
150 |
! |
|
151 |
||
152 |
forWebBrowser |
|
153 |
||
154 |
WebBookmarks isNil ifTrue: |
|
155 |
[self initializeWebBookmarks]. |
|
156 |
^WebBookmarks |
|
157 |
||
158 |
"Created: / 08-06-2011 / 12:15:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
159 |
! |
|
160 |
||
161 |
forWorkspace |
|
162 |
||
163 |
WorkspaceBookmarks isNil ifTrue: |
|
164 |
[self initializeWorkspaceBookmarks]. |
|
165 |
^WorkspaceBookmarks |
|
166 |
||
167 |
"Created: / 20-06-2011 / 22:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
168 |
! ! |
|
169 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
170 |
|
9972 | 171 |
!BookmarkList class methodsFor:'accessing - defaults'! |
172 |
||
173 |
defaultLabelForMyWorkspaces |
|
174 |
||
175 |
^'My Workspaces' |
|
176 |
||
177 |
"Created: / 21-06-2011 / 08:35:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
178 |
! |
|
179 |
||
180 |
defaultLabelForRecent |
|
181 |
||
182 |
^'Recent' |
|
183 |
||
184 |
"Created: / 21-06-2011 / 08:35:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
185 |
! ! |
|
186 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
187 |
|
9972 | 188 |
!BookmarkList class methodsFor:'class initialization'! |
189 |
||
190 |
initializeBrowserBookmarks |
|
191 |
||
192 |
| file | |
|
193 |
file := Filename defaultDirectory / 'browser-bookmarks.rc'. |
|
194 |
BrowserBookmarks := self readFromFile: file onError:[nil]. |
|
10911 | 195 |
BrowserBookmarks notNil ifTrue:[^self]. |
9972 | 196 |
|
197 |
file := Filename homeDirectory / '.smalltalk' / 'browser-bookmarks.rc'. |
|
198 |
BrowserBookmarks := self readFromFile: file onError:[nil]. |
|
10911 | 199 |
BrowserBookmarks notNil ifTrue:[^self]. |
9972 | 200 |
|
201 |
BrowserBookmarks := self new fileName: file pathName. |
|
202 |
||
203 |
"Created: / 23-05-2011 / 10:06:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
204 |
"Modified: / 23-05-2011 / 16:35:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10911 | 205 |
"Modified: / 29-11-2011 / 11:21:06 / cg" |
9972 | 206 |
! |
207 |
||
12221
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
208 |
initializeFileBookmarks |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
209 |
|
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
210 |
| file | |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
211 |
file := Filename defaultDirectory / 'file-bookmarks.rc'. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
212 |
FileBookmarks := self readFromFile: file onError:[nil]. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
213 |
FileBookmarks notNil ifTrue:[^self]. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
214 |
|
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
215 |
file := Filename homeDirectory / '.smalltalk' / 'file-bookmarks.rc'. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
216 |
FileBookmarks := self readFromFile: file onError:[nil]. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
217 |
FileBookmarks notNil ifTrue:[^self]. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
218 |
|
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
219 |
FileBookmarks := self new fileName: file pathName. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
220 |
|
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
221 |
"Created: / 04-04-2012 / 12:05:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
222 |
! |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
223 |
|
9972 | 224 |
initializeWebBookmarks |
225 |
||
226 |
| file | |
|
227 |
file := Filename defaultDirectory / 'web-bookmarks.rc'. |
|
228 |
WebBookmarks := self readFromFile: file onError:[nil]. |
|
10911 | 229 |
WebBookmarks notNil ifTrue:[^self]. |
9972 | 230 |
|
231 |
file := Filename homeDirectory / '.smalltalk' / 'web-bookmarks.rc'. |
|
232 |
WebBookmarks := self readFromFile: file onError:[nil]. |
|
10911 | 233 |
WebBookmarks notNil ifTrue:[^self]. |
9972 | 234 |
|
235 |
WebBookmarks := self new fileName: file pathName. |
|
236 |
||
237 |
"Created: / 08-06-2011 / 12:15:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10911 | 238 |
"Modified: / 29-11-2011 / 11:21:10 / cg" |
9972 | 239 |
! |
240 |
||
241 |
initializeWorkspaceBookmarks |
|
242 |
||
243 |
| file | |
|
244 |
file := Filename defaultDirectory / 'workspace-bookmarks.rc'. |
|
245 |
WorkspaceBookmarks := self readFromFile: file onError:[nil]. |
|
10911 | 246 |
WorkspaceBookmarks notNil ifTrue:[^self]. |
9972 | 247 |
|
248 |
file := Filename homeDirectory / '.smalltalk' / 'workspace-bookmarks.rc'. |
|
249 |
WorkspaceBookmarks := self readFromFile: file onError:[nil]. |
|
10911 | 250 |
WorkspaceBookmarks notNil ifTrue:[^self]. |
9972 | 251 |
|
252 |
WorkspaceBookmarks := self new fileName: file pathName. |
|
253 |
WorkspaceBookmarks root add: |
|
254 |
((Bookmark forFolderNamed: self defaultLabelForMyWorkspaces) |
|
255 |
add: (Bookmark forFile: WorkspaceApplication defaultMyWorkspaceDotWspFile pathName); |
|
256 |
yourself). |
|
257 |
||
258 |
" |
|
259 |
WorkspaceBookmarks := nil. |
|
260 |
BookmarkList initializeWorkspaceBookmarks. |
|
261 |
" |
|
262 |
||
263 |
" |
|
264 |
WorkspaceBookmarks := nil. |
|
265 |
" |
|
266 |
||
267 |
"Created: / 20-06-2011 / 22:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
268 |
"Modified: / 21-06-2011 / 08:46:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10911 | 269 |
"Modified: / 29-11-2011 / 11:21:16 / cg" |
9972 | 270 |
! ! |
271 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
272 |
|
9972 | 273 |
!BookmarkList methodsFor:'accessing'! |
274 |
||
275 |
/ label |
|
276 |
||
277 |
^ self root / label |
|
278 |
||
279 |
"Created: / 21-06-2011 / 08:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
280 |
! |
|
281 |
||
282 |
fileName |
|
283 |
^ fileName |
|
284 |
! |
|
285 |
||
286 |
fileName:aString |
|
287 |
fileName := aString. |
|
288 |
! ! |
|
289 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
290 |
|
9972 | 291 |
!BookmarkList methodsFor:'accessing - special folders'! |
292 |
||
293 |
myWorkspaces |
|
294 |
||
295 |
^self / self class defaultLabelForMyWorkspaces |
|
296 |
||
297 |
" |
|
298 |
BookmarkList forWorkspace myWorkspaces |
|
299 |
" |
|
300 |
||
301 |
"Created: / 21-06-2011 / 08:53:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
302 |
! ! |
|
303 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
304 |
|
9972 | 305 |
!BookmarkList methodsFor:'change & update'! |
306 |
||
307 |
changed:aParameter with:anArgument |
|
308 |
||
309 |
super changed:aParameter with:anArgument. |
|
310 |
"/self save. |
|
311 |
||
312 |
"Created: / 23-05-2011 / 16:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
313 |
"Modified: / 02-06-2011 / 13:35:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
314 |
! ! |
|
315 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
316 |
|
9972 | 317 |
!BookmarkList methodsFor:'collection protocol'! |
318 |
||
319 |
add: item |
|
320 |
||
321 |
^root add: item |
|
322 |
||
323 |
"Created: / 23-05-2011 / 10:49:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
"Modified: / 23-05-2011 / 13:45:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
325 |
! |
|
326 |
||
327 |
contains: anObject |
|
328 |
||
329 |
^root contains: anObject |
|
330 |
||
331 |
"Created: / 23-05-2011 / 10:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
332 |
"Modified: / 23-05-2011 / 13:46:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
333 |
! |
|
334 |
||
335 |
remove: item ifAbsent: block |
|
336 |
||
337 |
^root remove: item |
|
338 |
||
339 |
"Created: / 23-05-2011 / 10:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
340 |
"Modified: / 23-05-2011 / 13:48:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
341 |
! ! |
|
342 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
343 |
|
9972 | 344 |
!BookmarkList methodsFor:'converting'! |
345 |
||
346 |
asMenu |
|
347 |
||
348 |
^root asMenu |
|
349 |
||
350 |
"Created: / 23-05-2011 / 10:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
351 |
! |
|
352 |
||
353 |
asMenuUsingBuilder: builderClass |
|
354 |
||
355 |
^self root asMenuUsingBuilder: builderClass |
|
356 |
||
357 |
"Created: / 21-06-2011 / 08:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
358 |
! |
|
359 |
||
360 |
literalArrayEncoding |
|
361 |
||
362 |
^Array |
|
363 |
with: self className |
|
364 |
with: #root: |
|
365 |
with: root literalArrayEncoding |
|
366 |
||
367 |
"Created: / 23-05-2011 / 14:23:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
368 |
! ! |
|
369 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
370 |
|
9972 | 371 |
!BookmarkList methodsFor:'initialization'! |
372 |
||
373 |
initialize |
|
374 |
"Invoked when a new instance is created." |
|
375 |
||
376 |
"/ please change as required (and remove this comment) |
|
377 |
super initialize. |
|
378 |
||
379 |
showRoot := false. |
|
380 |
self root: (Bookmark forFolderNamed: '<bookmarks>'). |
|
381 |
||
382 |
"Modified: / 23-05-2011 / 13:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
383 |
! ! |
|
384 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
385 |
|
9972 | 386 |
!BookmarkList methodsFor:'loading / saving'! |
387 |
||
388 |
save |
|
389 |
||
390 |
| f | |
|
391 |
||
392 |
(fileName notNil and: |
|
393 |
[(f := fileName asFilename) exists not or: |
|
394 |
[f isWritable]]) |
|
395 |
ifTrue:[self saveOn: fileName]. |
|
396 |
||
397 |
"Created: / 23-05-2011 / 16:38:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
398 |
! |
|
399 |
||
400 |
saveOn: aStringOrFilename |
|
401 |
||
402 |
aStringOrFilename asFilename writingFileDo: |
|
403 |
[:s|s nextPutAll: self literalArrayEncoding storeString]. |
|
404 |
||
405 |
"Created: / 23-05-2011 / 16:39:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
406 |
! ! |
|
407 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
408 |
|
9972 | 409 |
!BookmarkList methodsFor:'visiting'! |
410 |
||
411 |
acceptVisitor:aVisitor |
|
412 |
"Double dispatch back to the visitor, passing my type encoded in |
|
413 |
the selector (visitor pattern)" |
|
414 |
||
415 |
"stub code automatically generated - please change if required" |
|
416 |
||
417 |
^ aVisitor visitBookmarkList:self |
|
418 |
! ! |
|
419 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
420 |
|
9972 | 421 |
!BookmarkList class methodsFor:'documentation'! |
422 |
||
423 |
version_CVS |
|
11886
0c039c26ad7b
comment/format in: #decodeFromLiteralArray:
Claus Gittinger <cg@exept.de>
parents:
10911
diff
changeset
|
424 |
^ '$Header: /cvs/stx/stx/libtool/BookmarkList.st,v 1.5 2012-10-21 00:15:49 cg Exp $' |
9972 | 425 |
! |
426 |
||
427 |
version_SVN |
|
428 |
^ '§Id§' |
|
429 |
! ! |
|
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
430 |