9971
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libtool' }"
|
|
13 |
|
|
14 |
ApplicationModel subclass:#BookmarkListEditor
|
|
15 |
instanceVariableNames:'selectionHolder bookmarkListHolder'
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Interface-Bookmarks'
|
|
19 |
!
|
|
20 |
|
|
21 |
!BookmarkListEditor class methodsFor:'documentation'!
|
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
! !
|
|
36 |
|
|
37 |
!BookmarkListEditor class methodsFor:'interface specs'!
|
|
38 |
|
|
39 |
windowSpec
|
|
40 |
"This resource specification was automatically generated
|
|
41 |
by the UIPainter of ST/X."
|
|
42 |
|
|
43 |
"Do not manually edit this!! If it is corrupted,
|
|
44 |
the UIPainter may not be able to read the specification."
|
|
45 |
|
|
46 |
"
|
|
47 |
UIPainter new openOnClass:BookmarkListEditor andSelector:#windowSpec
|
|
48 |
BookmarkListEditor new openInterface:#windowSpec
|
|
49 |
BookmarkListEditor open
|
|
50 |
"
|
|
51 |
|
|
52 |
<resource: #canvas>
|
|
53 |
|
|
54 |
^
|
|
55 |
#(FullSpec
|
|
56 |
name: windowSpec
|
|
57 |
window:
|
|
58 |
(WindowSpec
|
|
59 |
label: 'Bookmark Editor'
|
|
60 |
name: 'Bookmark Editor'
|
|
61 |
min: (Point 10 10)
|
|
62 |
bounds: (Rectangle 0 0 509 430)
|
|
63 |
)
|
|
64 |
component:
|
|
65 |
(SpecCollection
|
|
66 |
collection: (
|
|
67 |
(MenuPanelSpec
|
|
68 |
name: 'ToolBar'
|
|
69 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0)
|
|
70 |
menu: toolbarMenu
|
|
71 |
textDefault: true
|
|
72 |
)
|
|
73 |
(VariableHorizontalPanelSpec
|
|
74 |
name: 'Panel'
|
|
75 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1)
|
|
76 |
component:
|
|
77 |
(SpecCollection
|
|
78 |
collection: (
|
|
79 |
(HierarchicalListViewSpec
|
|
80 |
name: 'BookmarkList'
|
|
81 |
model: selectionHolder
|
|
82 |
menu: contextMenu
|
|
83 |
hasHorizontalScrollBar: true
|
|
84 |
hasVerticalScrollBar: true
|
|
85 |
listModel: bookmarkListHolder
|
|
86 |
useIndex: false
|
|
87 |
highlightMode: line
|
|
88 |
doubleClickSelector: menuRename
|
|
89 |
useDefaultIcons: false
|
|
90 |
)
|
|
91 |
)
|
|
92 |
|
|
93 |
)
|
|
94 |
handles: (Any 1.0)
|
|
95 |
)
|
|
96 |
)
|
|
97 |
|
|
98 |
)
|
|
99 |
)
|
|
100 |
! !
|
|
101 |
|
|
102 |
!BookmarkListEditor class methodsFor:'menu specs'!
|
|
103 |
|
|
104 |
contextMenu
|
|
105 |
"This resource specification was automatically generated
|
|
106 |
by the MenuEditor of ST/X."
|
|
107 |
|
|
108 |
"Do not manually edit this!! If it is corrupted,
|
|
109 |
the MenuEditor may not be able to read the specification."
|
|
110 |
|
|
111 |
"
|
|
112 |
MenuEditor new openOnClass:BookmarkListEditor andSelector:#contextMenu
|
|
113 |
(Menu new fromLiteralArrayEncoding:(BookmarkListEditor contextMenu)) startUp
|
|
114 |
"
|
|
115 |
|
|
116 |
<resource: #menu>
|
|
117 |
|
|
118 |
^
|
|
119 |
#(Menu
|
|
120 |
(
|
|
121 |
(MenuItem
|
|
122 |
label: 'New...'
|
|
123 |
itemValue: menuNewFolder
|
|
124 |
translateLabel: true
|
|
125 |
submenuChannel: newMenu
|
|
126 |
labelImage: (ResourceRetriever ToolbarIconLibrary newDirectory22x22Icon 'New...')
|
|
127 |
)
|
|
128 |
(MenuItem
|
|
129 |
label: 'Rename'
|
|
130 |
itemValue: menuRename
|
|
131 |
translateLabel: true
|
|
132 |
shortcutKey: Rename
|
|
133 |
)
|
|
134 |
(MenuItem
|
|
135 |
enabled: hasSelectionHolder
|
|
136 |
label: 'Remove'
|
|
137 |
itemValue: menuRemove
|
|
138 |
translateLabel: true
|
|
139 |
labelImage: (ResourceRetriever ToolbarIconLibrary deleteIcon 'Remove')
|
|
140 |
)
|
|
141 |
(MenuItem
|
|
142 |
label: '-'
|
|
143 |
)
|
|
144 |
(MenuItem
|
|
145 |
enabled: hasSelectionHolder
|
|
146 |
label: 'Move Up'
|
|
147 |
itemValue: menuMoveUp
|
|
148 |
translateLabel: true
|
|
149 |
isButton: true
|
|
150 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetUpIcon 'Move Up')
|
|
151 |
)
|
|
152 |
(MenuItem
|
|
153 |
enabled: hasSelectionHolder
|
|
154 |
label: 'Move Down'
|
|
155 |
itemValue: menuMoveDown
|
|
156 |
translateLabel: true
|
|
157 |
isButton: true
|
|
158 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownIcon 'Move Down')
|
|
159 |
)
|
|
160 |
(MenuItem
|
|
161 |
enabled: hasSelectionHolder
|
|
162 |
label: 'Move In'
|
|
163 |
itemValue: menuMoveIn
|
|
164 |
translateLabel: true
|
|
165 |
isButton: true
|
|
166 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownRightIcon 'Move In')
|
|
167 |
)
|
|
168 |
(MenuItem
|
|
169 |
enabled: hasSelectionHolder
|
|
170 |
label: 'Move Out'
|
|
171 |
itemValue: menuMoveOut
|
|
172 |
translateLabel: true
|
|
173 |
isButton: true
|
|
174 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetLeftDownIcon 'Move Out')
|
|
175 |
)
|
|
176 |
)
|
|
177 |
nil
|
|
178 |
nil
|
|
179 |
)
|
|
180 |
!
|
|
181 |
|
|
182 |
newMenu
|
|
183 |
"This resource specification was automatically generated
|
|
184 |
by the MenuEditor of ST/X."
|
|
185 |
|
|
186 |
"Do not manually edit this!! If it is corrupted,
|
|
187 |
the MenuEditor may not be able to read the specification."
|
|
188 |
|
|
189 |
"
|
|
190 |
MenuEditor new openOnClass:BookmarkListEditor andSelector:#newMenu
|
|
191 |
(Menu new fromLiteralArrayEncoding:(BookmarkListEditor newMenu)) startUp
|
|
192 |
"
|
|
193 |
|
|
194 |
<resource: #menu>
|
|
195 |
|
|
196 |
^
|
|
197 |
#(Menu
|
|
198 |
(
|
|
199 |
(MenuItem
|
|
200 |
label: 'New Folder'
|
|
201 |
itemValue: menuNew:
|
|
202 |
translateLabel: true
|
|
203 |
labelImage: (ResourceRetriever ToolbarIconLibrary newDirectory22x22Icon 'New Folder')
|
|
204 |
argument: #'Bookmark::Folder'
|
|
205 |
)
|
|
206 |
(MenuItem
|
|
207 |
label: 'New Separator'
|
|
208 |
itemValue: menuNew:
|
|
209 |
translateLabel: true
|
|
210 |
argument: #'Bookmark::Separator'
|
|
211 |
)
|
|
212 |
)
|
|
213 |
nil
|
|
214 |
nil
|
|
215 |
)
|
|
216 |
!
|
|
217 |
|
|
218 |
toolbarMenu
|
|
219 |
"This resource specification was automatically generated
|
|
220 |
by the MenuEditor of ST/X."
|
|
221 |
|
|
222 |
"Do not manually edit this!! If it is corrupted,
|
|
223 |
the MenuEditor may not be able to read the specification."
|
|
224 |
|
|
225 |
"
|
|
226 |
MenuEditor new openOnClass:BookmarkListEditor andSelector:#toolbarMenu
|
|
227 |
(Menu new fromLiteralArrayEncoding:(BookmarkListEditor toolbarMenu)) startUp
|
|
228 |
"
|
|
229 |
|
|
230 |
<resource: #menu>
|
|
231 |
|
|
232 |
^
|
|
233 |
#(Menu
|
|
234 |
(
|
|
235 |
(MenuItem
|
|
236 |
label: 'New...'
|
|
237 |
itemValue: menuNewFolder
|
|
238 |
translateLabel: true
|
|
239 |
isButton: true
|
|
240 |
submenuChannel: newMenu
|
|
241 |
labelImage: (ResourceRetriever ToolbarIconLibrary newDirectory22x22Icon)
|
|
242 |
)
|
|
243 |
(MenuItem
|
|
244 |
enabled: hasSelectionHolder
|
|
245 |
label: 'Remove'
|
|
246 |
itemValue: menuRemove
|
|
247 |
translateLabel: true
|
|
248 |
isButton: true
|
|
249 |
shortcutKey: Delete
|
|
250 |
labelImage: (ResourceRetriever ToolbarIconLibrary deleteIcon)
|
|
251 |
)
|
|
252 |
(MenuItem
|
|
253 |
label: '-'
|
|
254 |
)
|
|
255 |
(MenuItem
|
|
256 |
label: 'Save'
|
|
257 |
itemValue: menuSave
|
|
258 |
translateLabel: true
|
|
259 |
isButton: true
|
|
260 |
labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileIcon)
|
|
261 |
)
|
|
262 |
(MenuItem
|
|
263 |
label: '-'
|
|
264 |
)
|
|
265 |
(MenuItem
|
|
266 |
enabled: hasSelectionHolder
|
|
267 |
label: 'Move Up'
|
|
268 |
itemValue: menuMoveUp
|
|
269 |
translateLabel: true
|
|
270 |
isButton: true
|
|
271 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetUpIcon)
|
|
272 |
)
|
|
273 |
(MenuItem
|
|
274 |
enabled: hasSelectionHolder
|
|
275 |
label: 'Move Down'
|
|
276 |
itemValue: menuMoveDown
|
|
277 |
translateLabel: true
|
|
278 |
isButton: true
|
|
279 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownIcon)
|
|
280 |
)
|
|
281 |
(MenuItem
|
|
282 |
enabled: hasSelectionHolder
|
|
283 |
label: 'Move In'
|
|
284 |
itemValue: menuMoveIn
|
|
285 |
translateLabel: true
|
|
286 |
isButton: true
|
|
287 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownRightIcon)
|
|
288 |
)
|
|
289 |
(MenuItem
|
|
290 |
enabled: hasSelectionHolder
|
|
291 |
label: 'Move Out'
|
|
292 |
itemValue: menuMoveOut
|
|
293 |
translateLabel: true
|
|
294 |
isButton: true
|
|
295 |
labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetLeftDownIcon)
|
|
296 |
)
|
|
297 |
)
|
|
298 |
nil
|
|
299 |
nil
|
|
300 |
)
|
|
301 |
! !
|
|
302 |
|
|
303 |
!BookmarkListEditor methodsFor:'accessing'!
|
|
304 |
|
|
305 |
bookmarkList
|
|
306 |
|
|
307 |
^self bookmarkListHolder value
|
|
308 |
|
|
309 |
"Created: / 02-06-2011 / 10:40:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
310 |
!
|
|
311 |
|
|
312 |
bookmarkList: aBookmarkList
|
|
313 |
|
|
314 |
self bookmarkListHolder value: aBookmarkList
|
|
315 |
|
|
316 |
"Created: / 02-06-2011 / 10:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
317 |
!
|
|
318 |
|
|
319 |
selection
|
|
320 |
|
|
321 |
^self selectionHolder value
|
|
322 |
|
|
323 |
"Created: / 02-06-2011 / 10:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
324 |
!
|
|
325 |
|
|
326 |
selection: anObject
|
|
327 |
|
|
328 |
^self selectionHolder value: anObject
|
|
329 |
|
|
330 |
"Created: / 02-06-2011 / 11:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
331 |
! !
|
|
332 |
|
|
333 |
!BookmarkListEditor methodsFor:'aspects'!
|
|
334 |
|
|
335 |
bookmarkListHolder
|
|
336 |
<resource: #uiAspect>
|
|
337 |
|
|
338 |
"automatically generated by UIPainter ..."
|
|
339 |
|
|
340 |
"*** the code below creates a default model when invoked."
|
|
341 |
"*** (which may not be the one you wanted)"
|
|
342 |
"*** Please change as required and accept it in the browser."
|
|
343 |
"*** (and replace this comment by something more useful ;-)"
|
|
344 |
|
|
345 |
bookmarkListHolder isNil ifTrue:[
|
|
346 |
bookmarkListHolder := ValueHolder new.
|
|
347 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
348 |
"/ bookmarkListHolder addDependent:self.
|
|
349 |
"/ bookmarkListHolder onChangeSend:#bookmarkListHolderChanged to:self.
|
|
350 |
].
|
|
351 |
^ bookmarkListHolder.
|
|
352 |
|
|
353 |
"Modified: / 02-06-2011 / 10:39:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
354 |
!
|
|
355 |
|
|
356 |
hasSelectionHolder
|
|
357 |
|
|
358 |
^BlockValue
|
|
359 |
with:[:selectionHolder|selectionHolder value notNil]
|
|
360 |
argument: self selectionHolder
|
|
361 |
|
|
362 |
"Created: / 02-06-2011 / 10:55:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
363 |
!
|
|
364 |
|
|
365 |
selectionHolder
|
|
366 |
<resource: #uiAspect>
|
|
367 |
|
|
368 |
"automatically generated by UIPainter ..."
|
|
369 |
|
|
370 |
"*** the code below creates a default model when invoked."
|
|
371 |
"*** (which may not be the one you wanted)"
|
|
372 |
"*** Please change as required and accept it in the browser."
|
|
373 |
"*** (and replace this comment by something more useful ;-)"
|
|
374 |
|
|
375 |
selectionHolder isNil ifTrue:[
|
|
376 |
selectionHolder := ValueHolder new.
|
|
377 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
378 |
"/ selectionHolder addDependent:self.
|
|
379 |
"/ selectionHolder onChangeSend:#selectionHolderChanged to:self.
|
|
380 |
].
|
|
381 |
^ selectionHolder.
|
|
382 |
! !
|
|
383 |
|
|
384 |
!BookmarkListEditor methodsFor:'hooks'!
|
|
385 |
|
|
386 |
commonPostOpen
|
|
387 |
|
|
388 |
| root |
|
|
389 |
|
|
390 |
self bookmarkList ifNil:
|
|
391 |
[self bookmarkList: BookmarkList forSystemBrowser].
|
|
392 |
root := self bookmarkList root.
|
|
393 |
root isExpanded ifFalse:[root expand].
|
|
394 |
|
|
395 |
"Created: / 02-06-2011 / 10:41:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
396 |
"Modified: / 02-06-2011 / 13:33:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
397 |
! !
|
|
398 |
|
|
399 |
!BookmarkListEditor methodsFor:'menu actions'!
|
|
400 |
|
|
401 |
menuMoveDown
|
|
402 |
|
|
403 |
| sel |
|
|
404 |
|
|
405 |
(sel := self selection) parent moveDown: sel.
|
|
406 |
self selection: sel.
|
|
407 |
|
|
408 |
"Modified: / 02-06-2011 / 11:45:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
409 |
!
|
|
410 |
|
|
411 |
menuMoveIn
|
|
412 |
|
|
413 |
| sel |
|
|
414 |
|
|
415 |
(sel := self selection) parent moveIn: sel.
|
|
416 |
self selection: sel.
|
|
417 |
|
|
418 |
"Modified: / 03-06-2011 / 10:27:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
419 |
!
|
|
420 |
|
|
421 |
menuMoveOut
|
|
422 |
|
|
423 |
| sel |
|
|
424 |
|
|
425 |
(sel := self selection) parent moveOut: sel.
|
|
426 |
self selection: sel.
|
|
427 |
|
|
428 |
"Modified: / 03-06-2011 / 10:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
429 |
!
|
|
430 |
|
|
431 |
menuMoveUp
|
|
432 |
|
|
433 |
| sel |
|
|
434 |
|
|
435 |
(sel := self selection) parent moveUp: sel.
|
|
436 |
self selection: sel.
|
|
437 |
|
|
438 |
"Modified: / 02-06-2011 / 11:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
439 |
!
|
|
440 |
|
|
441 |
menuNew: className
|
|
442 |
|
|
443 |
| folder new |
|
|
444 |
folder := self selection.
|
|
445 |
folder ifNil:[folder := self bookmarkList root].
|
|
446 |
folder isFolderBookmark ifFalse: [folder := folder parent].
|
|
447 |
new := (Smalltalk at: className) new.
|
|
448 |
folder add: new.
|
|
449 |
|
|
450 |
"Created: / 02-06-2011 / 11:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
451 |
"Modified: / 02-06-2011 / 13:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
452 |
!
|
|
453 |
|
|
454 |
menuNewFolder
|
|
455 |
|
|
456 |
self menuNew: #'Bookmark::Folder'
|
|
457 |
|
|
458 |
"Modified: / 02-06-2011 / 12:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
459 |
!
|
|
460 |
|
|
461 |
menuRemove
|
|
462 |
|
|
463 |
self selection parent remove: self selection.
|
|
464 |
|
|
465 |
"Modified: / 02-06-2011 / 13:18:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
466 |
!
|
|
467 |
|
|
468 |
menuRename
|
|
469 |
|
|
470 |
| sel name |
|
|
471 |
sel := self selection.
|
|
472 |
name := Dialog request: 'Enter new name' initialAnswer: sel label asString.
|
|
473 |
name ifNil:[^self].
|
|
474 |
sel label: name.
|
|
475 |
|
|
476 |
"Modified: / 03-06-2011 / 10:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
477 |
!
|
|
478 |
|
|
479 |
menuSave
|
|
480 |
|
|
481 |
self bookmarkList save.
|
|
482 |
|
|
483 |
"Modified: / 02-06-2011 / 22:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
484 |
! !
|
|
485 |
|
|
486 |
!BookmarkListEditor class methodsFor:'documentation'!
|
|
487 |
|
|
488 |
version_CVS
|
|
489 |
^ '$Header: /cvs/stx/stx/libtool/BookmarkListEditor.st,v 1.1 2011-07-01 13:15:24 cg Exp $'
|
|
490 |
!
|
|
491 |
|
|
492 |
version_SVN
|
|
493 |
^ '§Id§'
|
|
494 |
! !
|