author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 04 Sep 2013 11:33:19 +0100 | |
branch | jv |
changeset 13491 | b3afe831ff0a |
parent 12431 | 9f0c59c742d5 |
parent 13435 | 79039118e099 |
child 15566 | 184cea584be5 |
permissions | -rw-r--r-- |
9968 | 1 |
" |
10087 | 2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
9968 | 4 |
|
10087 | 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. |
|
9968 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
BookmarkVisitor subclass:#BookmarkMenuBuilder |
|
10281 | 29 |
instanceVariableNames:'resources menu stack toolbar' |
9968 | 30 |
classVariableNames:'' |
31 |
poolDictionaries:'' |
|
32 |
category:'Interface-Bookmarks' |
|
33 |
! |
|
34 |
||
35 |
!BookmarkMenuBuilder class methodsFor:'documentation'! |
|
36 |
||
37 |
copyright |
|
38 |
" |
|
10087 | 39 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
40 |
Copyright (c) 2009-2010 eXept Software AG |
|
41 |
||
42 |
Permission is hereby granted, free of charge, to any person |
|
43 |
obtaining a copy of this software and associated documentation |
|
44 |
files (the 'Software'), to deal in the Software without |
|
45 |
restriction, including without limitation the rights to use, |
|
46 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
47 |
copies of the Software, and to permit persons to whom the |
|
48 |
Software is furnished to do so, subject to the following |
|
49 |
conditions: |
|
9968 | 50 |
|
10087 | 51 |
The above copyright notice and this permission notice shall be |
52 |
included in all copies or substantial portions of the Software. |
|
53 |
||
54 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
55 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
56 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
57 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
58 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
59 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
60 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
61 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9968 | 62 |
" |
63 |
! ! |
|
64 |
||
65 |
!BookmarkMenuBuilder class methodsFor:'instance creation'! |
|
66 |
||
67 |
new |
|
68 |
"return an initialized instance" |
|
69 |
||
70 |
^ self basicNew initialize. |
|
71 |
! ! |
|
72 |
||
73 |
!BookmarkMenuBuilder methodsFor:'accessing'! |
|
74 |
||
75 |
menu |
|
76 |
||
77 |
^ menu |
|
78 |
||
79 |
"Created: / 23-05-2011 / 10:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10281 | 80 |
! |
81 |
||
82 |
resources:something |
|
83 |
resources := something. |
|
9968 | 84 |
! ! |
85 |
||
86 |
!BookmarkMenuBuilder methodsFor:'initialization'! |
|
87 |
||
88 |
initialize |
|
89 |
||
90 |
menu := Menu new. |
|
10296
020772a7653e
BookmarkMenuBuilder>>initialize: initialize resources to empty one
vrany
parents:
10281
diff
changeset
|
91 |
stack := Stack with: menu. |
020772a7653e
BookmarkMenuBuilder>>initialize: initialize resources to empty one
vrany
parents:
10281
diff
changeset
|
92 |
resources := ResourcePack new. |
9968 | 93 |
|
94 |
"/ super initialize. -- commented since inherited method does nothing |
|
95 |
||
10296
020772a7653e
BookmarkMenuBuilder>>initialize: initialize resources to empty one
vrany
parents:
10281
diff
changeset
|
96 |
"Modified: / 08-07-2011 / 13:49:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9968 | 97 |
! ! |
98 |
||
99 |
!BookmarkMenuBuilder methodsFor:'utilities'! |
|
100 |
||
101 |
menuItemAddBookmark:anObject |
|
102 |
||
103 |
||
104 |
^self menuItemAddBookmark:anObject labeled:'Add Bookmark Here'. |
|
105 |
||
106 |
"Modified: / 21-06-2011 / 08:00:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10281 | 107 |
"Modified: / 08-07-2011 / 11:39:31 / cg" |
9968 | 108 |
! |
109 |
||
110 |
menuItemAddBookmark:anObject labeled: label |
|
13435 | 111 |
^ MenuItem |
112 |
label:(resources string:label) |
|
113 |
itemValue:#menuAddBookmarkTo: |
|
9968 | 114 |
argument:anObject. |
115 |
||
116 |
"Created: / 21-06-2011 / 07:59:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10281 | 117 |
"Modified: / 08-07-2011 / 11:39:40 / cg" |
9968 | 118 |
! |
119 |
||
10547
1003e0421fcf
category of: #menuItemFolder:
Claus Gittinger <cg@exept.de>
parents:
10296
diff
changeset
|
120 |
menuItemFolder: folder |
1003e0421fcf
category of: #menuItemFolder:
Claus Gittinger <cg@exept.de>
parents:
10296
diff
changeset
|
121 |
|
13435 | 122 |
^ MenuItem label:folder label |
10547
1003e0421fcf
category of: #menuItemFolder:
Claus Gittinger <cg@exept.de>
parents:
10296
diff
changeset
|
123 |
|
1003e0421fcf
category of: #menuItemFolder:
Claus Gittinger <cg@exept.de>
parents:
10296
diff
changeset
|
124 |
"Created: / 21-06-2011 / 08:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1003e0421fcf
category of: #menuItemFolder:
Claus Gittinger <cg@exept.de>
parents:
10296
diff
changeset
|
125 |
! |
1003e0421fcf
category of: #menuItemFolder:
Claus Gittinger <cg@exept.de>
parents:
10296
diff
changeset
|
126 |
|
9968 | 127 |
menuItemGotoBookmark:anObject |
13435 | 128 |
|icon label| |
9968 | 129 |
|
130 |
label := anObject label. |
|
131 |
icon := anObject icon. |
|
10912 | 132 |
icon notNil ifTrue:[ label := LabelAndIcon label:label icon:icon ]. |
13435 | 133 |
^ MenuItem |
134 |
label:label |
|
135 |
itemValue:#switchToBookmarkEntry: |
|
9968 | 136 |
argument:anObject. |
137 |
||
138 |
"Created: / 21-06-2011 / 07:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10912 | 139 |
"Modified: / 29-11-2011 / 11:21:20 / cg" |
9968 | 140 |
! ! |
141 |
||
142 |
!BookmarkMenuBuilder methodsFor:'visiting'! |
|
143 |
||
10281 | 144 |
buildMenuFor: anObject |
145 |
^ self |
|
146 |
visit: anObject; |
|
147 |
menu |
|
148 |
||
149 |
"Created: / 02-06-2011 / 21:52:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
150 |
"Created: / 08-07-2011 / 11:37:42 / cg" |
|
151 |
! |
|
152 |
||
9968 | 153 |
visitBookmark:anObject |
154 |
|item| |
|
155 |
||
156 |
item := self menuItemGotoBookmark:anObject. |
|
157 |
stack top addItem:item |
|
158 |
||
159 |
"Created: / 23-05-2011 / 10:42:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
160 |
"Modified: / 21-06-2011 / 07:55:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
161 |
! |
|
162 |
||
163 |
visitFolder:anObject |
|
164 |
|item submenu| |
|
165 |
||
166 |
anObject parent isNil |
|
167 |
ifTrue:[ anObject children ? #() do:[:child | self visit:child ] ] |
|
168 |
ifFalse: |
|
169 |
[ item := self menuItemFolder: anObject. |
|
170 |
stack top addItem:item. |
|
171 |
submenu := Menu new. |
|
172 |
item submenu:submenu. |
|
173 |
stack push:submenu. |
|
174 |
anObject children ? #() do:[:child | self visit:child ]. |
|
175 |
stack top hasItems ifTrue:[ stack top addSeparator ]. |
|
176 |
item := self menuItemAddBookmark:anObject. |
|
177 |
stack top addItem:item. |
|
178 |
stack pop ]. |
|
179 |
||
180 |
"Created: / 23-05-2011 / 10:38:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
181 |
"Modified: / 21-06-2011 / 08:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
182 |
! |
|
183 |
||
184 |
visitSeparator:anObject |
|
185 |
||
186 |
stack top addItem: MenuItem separator |
|
187 |
||
188 |
"Created: / 03-06-2011 / 13:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
189 |
! ! |
|
190 |
||
191 |
!BookmarkMenuBuilder class methodsFor:'documentation'! |
|
192 |
||
193 |
version_CVS |
|
13435 | 194 |
^ '$Header: /cvs/stx/stx/libtool/BookmarkMenuBuilder.st,v 1.7 2013-08-31 17:41:19 cg Exp $' |
9968 | 195 |
! |
196 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
197 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
198 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
199 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
200 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
201 |
|
9968 | 202 |
version_SVN |
13435 | 203 |
^ '$Id: BookmarkMenuBuilder.st,v 1.7 2013-08-31 17:41:19 cg Exp $' |
9968 | 204 |
! ! |
13435 | 205 |