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