author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 28 Aug 2013 12:52:38 +0100 | |
branch | jv |
changeset 13465 | 1f1e8b6710c8 |
parent 12431 | 9f0c59c742d5 |
child 15566 | 184cea584be5 |
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 |
||
12125 | 219 |
icon isNil ifTrue:[ self initializeIcon ]. |
9975 | 220 |
^ icon |
221 |
||
222 |
"Created: / 05-05-2011 / 22:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 223 |
"Modified: / 18-11-2011 / 14:30:44 / cg" |
9975 | 224 |
! |
225 |
||
226 |
label |
|
227 |
"superclass BookmarkEntry says that I am responsible to implement this method" |
|
228 |
||
12125 | 229 |
label isNil ifTrue:[ self initializeLabel ]. |
230 |
^label isNil |
|
231 |
ifTrue:[ self defaultLabel ] |
|
232 |
ifFalse: [ label ]. |
|
9975 | 233 |
|
234 |
"Created: / 05-05-2011 / 22:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
235 |
"Modified: / 02-06-2011 / 11:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 236 |
"Modified (format): / 18-11-2011 / 14:31:05 / cg" |
9975 | 237 |
! |
238 |
||
239 |
label: aStringOrText |
|
240 |
||
241 |
label := aStringOrText. |
|
242 |
self model changed: #label with: self |
|
243 |
||
244 |
"Created: / 02-06-2011 / 23:13:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
245 |
"Modified: / 03-06-2011 / 10:46:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
246 |
! ! |
|
247 |
||
248 |
!Bookmark methodsFor:'accessing defaults'! |
|
249 |
||
250 |
defaultLabel |
|
251 |
self subclassResponsibility |
|
252 |
||
253 |
"Created: / 02-06-2011 / 11:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
254 |
! ! |
|
255 |
||
256 |
!Bookmark methodsFor:'basic adding & removing'! |
|
257 |
||
258 |
basicAddAll:aList beforeIndex:anIndex |
|
259 |
||
260 |
aList do:[:each|each parent: self]. |
|
261 |
^super basicAddAll:aList beforeIndex:anIndex |
|
262 |
||
263 |
"Created: / 23-05-2011 / 14:10:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
264 |
! |
|
265 |
||
266 |
basicRemoveFromIndex:startIndex toIndex:stopIndex |
|
267 |
"remove the children from startIndex up to and including |
|
268 |
the child under stopIndex." |
|
269 |
||
270 |
|model notify |
|
271 |
index "{ Class:SmallInteger }" |
|
272 |
start "{ Class:SmallInteger }" |
|
273 |
stop "{ Class:SmallInteger }" |
|
274 |
size "{ Class:SmallInteger }"| |
|
275 |
||
276 |
size := self children size. |
|
277 |
stop := stopIndex. |
|
278 |
start := startIndex. |
|
279 |
(stop <= size and:[ start between:1 and:stop ]) |
|
280 |
ifFalse:[ ^ self subscriptBoundsError:index ]. |
|
281 |
start == 1 |
|
282 |
ifTrue:[ notify := self ] |
|
283 |
ifFalse: |
|
284 |
[ stop == size |
|
285 |
ifTrue:[ notify := self at:(start - 1) ] |
|
286 |
ifFalse:[ notify := nil ] ]. |
|
287 |
(model := self model) notNil |
|
288 |
ifTrue: |
|
289 |
[ index := model identityIndexOf:(children at:start). |
|
290 |
size := stop - start + 1. ] |
|
291 |
ifFalse:[ index := 0 ]. |
|
292 |
children |
|
293 |
from:start |
|
294 |
to:stop |
|
295 |
do: |
|
296 |
[:aChild | |
|
297 |
index ~~ 0 ifTrue:[ size := size + aChild numberOfVisibleChildren ]. |
|
298 |
aChild parent:nil ]. |
|
299 |
children removeFromIndex:start toIndex:stop. |
|
300 |
index ~~ 0 |
|
301 |
ifTrue:[ model itemRemoveFromIndex:index toIndex:(index + size - 1) ]. |
|
302 |
notify notNil ifTrue:[ notify changed ]. |
|
303 |
||
304 |
"Created: / 23-05-2011 / 16:21:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 |
! ! |
|
306 |
||
307 |
!Bookmark methodsFor:'change & update'! |
|
308 |
||
309 |
changed: aspect with: param |
|
310 |
||
311 |
| model | |
|
312 |
||
313 |
super changed: aspect with: param. |
|
314 |
(model := self model) notNil ifTrue: |
|
315 |
[model changed: aspect with: param]. |
|
316 |
||
317 |
"Created: / 23-05-2011 / 16:22:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
318 |
! ! |
|
319 |
||
320 |
!Bookmark methodsFor:'converting'! |
|
321 |
||
322 |
asMenu |
|
323 |
||
10280 | 324 |
^self asMenuUsingBuilder: BookmarkToolbarMenuBuilder new |
9975 | 325 |
|
326 |
"Created: / 23-05-2011 / 10:32:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
327 |
"Modified: / 21-06-2011 / 08:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10280 | 328 |
"Modified: / 08-07-2011 / 11:38:21 / cg" |
9975 | 329 |
! |
330 |
||
10280 | 331 |
asMenuUsingBuilder: builder |
9975 | 332 |
|
10280 | 333 |
^builder buildMenuFor: self |
9975 | 334 |
|
335 |
"Created: / 21-06-2011 / 08:04:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10280 | 336 |
"Modified (format): / 08-07-2011 / 11:37:19 / cg" |
9975 | 337 |
! ! |
338 |
||
339 |
!Bookmark methodsFor:'encoding & decoding'! |
|
340 |
||
341 |
skippedInLiteralEncoding |
|
342 |
||
343 |
^#(parent isExpanded height width icon) |
|
344 |
||
345 |
"Created: / 05-05-2011 / 23:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
346 |
"Modified: / 02-06-2011 / 22:56:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
347 |
! ! |
|
348 |
||
349 |
!Bookmark methodsFor:'navigation'! |
|
350 |
||
351 |
switchToBookmarkIn: application |
|
352 |
||
353 |
application switchToBookmarkEntry: application |
|
354 |
||
355 |
"Created: / 05-05-2011 / 23:47:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
356 |
! ! |
|
357 |
||
358 |
!Bookmark methodsFor:'printing & storing'! |
|
359 |
||
360 |
printOn:aStream |
|
361 |
"append a printed representation if the receiver to the argument, aStream" |
|
362 |
||
363 |
aStream nextPutAll:'BKM['. |
|
364 |
self label printOn: aStream. |
|
365 |
aStream nextPut: $] |
|
366 |
||
367 |
"Modified: / 02-06-2011 / 11:08:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
368 |
! ! |
|
369 |
||
370 |
!Bookmark methodsFor:'private'! |
|
371 |
||
372 |
initializeIcon |
|
373 |
"Created: / 05-05-2011 / 22:57:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
374 |
! |
|
375 |
||
376 |
initializeLabel |
|
377 |
||
378 |
label := '--------' |
|
379 |
||
380 |
"Created: / 05-05-2011 / 22:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
381 |
"Modified: / 03-06-2011 / 13:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
382 |
! ! |
|
383 |
||
384 |
!Bookmark methodsFor:'testing'! |
|
385 |
||
386 |
isClassBookmark |
|
387 |
||
388 |
^false |
|
389 |
||
390 |
"Created: / 05-05-2011 / 23:44:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
391 |
! |
|
392 |
||
393 |
isFileBookmark |
|
394 |
||
395 |
^false |
|
396 |
||
397 |
"Created: / 20-06-2011 / 23:40:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
398 |
! |
|
399 |
||
400 |
isFolderBookmark |
|
401 |
||
402 |
^false |
|
403 |
||
404 |
"Created: / 23-05-2011 / 09:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
405 |
! |
|
406 |
||
407 |
isMethodBookmark |
|
408 |
||
409 |
^false |
|
410 |
||
411 |
"Created: / 05-05-2011 / 23:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
412 |
! |
|
413 |
||
414 |
isRecentBookmark |
|
415 |
||
416 |
^false |
|
417 |
||
418 |
"Created: / 03-06-2011 / 10:50:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
419 |
! |
|
420 |
||
421 |
isURLBookmark |
|
422 |
||
423 |
^false |
|
424 |
||
425 |
"Created: / 20-06-2011 / 23:40:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
426 |
! ! |
|
427 |
||
428 |
!Bookmark::Class methodsFor:'accessing'! |
|
429 |
||
430 |
className |
|
431 |
||
432 |
^className |
|
433 |
||
434 |
"Created: / 05-05-2011 / 23:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
435 |
"Modified: / 23-05-2011 / 13:36:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
436 |
! |
|
437 |
||
10260 | 438 |
className: aString |
439 |
||
9975 | 440 |
className := aString. |
441 |
||
10260 | 442 |
(className endsWith: ' class') ifTrue:[ |
12125 | 443 |
className := className copyTo: (className size - 6)"/ ' class' size - 1 |
10260 | 444 |
]. |
445 |
||
446 |
className := className asSymbol. |
|
447 |
||
12125 | 448 |
"Modified: / 18-10-2011 / 13:33:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9975 | 449 |
! ! |
450 |
||
451 |
!Bookmark::Class methodsFor:'accessing defaults'! |
|
452 |
||
453 |
defaultLabel |
|
454 |
"superclass Bookmark says that I am responsible to implement this method" |
|
455 |
||
456 |
^ 'Some Class...' |
|
457 |
||
458 |
"Modified: / 02-06-2011 / 11:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
459 |
! ! |
|
460 |
||
461 |
!Bookmark::Class methodsFor:'comparing'! |
|
462 |
||
463 |
= another |
|
464 |
||
465 |
^(self class = another class) |
|
466 |
and:[className = another className] |
|
467 |
||
468 |
"Created: / 05-05-2011 / 23:33:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
469 |
"Modified: / 23-05-2011 / 13:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
470 |
! |
|
471 |
||
472 |
hash |
|
473 |
||
474 |
^className hash bitXor: self class hash |
|
475 |
||
476 |
"Created: / 05-05-2011 / 23:32:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
477 |
"Modified: / 23-05-2011 / 13:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
478 |
! ! |
|
479 |
||
480 |
!Bookmark::Class methodsFor:'navigation'! |
|
481 |
||
482 |
switchToBookmarkIn: application |
|
483 |
||
12225 | 484 |
application switchToClass: (Smalltalk at: className asSymbol) selector: nil updateHistory: true |
9975 | 485 |
|
486 |
"Created: / 05-05-2011 / 23:49:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12225 | 487 |
"Modified: / 06-04-2012 / 10:59:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9975 | 488 |
! ! |
489 |
||
490 |
!Bookmark::Class methodsFor:'private'! |
|
491 |
||
492 |
initializeIcon |
|
493 |
||
494 |
| cls | |
|
10260 | 495 |
cls := Smalltalk at: className asSymbol. |
12125 | 496 |
cls notNil ifTrue:[icon := SystemBrowser iconForClass: cls]. |
9975 | 497 |
|
498 |
"Created: / 05-05-2011 / 23:01:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10260 | 499 |
"Modified: / 30-06-2011 / 19:10:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12125 | 500 |
"Modified: / 29-11-2011 / 11:20:52 / cg" |
9975 | 501 |
! |
502 |
||
503 |
initializeLabel |
|
504 |
||
12125 | 505 |
className isNil ifTrue:[^self]. |
9975 | 506 |
|
507 |
label := className copyFrom: (className lastIndexOf: $:) + 1 |
|
508 |
||
509 |
"Created: / 05-05-2011 / 23:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
510 |
"Modified: / 02-06-2011 / 11:57:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 511 |
"Modified: / 18-11-2011 / 14:31:11 / cg" |
9975 | 512 |
! ! |
513 |
||
514 |
!Bookmark::Class methodsFor:'testing'! |
|
515 |
||
516 |
isClassBookmark |
|
517 |
||
518 |
^true |
|
519 |
||
520 |
"Created: / 05-05-2011 / 23:44:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
521 |
! ! |
|
522 |
||
523 |
!Bookmark::Class methodsFor:'visiting'! |
|
524 |
||
525 |
acceptVisitor:aVisitor |
|
526 |
"Double dispatch back to the visitor, passing my type encoded in |
|
527 |
the selector (visitor pattern)" |
|
528 |
||
529 |
"stub code automatically generated - please change if required" |
|
530 |
||
531 |
^ aVisitor visitClass:self |
|
532 |
! ! |
|
533 |
||
534 |
!Bookmark::File methodsFor:'accessing'! |
|
535 |
||
536 |
initializeLabel |
|
537 |
||
538 |
label := path asFilename baseName |
|
539 |
||
540 |
"Created: / 20-06-2011 / 22:09:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
541 |
! |
|
542 |
||
543 |
path |
|
544 |
^ path |
|
545 |
! |
|
546 |
||
547 |
path:something |
|
548 |
path := something. |
|
549 |
! ! |
|
550 |
||
551 |
!Bookmark::File methodsFor:'accessing defaults'! |
|
552 |
||
553 |
defaultLabel |
|
554 |
"superclass Bookmark says that I am responsible to implement this method" |
|
555 |
||
556 |
^ 'Some file...' |
|
557 |
||
558 |
"Modified: / 20-06-2011 / 22:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
559 |
! ! |
|
560 |
||
561 |
!Bookmark::File methodsFor:'testing'! |
|
562 |
||
563 |
isFileBookmark |
|
564 |
||
565 |
^true |
|
566 |
||
567 |
"Created: / 20-06-2011 / 23:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
568 |
! ! |
|
569 |
||
570 |
!Bookmark::File methodsFor:'visiting'! |
|
571 |
||
572 |
acceptVisitor:aVisitor |
|
573 |
"Double dispatch back to the visitor, passing my type encoded in |
|
574 |
the selector (visitor pattern)" |
|
575 |
||
576 |
"stub code automatically generated - please change if required" |
|
577 |
||
578 |
^ aVisitor visitFile:self |
|
579 |
! ! |
|
580 |
||
581 |
!Bookmark::Folder methodsFor:'accessing'! |
|
582 |
||
583 |
initializeIcon |
|
584 |
||
585 |
||
586 |
^ icon := ToolbarIconLibrary directoryOpen22x24Icon1 |
|
587 |
||
588 |
"Created: / 02-06-2011 / 12:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
589 |
! |
|
590 |
||
591 |
initializeLabel |
|
592 |
"superclass Bookmark says that I am responsible to implement this method" |
|
593 |
||
594 |
^ label := self name |
|
595 |
||
596 |
"Created: / 23-05-2011 / 14:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
597 |
"Modified: / 02-06-2011 / 11:52:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
598 |
! |
|
599 |
||
600 |
label |
|
601 |
||
602 |
^self name |
|
603 |
||
604 |
"Created: / 02-06-2011 / 11:51:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
605 |
! |
|
606 |
||
607 |
label: aString |
|
608 |
||
609 |
self name: aString |
|
610 |
||
611 |
"Created: / 03-06-2011 / 10:45:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
612 |
! |
|
613 |
||
614 |
name |
|
615 |
||
616 |
^name ? 'New Folder...' |
|
617 |
||
618 |
"Created: / 23-05-2011 / 10:02:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
619 |
"Modified: / 02-06-2011 / 11:52:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
620 |
! |
|
621 |
||
622 |
name: aString |
|
623 |
||
624 |
name := aString. |
|
625 |
self model changed: #label with: self |
|
626 |
||
627 |
"Created: / 23-05-2011 / 10:02:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
628 |
"Modified: / 03-06-2011 / 10:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
629 |
! ! |
|
630 |
||
631 |
!Bookmark::Folder methodsFor:'accessing defaults'! |
|
632 |
||
633 |
defaultLabel |
|
634 |
"superclass Bookmark says that I am responsible to implement this method" |
|
635 |
||
636 |
^ 'New Folder...' |
|
637 |
||
638 |
"Modified: / 02-06-2011 / 11:58:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
639 |
! ! |
|
640 |
||
641 |
!Bookmark::Folder methodsFor:'testing'! |
|
642 |
||
643 |
isFolderBookmark |
|
644 |
||
645 |
^true |
|
646 |
||
647 |
"Created: / 23-05-2011 / 10:00:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
648 |
! ! |
|
649 |
||
650 |
!Bookmark::Folder methodsFor:'utilities'! |
|
651 |
||
652 |
moveDown: child |
|
653 |
||
654 |
| index | |
|
655 |
index := children identityIndexOf: child. |
|
656 |
index = children size ifTrue:[^self]. |
|
657 |
self removeIndex: index. |
|
658 |
self add: child afterIndex: index. |
|
659 |
||
660 |
"Created: / 02-06-2011 / 11:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
661 |
! |
|
662 |
||
663 |
moveIn: child |
|
664 |
||
665 |
| index folder | |
|
666 |
index := children identityIndexOf: child. |
|
667 |
index = children size ifTrue:[^self]. |
|
668 |
folder := children at: index + 1. |
|
669 |
folder isFolderBookmark ifFalse:[^self]. |
|
670 |
self removeIndex: index. |
|
671 |
folder addFirst: child |
|
672 |
||
673 |
"Created: / 03-06-2011 / 10:30:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
674 |
! |
|
675 |
||
676 |
moveOut: child |
|
677 |
||
678 |
| index myindex | |
|
12125 | 679 |
self parent isNil ifTrue:[^self]. |
9975 | 680 |
index := children identityIndexOf: child. |
681 |
myindex := self parent children identityIndexOf: self. |
|
682 |
self removeIndex: index. |
|
683 |
self parent add: child afterIndex: myindex. |
|
684 |
||
685 |
"Created: / 03-06-2011 / 10:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 686 |
"Modified: / 18-11-2011 / 14:31:15 / cg" |
9975 | 687 |
! |
688 |
||
689 |
moveUp: child |
|
690 |
||
691 |
| index | |
|
692 |
index := children identityIndexOf: child. |
|
693 |
index = 1 ifTrue:[^self]. |
|
694 |
self removeIndex: index. |
|
695 |
self add: child beforeIndex: index - 1. |
|
696 |
||
697 |
"Created: / 02-06-2011 / 11:04:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
698 |
! ! |
|
699 |
||
700 |
!Bookmark::Folder methodsFor:'visiting'! |
|
701 |
||
702 |
acceptVisitor:aVisitor |
|
703 |
"Double dispatch back to the visitor, passing my type encoded in |
|
704 |
the selector (visitor pattern)" |
|
705 |
||
706 |
"stub code automatically generated - please change if required" |
|
707 |
||
708 |
^ aVisitor visitFolder:self |
|
709 |
! ! |
|
710 |
||
711 |
!Bookmark::Method methodsFor:'accessing'! |
|
712 |
||
713 |
className |
|
714 |
||
715 |
^className |
|
716 |
||
717 |
"Created: / 05-05-2011 / 23:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
718 |
"Modified: / 23-05-2011 / 13:36:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
719 |
! |
|
720 |
||
721 |
className:aString |
|
722 |
className := aString. |
|
723 |
! |
|
724 |
||
725 |
className:classNameArg selector:selectorArg |
|
726 |
className := classNameArg. |
|
727 |
selector := selectorArg. |
|
728 |
! |
|
729 |
||
730 |
selector |
|
731 |
^ selector |
|
732 |
||
733 |
! |
|
734 |
||
735 |
selector: aSymbol |
|
736 |
selector := aSymbol |
|
737 |
||
738 |
! ! |
|
739 |
||
740 |
!Bookmark::Method methodsFor:'accessing defaults'! |
|
741 |
||
742 |
defaultLabel |
|
743 |
"superclass Bookmark says that I am responsible to implement this method" |
|
744 |
||
745 |
^ 'Some Method...' |
|
746 |
||
747 |
"Modified: / 02-06-2011 / 11:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
748 |
! ! |
|
749 |
||
750 |
!Bookmark::Method methodsFor:'navigation'! |
|
751 |
||
752 |
switchToBookmarkIn: application |
|
753 |
||
754 |
application |
|
10116 | 755 |
switchToClass: (Smalltalk classNamed: className) |
9975 | 756 |
selector: selector |
12225 | 757 |
updateHistory: true |
9975 | 758 |
|
759 |
"Created: / 05-05-2011 / 23:49:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10116 | 760 |
"Modified: / 03-07-2011 / 23:11:03 / cg" |
12225 | 761 |
"Modified: / 06-04-2012 / 10:59:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9975 | 762 |
! ! |
763 |
||
764 |
!Bookmark::Method methodsFor:'private'! |
|
765 |
||
766 |
initializeLabel |
|
767 |
||
12125 | 768 |
className isNil ifTrue:[^self]. |
769 |
selector isNil ifTrue:[^self]. |
|
9975 | 770 |
|
771 |
label := |
|
772 |
(className copyFrom: ((className lastIndexOf: $:) + 1)) asText allBold , |
|
773 |
' >> ' , (selector asText "allItalic") |
|
774 |
||
775 |
"Created: / 05-05-2011 / 23:04:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
776 |
"Modified: / 02-06-2011 / 22:00:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 777 |
"Modified: / 18-11-2011 / 14:31:19 / cg" |
9975 | 778 |
! ! |
779 |
||
780 |
!Bookmark::Method methodsFor:'testing'! |
|
781 |
||
782 |
isMethodBookmark |
|
783 |
||
784 |
^true |
|
785 |
||
786 |
"Created: / 05-05-2011 / 23:44:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
787 |
! ! |
|
788 |
||
789 |
!Bookmark::Method methodsFor:'visiting'! |
|
790 |
||
791 |
acceptVisitor:aVisitor |
|
792 |
"Double dispatch back to the visitor, passing my type encoded in |
|
793 |
the selector (visitor pattern)" |
|
794 |
||
795 |
"stub code automatically generated - please change if required" |
|
796 |
||
797 |
^ aVisitor visitMethod:self |
|
798 |
! ! |
|
799 |
||
800 |
!Bookmark::Recent methodsFor:'accessing'! |
|
801 |
||
802 |
limit |
|
803 |
^ limit ? 15 |
|
804 |
||
805 |
"Modified: / 03-06-2011 / 10:51:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
806 |
! |
|
807 |
||
808 |
limit:something |
|
809 |
limit := something. |
|
810 |
! ! |
|
811 |
||
812 |
!Bookmark::Recent methodsFor:'testing'! |
|
813 |
||
814 |
isFolderBookmark |
|
815 |
||
816 |
^false |
|
817 |
||
818 |
"Created: / 03-06-2011 / 10:51:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
819 |
! |
|
820 |
||
821 |
isRecentBookmark |
|
822 |
||
823 |
^true |
|
824 |
||
825 |
"Created: / 03-06-2011 / 10:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
826 |
! ! |
|
827 |
||
828 |
!Bookmark::Recent methodsFor:'visiting'! |
|
829 |
||
830 |
acceptVisitor:aVisitor |
|
831 |
"Double dispatch back to the visitor, passing my type encoded in |
|
832 |
the selector (visitor pattern)" |
|
833 |
||
834 |
"stub code automatically generated - please change if required" |
|
835 |
||
836 |
^ aVisitor visitRecent:self |
|
837 |
! ! |
|
838 |
||
839 |
!Bookmark::Separator methodsFor:'visiting'! |
|
840 |
||
841 |
acceptVisitor:aVisitor |
|
842 |
"Double dispatch back to the visitor, passing my type encoded in |
|
843 |
the selector (visitor pattern)" |
|
844 |
||
845 |
"stub code automatically generated - please change if required" |
|
846 |
||
847 |
^ aVisitor visitSeparator:self |
|
848 |
! ! |
|
849 |
||
850 |
!Bookmark::URL methodsFor:'accessing'! |
|
851 |
||
852 |
url |
|
853 |
^ url |
|
854 |
! |
|
855 |
||
856 |
url:aString |
|
857 |
url := aString. |
|
858 |
! ! |
|
859 |
||
860 |
!Bookmark::URL methodsFor:'comparing'! |
|
861 |
||
862 |
= another |
|
863 |
||
864 |
^(self class = another class) |
|
865 |
and:[label = another label |
|
866 |
and:[url = another url]]. |
|
867 |
||
868 |
"Created: / 08-06-2011 / 15:11:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
869 |
! |
|
870 |
||
871 |
hash |
|
872 |
||
873 |
^label asString hash bitXor:[url hash]. |
|
874 |
||
875 |
"Created: / 08-06-2011 / 15:10:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
876 |
! ! |
|
877 |
||
878 |
!Bookmark::URL methodsFor:'testing'! |
|
879 |
||
880 |
isURLBookmark |
|
881 |
||
882 |
^true |
|
883 |
||
884 |
"Created: / 20-06-2011 / 23:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
885 |
! ! |
|
886 |
||
887 |
!Bookmark::URL methodsFor:'visiting'! |
|
888 |
||
889 |
acceptVisitor:aVisitor |
|
890 |
"Double dispatch back to the visitor, passing my type encoded in |
|
891 |
the selector (visitor pattern)" |
|
892 |
||
893 |
"stub code automatically generated - please change if required" |
|
894 |
||
895 |
^ aVisitor visitURL:self |
|
896 |
||
897 |
"Modified: / 16-06-2011 / 16:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
898 |
! ! |
|
899 |
||
900 |
!Bookmark class methodsFor:'documentation'! |
|
901 |
||
902 |
version_CVS |
|
12125 | 903 |
^ '§Header: /cvs/stx/stx/libtool/Bookmark.st,v 1.8 2011/11/29 10:20:58 cg Exp §' |
9975 | 904 |
! |
905 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12225
diff
changeset
|
906 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12225
diff
changeset
|
907 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12225
diff
changeset
|
908 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12225
diff
changeset
|
909 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12225
diff
changeset
|
910 |
|
9975 | 911 |
version_SVN |
12225 | 912 |
^ '$Id: Bookmark.st 7973 2012-04-06 15:56:16Z vranyj1 $' |
12125 | 913 |
! ! |
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12225
diff
changeset
|
914 |