9975
|
1 |
"
|
10083
|
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
3 |
Copyright (c) 2009-2010 eXept Software AG
|
9975
|
4 |
|
10083
|
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.
|
9975
|
25 |
"
|
|
26 |
"{ Package: 'stx:libtool' }"
|
|
27 |
|
15226
|
28 |
"{ NameSpace: Smalltalk }"
|
|
29 |
|
9975
|
30 |
HierarchicalItem subclass:#Bookmark
|
|
31 |
instanceVariableNames:'label icon'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'Interface-Bookmarks'
|
|
35 |
!
|
|
36 |
|
|
37 |
Bookmark subclass:#Class
|
|
38 |
instanceVariableNames:'className'
|
|
39 |
classVariableNames:''
|
|
40 |
poolDictionaries:''
|
|
41 |
privateIn:Bookmark
|
|
42 |
!
|
|
43 |
|
|
44 |
Bookmark subclass:#File
|
|
45 |
instanceVariableNames:'path'
|
|
46 |
classVariableNames:''
|
|
47 |
poolDictionaries:''
|
|
48 |
privateIn:Bookmark
|
|
49 |
!
|
|
50 |
|
|
51 |
Bookmark subclass:#Folder
|
|
52 |
instanceVariableNames:'name'
|
|
53 |
classVariableNames:''
|
|
54 |
poolDictionaries:''
|
|
55 |
privateIn:Bookmark
|
|
56 |
!
|
|
57 |
|
|
58 |
Bookmark subclass:#Method
|
|
59 |
instanceVariableNames:'className selector'
|
|
60 |
classVariableNames:''
|
|
61 |
poolDictionaries:''
|
|
62 |
privateIn:Bookmark
|
|
63 |
!
|
|
64 |
|
|
65 |
Bookmark::Folder subclass:#Recent
|
|
66 |
instanceVariableNames:'limit'
|
|
67 |
classVariableNames:''
|
|
68 |
poolDictionaries:''
|
|
69 |
privateIn:Bookmark
|
|
70 |
!
|
|
71 |
|
|
72 |
Bookmark subclass:#Separator
|
|
73 |
instanceVariableNames:''
|
|
74 |
classVariableNames:''
|
|
75 |
poolDictionaries:''
|
|
76 |
privateIn:Bookmark
|
|
77 |
!
|
|
78 |
|
|
79 |
Bookmark subclass:#URL
|
|
80 |
instanceVariableNames:'url'
|
|
81 |
classVariableNames:''
|
|
82 |
poolDictionaries:''
|
|
83 |
privateIn:Bookmark
|
|
84 |
!
|
|
85 |
|
|
86 |
!Bookmark class methodsFor:'documentation'!
|
|
87 |
|
|
88 |
copyright
|
|
89 |
"
|
10083
|
90 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
91 |
Copyright (c) 2009-2010 eXept Software AG
|
|
92 |
|
|
93 |
Permission is hereby granted, free of charge, to any person
|
|
94 |
obtaining a copy of this software and associated documentation
|
|
95 |
files (the 'Software'), to deal in the Software without
|
|
96 |
restriction, including without limitation the rights to use,
|
|
97 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
98 |
copies of the Software, and to permit persons to whom the
|
|
99 |
Software is furnished to do so, subject to the following
|
|
100 |
conditions:
|
9975
|
101 |
|
10083
|
102 |
The above copyright notice and this permission notice shall be
|
|
103 |
included in all copies or substantial portions of the Software.
|
|
104 |
|
|
105 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
106 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
107 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
108 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
109 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
110 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
111 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
112 |
OTHER DEALINGS IN THE SOFTWARE.
|
9975
|
113 |
"
|
|
114 |
! !
|
|
115 |
|
|
116 |
!Bookmark class methodsFor:'instance creation'!
|
|
117 |
|
|
118 |
forClass: aClass
|
|
119 |
|
|
120 |
^Bookmark::Class new className: aClass name
|
|
121 |
|
|
122 |
"
|
|
123 |
Bookmark forClass: Collection
|
|
124 |
"
|
|
125 |
|
|
126 |
"Created: / 05-05-2011 / 23:05:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
127 |
"Modified: / 23-05-2011 / 13:51:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
128 |
!
|
|
129 |
|
|
130 |
forClass: class selector: selector
|
|
131 |
|
|
132 |
^Bookmark::Method new className: class name selector: selector
|
|
133 |
|
|
134 |
"
|
|
135 |
Bookmark forMethod: Bookmark class >> #forMethod:
|
|
136 |
"
|
|
137 |
|
|
138 |
"Created: / 02-06-2011 / 23:21:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
139 |
!
|
|
140 |
|
|
141 |
forFile: aStringOrFilename
|
|
142 |
|
|
143 |
^Bookmark::File new path: aStringOrFilename asString
|
|
144 |
|
|
145 |
"
|
|
146 |
Bookmark forFile: '/etc/passwd'
|
|
147 |
"
|
|
148 |
|
|
149 |
"Created: / 20-06-2011 / 22:07:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
150 |
!
|
|
151 |
|
|
152 |
forFolderNamed: aString
|
|
153 |
|
|
154 |
^Bookmark::Folder new name: aString
|
|
155 |
|
|
156 |
"
|
|
157 |
Bookmark forClass: Collection
|
|
158 |
"
|
|
159 |
|
|
160 |
"Created: / 23-05-2011 / 10:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
161 |
!
|
|
162 |
|
|
163 |
forMethod: aMethod
|
|
164 |
|
|
165 |
^Bookmark::Method new className: aMethod mclass name selector: aMethod selector
|
|
166 |
|
|
167 |
"
|
|
168 |
Bookmark forMethod: Bookmark class >> #forMethod:
|
|
169 |
"
|
|
170 |
|
|
171 |
"Created: / 05-05-2011 / 23:05:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
172 |
"Modified: / 23-05-2011 / 13:49:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
173 |
!
|
|
174 |
|
|
175 |
forRecent
|
|
176 |
|
|
177 |
^Bookmark::Recent new
|
|
178 |
|
|
179 |
"
|
|
180 |
Bookmark forRecent
|
|
181 |
"
|
|
182 |
|
|
183 |
"Created: / 03-06-2011 / 10:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
184 |
!
|
|
185 |
|
|
186 |
forUrl: url label: label
|
|
187 |
|
|
188 |
^Bookmark::URL new url: url; label: label
|
|
189 |
|
|
190 |
"
|
|
191 |
Bookmark forClass: Collection
|
|
192 |
"
|
|
193 |
|
|
194 |
"Created: / 08-06-2011 / 12:44:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
195 |
!
|
|
196 |
|
|
197 |
separator
|
|
198 |
|
|
199 |
^Bookmark::Separator new
|
|
200 |
|
|
201 |
"
|
|
202 |
Bookmark forRecent
|
|
203 |
"
|
|
204 |
|
|
205 |
"Created: / 03-06-2011 / 13:39:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
206 |
! !
|
|
207 |
|
|
208 |
!Bookmark methodsFor:'accessing'!
|
|
209 |
|
|
210 |
/ label
|
|
211 |
|
|
212 |
self do:[:e|e label = label ifTrue:[^e]].
|
|
213 |
self error:'No child with label ''' , label , ''''.
|
|
214 |
|
|
215 |
"Created: / 21-06-2011 / 08:49:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
216 |
!
|
|
217 |
|
15340
|
218 |
flyByHelpText
|
|
219 |
^ nil
|
|
220 |
!
|
|
221 |
|
9975
|
222 |
icon
|
|
223 |
"superclass BookmarkEntry says that I am responsible to implement this method"
|
|
224 |
|
10866
|
225 |
icon isNil ifTrue:[ self initializeIcon ].
|
9975
|
226 |
^ icon
|
|
227 |
|
|
228 |
"Created: / 05-05-2011 / 22:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10866
|
229 |
"Modified: / 18-11-2011 / 14:30:44 / cg"
|
9975
|
230 |
!
|
|
231 |
|
|
232 |
label
|
|
233 |
"superclass BookmarkEntry says that I am responsible to implement this method"
|
|
234 |
|
10866
|
235 |
label isNil ifTrue:[ self initializeLabel ].
|
|
236 |
^label isNil
|
|
237 |
ifTrue:[ self defaultLabel ]
|
|
238 |
ifFalse: [ label ].
|
9975
|
239 |
|
|
240 |
"Created: / 05-05-2011 / 22:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
241 |
"Modified: / 02-06-2011 / 11:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10866
|
242 |
"Modified (format): / 18-11-2011 / 14:31:05 / cg"
|
9975
|
243 |
!
|
|
244 |
|
|
245 |
label: aStringOrText
|
|
246 |
|
|
247 |
label := aStringOrText.
|
|
248 |
self model changed: #label with: self
|
|
249 |
|
|
250 |
"Created: / 02-06-2011 / 23:13:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
251 |
"Modified: / 03-06-2011 / 10:46:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
252 |
! !
|
|
253 |
|
15228
|
254 |
!Bookmark methodsFor:'accessing-defaults'!
|
9975
|
255 |
|
|
256 |
defaultLabel
|
|
257 |
self subclassResponsibility
|
|
258 |
|
|
259 |
"Created: / 02-06-2011 / 11:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
260 |
! !
|
|
261 |
|
|
262 |
!Bookmark methodsFor:'basic adding & removing'!
|
|
263 |
|
|
264 |
basicAddAll:aList beforeIndex:anIndex
|
|
265 |
|
|
266 |
aList do:[:each|each parent: self].
|
|
267 |
^super basicAddAll:aList beforeIndex:anIndex
|
|
268 |
|
|
269 |
"Created: / 23-05-2011 / 14:10:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
270 |
!
|
|
271 |
|
|
272 |
basicRemoveFromIndex:startIndex toIndex:stopIndex
|
|
273 |
"remove the children from startIndex up to and including
|
|
274 |
the child under stopIndex."
|
|
275 |
|
|
276 |
|model notify
|
|
277 |
index "{ Class:SmallInteger }"
|
|
278 |
start "{ Class:SmallInteger }"
|
|
279 |
stop "{ Class:SmallInteger }"
|
|
280 |
size "{ Class:SmallInteger }"|
|
|
281 |
|
|
282 |
size := self children size.
|
|
283 |
stop := stopIndex.
|
|
284 |
start := startIndex.
|
|
285 |
(stop <= size and:[ start between:1 and:stop ])
|
|
286 |
ifFalse:[ ^ self subscriptBoundsError:index ].
|
|
287 |
start == 1
|
|
288 |
ifTrue:[ notify := self ]
|
|
289 |
ifFalse:
|
|
290 |
[ stop == size
|
|
291 |
ifTrue:[ notify := self at:(start - 1) ]
|
|
292 |
ifFalse:[ notify := nil ] ].
|
|
293 |
(model := self model) notNil
|
|
294 |
ifTrue:
|
|
295 |
[ index := model identityIndexOf:(children at:start).
|
|
296 |
size := stop - start + 1. ]
|
|
297 |
ifFalse:[ index := 0 ].
|
|
298 |
children
|
|
299 |
from:start
|
|
300 |
to:stop
|
|
301 |
do:
|
|
302 |
[:aChild |
|
|
303 |
index ~~ 0 ifTrue:[ size := size + aChild numberOfVisibleChildren ].
|
|
304 |
aChild parent:nil ].
|
|
305 |
children removeFromIndex:start toIndex:stop.
|
|
306 |
index ~~ 0
|
|
307 |
ifTrue:[ model itemRemoveFromIndex:index toIndex:(index + size - 1) ].
|
|
308 |
notify notNil ifTrue:[ notify changed ].
|
|
309 |
|
|
310 |
"Created: / 23-05-2011 / 16:21:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
311 |
! !
|
|
312 |
|
|
313 |
!Bookmark methodsFor:'change & update'!
|
|
314 |
|
|
315 |
changed: aspect with: param
|
|
316 |
|
|
317 |
| model |
|
|
318 |
|
|
319 |
super changed: aspect with: param.
|
|
320 |
(model := self model) notNil ifTrue:
|
|
321 |
[model changed: aspect with: param].
|
|
322 |
|
|
323 |
"Created: / 23-05-2011 / 16:22:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
324 |
! !
|
|
325 |
|
|
326 |
!Bookmark methodsFor:'converting'!
|
|
327 |
|
|
328 |
asMenu
|
|
329 |
|
10280
|
330 |
^self asMenuUsingBuilder: BookmarkToolbarMenuBuilder new
|
9975
|
331 |
|
|
332 |
"Created: / 23-05-2011 / 10:32:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
333 |
"Modified: / 21-06-2011 / 08:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10280
|
334 |
"Modified: / 08-07-2011 / 11:38:21 / cg"
|
9975
|
335 |
!
|
|
336 |
|
10280
|
337 |
asMenuUsingBuilder: builder
|
9975
|
338 |
|
10280
|
339 |
^builder buildMenuFor: self
|
9975
|
340 |
|
|
341 |
"Created: / 21-06-2011 / 08:04:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10280
|
342 |
"Modified (format): / 08-07-2011 / 11:37:19 / cg"
|
9975
|
343 |
! !
|
|
344 |
|
|
345 |
!Bookmark methodsFor:'encoding & decoding'!
|
|
346 |
|
|
347 |
skippedInLiteralEncoding
|
|
348 |
|
|
349 |
^#(parent isExpanded height width icon)
|
|
350 |
|
|
351 |
"Created: / 05-05-2011 / 23:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
352 |
"Modified: / 02-06-2011 / 22:56:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
353 |
! !
|
|
354 |
|
|
355 |
!Bookmark methodsFor:'navigation'!
|
|
356 |
|
|
357 |
switchToBookmarkIn: application
|
|
358 |
|
|
359 |
application switchToBookmarkEntry: application
|
|
360 |
|
|
361 |
"Created: / 05-05-2011 / 23:47:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
362 |
! !
|
|
363 |
|
|
364 |
!Bookmark methodsFor:'printing & storing'!
|
|
365 |
|
|
366 |
printOn:aStream
|
16785
|
367 |
"append a printed representation of the receiver to the argument, aStream"
|
9975
|
368 |
|
|
369 |
aStream nextPutAll:'BKM['.
|
|
370 |
self label printOn: aStream.
|
|
371 |
aStream nextPut: $]
|
|
372 |
|
|
373 |
"Modified: / 02-06-2011 / 11:08:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
374 |
! !
|
|
375 |
|
|
376 |
!Bookmark methodsFor:'private'!
|
|
377 |
|
|
378 |
initializeIcon
|
|
379 |
"Created: / 05-05-2011 / 22:57:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
380 |
!
|
|
381 |
|
|
382 |
initializeLabel
|
|
383 |
|
|
384 |
label := '--------'
|
|
385 |
|
|
386 |
"Created: / 05-05-2011 / 22:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
387 |
"Modified: / 03-06-2011 / 13:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
388 |
! !
|
|
389 |
|
|
390 |
!Bookmark methodsFor:'testing'!
|
|
391 |
|
|
392 |
isClassBookmark
|
|
393 |
|
|
394 |
^false
|
|
395 |
|
|
396 |
"Created: / 05-05-2011 / 23:44:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
397 |
!
|
|
398 |
|
|
399 |
isFileBookmark
|
|
400 |
|
|
401 |
^false
|
|
402 |
|
|
403 |
"Created: / 20-06-2011 / 23:40:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
404 |
!
|
|
405 |
|
|
406 |
isFolderBookmark
|
|
407 |
|
|
408 |
^false
|
|
409 |
|
|
410 |
"Created: / 23-05-2011 / 09:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
411 |
!
|
|
412 |
|
|
413 |
isMethodBookmark
|
|
414 |
|
|
415 |
^false
|
|
416 |
|
|
417 |
"Created: / 05-05-2011 / 23:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
418 |
!
|
|
419 |
|
|
420 |
isRecentBookmark
|
|
421 |
|
|
422 |
^false
|
|
423 |
|
|
424 |
"Created: / 03-06-2011 / 10:50:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
425 |
!
|
|
426 |
|
|
427 |
isURLBookmark
|
|
428 |
|
|
429 |
^false
|
|
430 |
|
|
431 |
"Created: / 20-06-2011 / 23:40:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
432 |
! !
|
|
433 |
|
|
434 |
!Bookmark::Class methodsFor:'accessing'!
|
|
435 |
|
|
436 |
className
|
|
437 |
|
|
438 |
^className
|
|
439 |
|
|
440 |
"Created: / 05-05-2011 / 23:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
441 |
"Modified: / 23-05-2011 / 13:36:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
442 |
!
|
|
443 |
|
10260
|
444 |
className: aString
|
|
445 |
|
9975
|
446 |
className := aString.
|
|
447 |
|
10260
|
448 |
(className endsWith: ' class') ifTrue:[
|
10827
|
449 |
className := className copyTo: (className size - 6)"/ ' class' size - 1
|
10260
|
450 |
].
|
|
451 |
|
|
452 |
className := className asSymbol.
|
|
453 |
|
10827
|
454 |
"Modified: / 18-10-2011 / 13:33:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
15340
|
455 |
!
|
|
456 |
|
|
457 |
flyByHelpText
|
|
458 |
^ 'Goto ',className
|
9975
|
459 |
! !
|
|
460 |
|
15228
|
461 |
!Bookmark::Class methodsFor:'accessing-defaults'!
|
9975
|
462 |
|
|
463 |
defaultLabel
|
|
464 |
"superclass Bookmark says that I am responsible to implement this method"
|
|
465 |
|
|
466 |
^ 'Some Class...'
|
|
467 |
|
|
468 |
"Modified: / 02-06-2011 / 11:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
469 |
! !
|
|
470 |
|
|
471 |
!Bookmark::Class methodsFor:'comparing'!
|
|
472 |
|
|
473 |
= another
|
|
474 |
|
|
475 |
^(self class = another class)
|
|
476 |
and:[className = another className]
|
|
477 |
|
|
478 |
"Created: / 05-05-2011 / 23:33:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
479 |
"Modified: / 23-05-2011 / 13:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
480 |
!
|
|
481 |
|
|
482 |
hash
|
|
483 |
|
|
484 |
^className hash bitXor: self class hash
|
|
485 |
|
|
486 |
"Created: / 05-05-2011 / 23:32:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
487 |
"Modified: / 23-05-2011 / 13:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
488 |
! !
|
|
489 |
|
|
490 |
!Bookmark::Class methodsFor:'navigation'!
|
|
491 |
|
|
492 |
switchToBookmarkIn: application
|
|
493 |
|
13869
|
494 |
application switchToClass: (Smalltalk at: className asSymbol) selector: nil updateHistory: true
|
9975
|
495 |
|
|
496 |
"Created: / 05-05-2011 / 23:49:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
13869
|
497 |
"Modified: / 06-04-2012 / 10:59:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
9975
|
498 |
! !
|
|
499 |
|
|
500 |
!Bookmark::Class methodsFor:'private'!
|
|
501 |
|
|
502 |
initializeIcon
|
|
503 |
|
|
504 |
| cls |
|
10260
|
505 |
cls := Smalltalk at: className asSymbol.
|
10910
|
506 |
cls notNil ifTrue:[icon := SystemBrowser iconForClass: cls].
|
9975
|
507 |
|
|
508 |
"Created: / 05-05-2011 / 23:01:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10260
|
509 |
"Modified: / 30-06-2011 / 19:10:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10910
|
510 |
"Modified: / 29-11-2011 / 11:20:52 / cg"
|
9975
|
511 |
!
|
|
512 |
|
|
513 |
initializeLabel
|
|
514 |
|
10866
|
515 |
className isNil ifTrue:[^self].
|
9975
|
516 |
|
|
517 |
label := className copyFrom: (className lastIndexOf: $:) + 1
|
|
518 |
|
|
519 |
"Created: / 05-05-2011 / 23:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
520 |
"Modified: / 02-06-2011 / 11:57:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10866
|
521 |
"Modified: / 18-11-2011 / 14:31:11 / cg"
|
9975
|
522 |
! !
|
|
523 |
|
|
524 |
!Bookmark::Class methodsFor:'testing'!
|
|
525 |
|
|
526 |
isClassBookmark
|
|
527 |
|
|
528 |
^true
|
|
529 |
|
|
530 |
"Created: / 05-05-2011 / 23:44:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
531 |
! !
|
|
532 |
|
|
533 |
!Bookmark::Class methodsFor:'visiting'!
|
|
534 |
|
|
535 |
acceptVisitor:aVisitor
|
|
536 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
537 |
the selector (visitor pattern)"
|
|
538 |
|
|
539 |
"stub code automatically generated - please change if required"
|
|
540 |
|
|
541 |
^ aVisitor visitClass:self
|
|
542 |
! !
|
|
543 |
|
|
544 |
!Bookmark::File methodsFor:'accessing'!
|
|
545 |
|
15340
|
546 |
flyByHelpText
|
|
547 |
^ 'Goto "', path , '"'
|
|
548 |
!
|
|
549 |
|
9975
|
550 |
initializeLabel
|
|
551 |
|
|
552 |
label := path asFilename baseName
|
|
553 |
|
|
554 |
"Created: / 20-06-2011 / 22:09:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
555 |
!
|
|
556 |
|
|
557 |
path
|
|
558 |
^ path
|
|
559 |
!
|
|
560 |
|
|
561 |
path:something
|
|
562 |
path := something.
|
|
563 |
! !
|
|
564 |
|
15228
|
565 |
!Bookmark::File methodsFor:'accessing-defaults'!
|
9975
|
566 |
|
|
567 |
defaultLabel
|
|
568 |
"superclass Bookmark says that I am responsible to implement this method"
|
|
569 |
|
|
570 |
^ 'Some file...'
|
|
571 |
|
|
572 |
"Modified: / 20-06-2011 / 22:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
573 |
! !
|
|
574 |
|
|
575 |
!Bookmark::File methodsFor:'testing'!
|
|
576 |
|
|
577 |
isFileBookmark
|
|
578 |
|
|
579 |
^true
|
|
580 |
|
|
581 |
"Created: / 20-06-2011 / 23:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
582 |
! !
|
|
583 |
|
|
584 |
!Bookmark::File methodsFor:'visiting'!
|
|
585 |
|
|
586 |
acceptVisitor:aVisitor
|
|
587 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
588 |
the selector (visitor pattern)"
|
|
589 |
|
|
590 |
"stub code automatically generated - please change if required"
|
|
591 |
|
|
592 |
^ aVisitor visitFile:self
|
|
593 |
! !
|
|
594 |
|
|
595 |
!Bookmark::Folder methodsFor:'accessing'!
|
|
596 |
|
|
597 |
initializeIcon
|
|
598 |
|
|
599 |
|
|
600 |
^ icon := ToolbarIconLibrary directoryOpen22x24Icon1
|
|
601 |
|
|
602 |
"Created: / 02-06-2011 / 12:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
603 |
!
|
|
604 |
|
|
605 |
initializeLabel
|
|
606 |
"superclass Bookmark says that I am responsible to implement this method"
|
|
607 |
|
|
608 |
^ label := self name
|
|
609 |
|
|
610 |
"Created: / 23-05-2011 / 14:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
611 |
"Modified: / 02-06-2011 / 11:52:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
612 |
!
|
|
613 |
|
|
614 |
label
|
|
615 |
|
|
616 |
^self name
|
|
617 |
|
|
618 |
"Created: / 02-06-2011 / 11:51:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
619 |
!
|
|
620 |
|
|
621 |
label: aString
|
|
622 |
|
|
623 |
self name: aString
|
|
624 |
|
|
625 |
"Created: / 03-06-2011 / 10:45:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
626 |
!
|
|
627 |
|
|
628 |
name
|
|
629 |
|
|
630 |
^name ? 'New Folder...'
|
|
631 |
|
|
632 |
"Created: / 23-05-2011 / 10:02:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
633 |
"Modified: / 02-06-2011 / 11:52:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
634 |
!
|
|
635 |
|
|
636 |
name: aString
|
|
637 |
|
|
638 |
name := aString.
|
|
639 |
self model changed: #label with: self
|
|
640 |
|
|
641 |
"Created: / 23-05-2011 / 10:02:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
642 |
"Modified: / 03-06-2011 / 10:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
643 |
! !
|
|
644 |
|
15228
|
645 |
!Bookmark::Folder methodsFor:'accessing-defaults'!
|
9975
|
646 |
|
|
647 |
defaultLabel
|
|
648 |
"superclass Bookmark says that I am responsible to implement this method"
|
|
649 |
|
|
650 |
^ 'New Folder...'
|
|
651 |
|
|
652 |
"Modified: / 02-06-2011 / 11:58:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
653 |
! !
|
|
654 |
|
|
655 |
!Bookmark::Folder methodsFor:'testing'!
|
|
656 |
|
|
657 |
isFolderBookmark
|
|
658 |
|
|
659 |
^true
|
|
660 |
|
|
661 |
"Created: / 23-05-2011 / 10:00:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
662 |
! !
|
|
663 |
|
|
664 |
!Bookmark::Folder methodsFor:'utilities'!
|
|
665 |
|
|
666 |
moveDown: child
|
|
667 |
|
|
668 |
| index |
|
|
669 |
index := children identityIndexOf: child.
|
|
670 |
index = children size ifTrue:[^self].
|
|
671 |
self removeIndex: index.
|
|
672 |
self add: child afterIndex: index.
|
|
673 |
|
|
674 |
"Created: / 02-06-2011 / 11:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
675 |
!
|
|
676 |
|
|
677 |
moveIn: child
|
|
678 |
|
|
679 |
| index folder |
|
|
680 |
index := children identityIndexOf: child.
|
|
681 |
index = children size ifTrue:[^self].
|
|
682 |
folder := children at: index + 1.
|
|
683 |
folder isFolderBookmark ifFalse:[^self].
|
|
684 |
self removeIndex: index.
|
|
685 |
folder addFirst: child
|
|
686 |
|
|
687 |
"Created: / 03-06-2011 / 10:30:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
688 |
!
|
|
689 |
|
|
690 |
moveOut: child
|
|
691 |
|
|
692 |
| index myindex |
|
10866
|
693 |
self parent isNil ifTrue:[^self].
|
9975
|
694 |
index := children identityIndexOf: child.
|
|
695 |
myindex := self parent children identityIndexOf: self.
|
|
696 |
self removeIndex: index.
|
|
697 |
self parent add: child afterIndex: myindex.
|
|
698 |
|
|
699 |
"Created: / 03-06-2011 / 10:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10866
|
700 |
"Modified: / 18-11-2011 / 14:31:15 / cg"
|
9975
|
701 |
!
|
|
702 |
|
|
703 |
moveUp: child
|
|
704 |
|
|
705 |
| index |
|
|
706 |
index := children identityIndexOf: child.
|
|
707 |
index = 1 ifTrue:[^self].
|
|
708 |
self removeIndex: index.
|
|
709 |
self add: child beforeIndex: index - 1.
|
|
710 |
|
|
711 |
"Created: / 02-06-2011 / 11:04:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
14181
|
712 |
!
|
|
713 |
|
|
714 |
sortChildrenAlphabetically
|
|
715 |
self sort:[:a :b | a label < b label].
|
9975
|
716 |
! !
|
|
717 |
|
|
718 |
!Bookmark::Folder methodsFor:'visiting'!
|
|
719 |
|
|
720 |
acceptVisitor:aVisitor
|
|
721 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
722 |
the selector (visitor pattern)"
|
|
723 |
|
|
724 |
"stub code automatically generated - please change if required"
|
|
725 |
|
|
726 |
^ aVisitor visitFolder:self
|
|
727 |
! !
|
|
728 |
|
|
729 |
!Bookmark::Method methodsFor:'accessing'!
|
|
730 |
|
|
731 |
className
|
|
732 |
|
|
733 |
^className
|
|
734 |
|
|
735 |
"Created: / 05-05-2011 / 23:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
736 |
"Modified: / 23-05-2011 / 13:36:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
737 |
!
|
|
738 |
|
|
739 |
className:aString
|
|
740 |
className := aString.
|
|
741 |
!
|
|
742 |
|
|
743 |
className:classNameArg selector:selectorArg
|
|
744 |
className := classNameArg.
|
|
745 |
selector := selectorArg.
|
|
746 |
!
|
|
747 |
|
15340
|
748 |
flyByHelpText
|
|
749 |
^ className,' >> ',selector
|
|
750 |
!
|
|
751 |
|
9975
|
752 |
selector
|
|
753 |
^ selector
|
|
754 |
|
|
755 |
!
|
|
756 |
|
|
757 |
selector: aSymbol
|
|
758 |
selector := aSymbol
|
|
759 |
|
|
760 |
! !
|
|
761 |
|
15228
|
762 |
!Bookmark::Method methodsFor:'accessing-defaults'!
|
9975
|
763 |
|
|
764 |
defaultLabel
|
|
765 |
"superclass Bookmark says that I am responsible to implement this method"
|
|
766 |
|
|
767 |
^ 'Some Method...'
|
|
768 |
|
|
769 |
"Modified: / 02-06-2011 / 11:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
770 |
! !
|
|
771 |
|
|
772 |
!Bookmark::Method methodsFor:'navigation'!
|
|
773 |
|
|
774 |
switchToBookmarkIn: application
|
|
775 |
|
|
776 |
application
|
10116
|
777 |
switchToClass: (Smalltalk classNamed: className)
|
9975
|
778 |
selector: selector
|
13869
|
779 |
updateHistory: true
|
9975
|
780 |
|
|
781 |
"Created: / 05-05-2011 / 23:49:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10116
|
782 |
"Modified: / 03-07-2011 / 23:11:03 / cg"
|
13869
|
783 |
"Modified: / 06-04-2012 / 10:59:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
9975
|
784 |
! !
|
|
785 |
|
|
786 |
!Bookmark::Method methodsFor:'private'!
|
|
787 |
|
|
788 |
initializeLabel
|
|
789 |
|
10866
|
790 |
className isNil ifTrue:[^self].
|
|
791 |
selector isNil ifTrue:[^self].
|
9975
|
792 |
|
|
793 |
label :=
|
16036
|
794 |
(className copyFrom: ((className lastIndexOf: $:) + 1)) allBold ,
|
16040
|
795 |
' » ' , (selector "asText allItalic")
|
9975
|
796 |
|
|
797 |
"Created: / 05-05-2011 / 23:04:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
798 |
"Modified: / 02-06-2011 / 22:00:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10866
|
799 |
"Modified: / 18-11-2011 / 14:31:19 / cg"
|
9975
|
800 |
! !
|
|
801 |
|
|
802 |
!Bookmark::Method methodsFor:'testing'!
|
|
803 |
|
|
804 |
isMethodBookmark
|
|
805 |
|
|
806 |
^true
|
|
807 |
|
|
808 |
"Created: / 05-05-2011 / 23:44:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
809 |
! !
|
|
810 |
|
|
811 |
!Bookmark::Method methodsFor:'visiting'!
|
|
812 |
|
|
813 |
acceptVisitor:aVisitor
|
|
814 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
815 |
the selector (visitor pattern)"
|
|
816 |
|
|
817 |
"stub code automatically generated - please change if required"
|
|
818 |
|
|
819 |
^ aVisitor visitMethod:self
|
|
820 |
! !
|
|
821 |
|
|
822 |
!Bookmark::Recent methodsFor:'accessing'!
|
|
823 |
|
|
824 |
limit
|
|
825 |
^ limit ? 15
|
|
826 |
|
|
827 |
"Modified: / 03-06-2011 / 10:51:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
828 |
!
|
|
829 |
|
|
830 |
limit:something
|
|
831 |
limit := something.
|
|
832 |
! !
|
|
833 |
|
|
834 |
!Bookmark::Recent methodsFor:'testing'!
|
|
835 |
|
|
836 |
isFolderBookmark
|
|
837 |
|
|
838 |
^false
|
|
839 |
|
|
840 |
"Created: / 03-06-2011 / 10:51:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
841 |
!
|
|
842 |
|
|
843 |
isRecentBookmark
|
|
844 |
|
|
845 |
^true
|
|
846 |
|
|
847 |
"Created: / 03-06-2011 / 10:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
848 |
! !
|
|
849 |
|
|
850 |
!Bookmark::Recent methodsFor:'visiting'!
|
|
851 |
|
|
852 |
acceptVisitor:aVisitor
|
|
853 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
854 |
the selector (visitor pattern)"
|
|
855 |
|
|
856 |
"stub code automatically generated - please change if required"
|
|
857 |
|
|
858 |
^ aVisitor visitRecent:self
|
|
859 |
! !
|
|
860 |
|
|
861 |
!Bookmark::Separator methodsFor:'visiting'!
|
|
862 |
|
|
863 |
acceptVisitor:aVisitor
|
|
864 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
865 |
the selector (visitor pattern)"
|
|
866 |
|
|
867 |
"stub code automatically generated - please change if required"
|
|
868 |
|
|
869 |
^ aVisitor visitSeparator:self
|
|
870 |
! !
|
|
871 |
|
|
872 |
!Bookmark::URL methodsFor:'accessing'!
|
|
873 |
|
15340
|
874 |
flyByHelpText
|
|
875 |
^ 'Goto "', url asString , '"'
|
|
876 |
!
|
|
877 |
|
9975
|
878 |
url
|
|
879 |
^ url
|
|
880 |
!
|
|
881 |
|
|
882 |
url:aString
|
|
883 |
url := aString.
|
|
884 |
! !
|
|
885 |
|
|
886 |
!Bookmark::URL methodsFor:'comparing'!
|
|
887 |
|
|
888 |
= another
|
|
889 |
|
|
890 |
^(self class = another class)
|
|
891 |
and:[label = another label
|
|
892 |
and:[url = another url]].
|
|
893 |
|
|
894 |
"Created: / 08-06-2011 / 15:11:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
895 |
!
|
|
896 |
|
|
897 |
hash
|
|
898 |
|
|
899 |
^label asString hash bitXor:[url hash].
|
|
900 |
|
|
901 |
"Created: / 08-06-2011 / 15:10:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
902 |
! !
|
|
903 |
|
|
904 |
!Bookmark::URL methodsFor:'testing'!
|
|
905 |
|
|
906 |
isURLBookmark
|
|
907 |
|
|
908 |
^true
|
|
909 |
|
|
910 |
"Created: / 20-06-2011 / 23:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
911 |
! !
|
|
912 |
|
|
913 |
!Bookmark::URL methodsFor:'visiting'!
|
|
914 |
|
|
915 |
acceptVisitor:aVisitor
|
|
916 |
"Double dispatch back to the visitor, passing my type encoded in
|
|
917 |
the selector (visitor pattern)"
|
|
918 |
|
|
919 |
"stub code automatically generated - please change if required"
|
|
920 |
|
|
921 |
^ aVisitor visitURL:self
|
|
922 |
|
|
923 |
"Modified: / 16-06-2011 / 16:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
924 |
! !
|
|
925 |
|
|
926 |
!Bookmark class methodsFor:'documentation'!
|
|
927 |
|
15228
|
928 |
version
|
16036
|
929 |
^ '$Header$'
|
15228
|
930 |
!
|
|
931 |
|
9975
|
932 |
version_CVS
|
16036
|
933 |
^ '$Header$'
|
9975
|
934 |
!
|
|
935 |
|
|
936 |
version_SVN
|
16036
|
937 |
^ '$Id$'
|
9975
|
938 |
! !
|
13869
|
939 |
|