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