1 | /* |
2 | * Copyright 2007, SDQ, IPD, University of Karlsruhe |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.usage.part; |
5 | |
6 | import java.util.ArrayList; |
7 | import java.util.List; |
8 | |
9 | import org.eclipse.gef.Tool; |
10 | import org.eclipse.gef.palette.PaletteContainer; |
11 | import org.eclipse.gef.palette.PaletteDrawer; |
12 | import org.eclipse.gef.palette.PaletteRoot; |
13 | import org.eclipse.gef.palette.ToolEntry; |
14 | import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool; |
15 | import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool; |
16 | |
17 | import de.uka.ipd.sdq.pcm.gmf.usage.providers.PalladioComponentModelElementTypes; |
18 | |
19 | /** |
20 | * @generated |
21 | */ |
22 | public class PalladioComponentModelPaletteFactory { |
23 | |
24 | /** |
25 | * @generated |
26 | */ |
27 | public void fillPalette(PaletteRoot paletteRoot) { |
28 | paletteRoot.add(createUserActions1Group()); |
29 | paletteRoot.add(createActionDetails2Group()); |
30 | paletteRoot.add(createLinks3Group()); |
31 | paletteRoot.add(createWorkloads4Group()); |
32 | } |
33 | |
34 | /** |
35 | * Creates "User Actions" palette tool group |
36 | * @generated |
37 | */ |
38 | private PaletteContainer createUserActions1Group() { |
39 | PaletteDrawer paletteContainer = new PaletteDrawer( |
40 | Messages.UserActions1Group_title); |
41 | paletteContainer.setId("createUserActions1Group"); //$NON-NLS-1$ |
42 | paletteContainer.setDescription(Messages.UserActions1Group_desc); |
43 | paletteContainer.add(createStart1CreationTool()); |
44 | paletteContainer.add(createStop2CreationTool()); |
45 | paletteContainer.add(createDelay3CreationTool()); |
46 | paletteContainer.add(createEntryLevelSystemCall4CreationTool()); |
47 | paletteContainer.add(createLoop5CreationTool()); |
48 | paletteContainer.add(createBranch6CreationTool()); |
49 | return paletteContainer; |
50 | } |
51 | |
52 | /** |
53 | * Creates "Action Details" palette tool group |
54 | * @generated |
55 | */ |
56 | private PaletteContainer createActionDetails2Group() { |
57 | PaletteDrawer paletteContainer = new PaletteDrawer( |
58 | Messages.ActionDetails2Group_title); |
59 | paletteContainer.setId("createActionDetails2Group"); //$NON-NLS-1$ |
60 | paletteContainer.setDescription(Messages.ActionDetails2Group_desc); |
61 | paletteContainer.add(createVariableUsage1CreationTool()); |
62 | paletteContainer.add(createVariableCharacterisation2CreationTool()); |
63 | paletteContainer.add(createScenarioBehaviour3CreationTool()); |
64 | paletteContainer.add(createBranchTransition4CreationTool()); |
65 | return paletteContainer; |
66 | } |
67 | |
68 | /** |
69 | * Creates "Links" palette tool group |
70 | * @generated |
71 | */ |
72 | private PaletteContainer createLinks3Group() { |
73 | PaletteDrawer paletteContainer = new PaletteDrawer( |
74 | Messages.Links3Group_title); |
75 | paletteContainer.setId("createLinks3Group"); //$NON-NLS-1$ |
76 | paletteContainer.setDescription(Messages.Links3Group_desc); |
77 | paletteContainer.add(createUsageFlow1CreationTool()); |
78 | return paletteContainer; |
79 | } |
80 | |
81 | /** |
82 | * Creates "Workloads" palette tool group |
83 | * @generated |
84 | */ |
85 | private PaletteContainer createWorkloads4Group() { |
86 | PaletteDrawer paletteContainer = new PaletteDrawer( |
87 | Messages.Workloads4Group_title); |
88 | paletteContainer.setId("createWorkloads4Group"); //$NON-NLS-1$ |
89 | paletteContainer.setDescription(Messages.Workloads4Group_desc); |
90 | paletteContainer.add(createOpenWorkload1CreationTool()); |
91 | paletteContainer.add(createClosedWorkload2CreationTool()); |
92 | paletteContainer.add(createUsageScenario3CreationTool()); |
93 | return paletteContainer; |
94 | } |
95 | |
96 | /** |
97 | * @generated |
98 | */ |
99 | private ToolEntry createStart1CreationTool() { |
100 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
101 | types.add(PalladioComponentModelElementTypes.Start_3001); |
102 | NodeToolEntry entry = new NodeToolEntry( |
103 | Messages.Start1CreationTool_title, |
104 | Messages.Start1CreationTool_desc, types); |
105 | entry.setId("createStart1CreationTool"); //$NON-NLS-1$ |
106 | entry |
107 | .setSmallIcon(PalladioComponentModelElementTypes |
108 | .getImageDescriptor(PalladioComponentModelElementTypes.Start_3001)); |
109 | entry.setLargeIcon(entry.getSmallIcon()); |
110 | return entry; |
111 | } |
112 | |
113 | /** |
114 | * @generated |
115 | */ |
116 | private ToolEntry createStop2CreationTool() { |
117 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
118 | types.add(PalladioComponentModelElementTypes.Stop_3002); |
119 | NodeToolEntry entry = new NodeToolEntry( |
120 | Messages.Stop2CreationTool_title, |
121 | Messages.Stop2CreationTool_desc, types); |
122 | entry.setId("createStop2CreationTool"); //$NON-NLS-1$ |
123 | entry |
124 | .setSmallIcon(PalladioComponentModelElementTypes |
125 | .getImageDescriptor(PalladioComponentModelElementTypes.Stop_3002)); |
126 | entry.setLargeIcon(entry.getSmallIcon()); |
127 | return entry; |
128 | } |
129 | |
130 | /** |
131 | * @generated |
132 | */ |
133 | private ToolEntry createDelay3CreationTool() { |
134 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
135 | types.add(PalladioComponentModelElementTypes.Delay_3017); |
136 | NodeToolEntry entry = new NodeToolEntry( |
137 | Messages.Delay3CreationTool_title, |
138 | Messages.Delay3CreationTool_desc, types); |
139 | entry.setId("createDelay3CreationTool"); //$NON-NLS-1$ |
140 | entry |
141 | .setSmallIcon(PalladioComponentModelElementTypes |
142 | .getImageDescriptor(PalladioComponentModelElementTypes.Delay_3017)); |
143 | entry.setLargeIcon(entry.getSmallIcon()); |
144 | return entry; |
145 | } |
146 | |
147 | /** |
148 | * @generated |
149 | */ |
150 | private ToolEntry createEntryLevelSystemCall4CreationTool() { |
151 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
152 | types.add(PalladioComponentModelElementTypes.EntryLevelSystemCall_3003); |
153 | NodeToolEntry entry = new NodeToolEntry( |
154 | Messages.EntryLevelSystemCall4CreationTool_title, |
155 | Messages.EntryLevelSystemCall4CreationTool_desc, types); |
156 | entry.setId("createEntryLevelSystemCall4CreationTool"); //$NON-NLS-1$ |
157 | entry |
158 | .setSmallIcon(PalladioComponentModelElementTypes |
159 | .getImageDescriptor(PalladioComponentModelElementTypes.EntryLevelSystemCall_3003)); |
160 | entry.setLargeIcon(entry.getSmallIcon()); |
161 | return entry; |
162 | } |
163 | |
164 | /** |
165 | * @generated |
166 | */ |
167 | private ToolEntry createLoop5CreationTool() { |
168 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
169 | types.add(PalladioComponentModelElementTypes.Loop_3005); |
170 | NodeToolEntry entry = new NodeToolEntry( |
171 | Messages.Loop5CreationTool_title, |
172 | Messages.Loop5CreationTool_desc, types); |
173 | entry.setId("createLoop5CreationTool"); //$NON-NLS-1$ |
174 | entry |
175 | .setSmallIcon(PalladioComponentModelElementTypes |
176 | .getImageDescriptor(PalladioComponentModelElementTypes.Loop_3005)); |
177 | entry.setLargeIcon(entry.getSmallIcon()); |
178 | return entry; |
179 | } |
180 | |
181 | /** |
182 | * @generated |
183 | */ |
184 | private ToolEntry createBranch6CreationTool() { |
185 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
186 | types.add(PalladioComponentModelElementTypes.Branch_3008); |
187 | NodeToolEntry entry = new NodeToolEntry( |
188 | Messages.Branch6CreationTool_title, |
189 | Messages.Branch6CreationTool_desc, types); |
190 | entry.setId("createBranch6CreationTool"); //$NON-NLS-1$ |
191 | entry |
192 | .setSmallIcon(PalladioComponentModelElementTypes |
193 | .getImageDescriptor(PalladioComponentModelElementTypes.Branch_3008)); |
194 | entry.setLargeIcon(entry.getSmallIcon()); |
195 | return entry; |
196 | } |
197 | |
198 | /** |
199 | * @generated |
200 | */ |
201 | private ToolEntry createUsageFlow1CreationTool() { |
202 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
203 | types |
204 | .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002); |
205 | LinkToolEntry entry = new LinkToolEntry( |
206 | Messages.UsageFlow1CreationTool_title, |
207 | Messages.UsageFlow1CreationTool_desc, types); |
208 | entry.setId("createUsageFlow1CreationTool"); //$NON-NLS-1$ |
209 | entry |
210 | .setSmallIcon(PalladioComponentModelUsageDiagramEditorPlugin |
211 | .findImageDescriptor("/de.uka.ipd.sdq.pcm.edit/icons/full/ctool16/ControlFlow.gif")); //$NON-NLS-1$ |
212 | entry.setLargeIcon(entry.getSmallIcon()); |
213 | return entry; |
214 | } |
215 | |
216 | /** |
217 | * @generated |
218 | */ |
219 | private ToolEntry createVariableUsage1CreationTool() { |
220 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
221 | types.add(PalladioComponentModelElementTypes.VariableUsage_3012); |
222 | NodeToolEntry entry = new NodeToolEntry( |
223 | Messages.VariableUsage1CreationTool_title, |
224 | Messages.VariableUsage1CreationTool_desc, types); |
225 | entry.setId("createVariableUsage1CreationTool"); //$NON-NLS-1$ |
226 | entry |
227 | .setSmallIcon(PalladioComponentModelElementTypes |
228 | .getImageDescriptor(PalladioComponentModelElementTypes.VariableUsage_3012)); |
229 | entry.setLargeIcon(entry.getSmallIcon()); |
230 | return entry; |
231 | } |
232 | |
233 | /** |
234 | * @generated |
235 | */ |
236 | private ToolEntry createVariableCharacterisation2CreationTool() { |
237 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
238 | types |
239 | .add(PalladioComponentModelElementTypes.VariableCharacterisation_3013); |
240 | NodeToolEntry entry = new NodeToolEntry( |
241 | Messages.VariableCharacterisation2CreationTool_title, |
242 | Messages.VariableCharacterisation2CreationTool_desc, types); |
243 | entry.setId("createVariableCharacterisation2CreationTool"); //$NON-NLS-1$ |
244 | entry |
245 | .setSmallIcon(PalladioComponentModelElementTypes |
246 | .getImageDescriptor(PalladioComponentModelElementTypes.VariableCharacterisation_3013)); |
247 | entry.setLargeIcon(entry.getSmallIcon()); |
248 | return entry; |
249 | } |
250 | |
251 | /** |
252 | * @generated |
253 | */ |
254 | private ToolEntry createScenarioBehaviour3CreationTool() { |
255 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(3); |
256 | types.add(PalladioComponentModelElementTypes.ScenarioBehaviour_3014); |
257 | types.add(PalladioComponentModelElementTypes.ScenarioBehaviour_3007); |
258 | types.add(PalladioComponentModelElementTypes.ScenarioBehaviour_3010); |
259 | NodeToolEntry entry = new NodeToolEntry( |
260 | Messages.ScenarioBehaviour3CreationTool_title, |
261 | Messages.ScenarioBehaviour3CreationTool_desc, types); |
262 | entry.setId("createScenarioBehaviour3CreationTool"); //$NON-NLS-1$ |
263 | entry |
264 | .setSmallIcon(PalladioComponentModelElementTypes |
265 | .getImageDescriptor(PalladioComponentModelElementTypes.ScenarioBehaviour_3014)); |
266 | entry.setLargeIcon(entry.getSmallIcon()); |
267 | return entry; |
268 | } |
269 | |
270 | /** |
271 | * @generated |
272 | */ |
273 | private ToolEntry createBranchTransition4CreationTool() { |
274 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
275 | types.add(PalladioComponentModelElementTypes.BranchTransition_3009); |
276 | NodeToolEntry entry = new NodeToolEntry( |
277 | Messages.BranchTransition4CreationTool_title, |
278 | Messages.BranchTransition4CreationTool_desc, types); |
279 | entry.setId("createBranchTransition4CreationTool"); //$NON-NLS-1$ |
280 | entry |
281 | .setSmallIcon(PalladioComponentModelElementTypes |
282 | .getImageDescriptor(PalladioComponentModelElementTypes.BranchTransition_3009)); |
283 | entry.setLargeIcon(entry.getSmallIcon()); |
284 | return entry; |
285 | } |
286 | |
287 | /** |
288 | * @generated |
289 | */ |
290 | private ToolEntry createOpenWorkload1CreationTool() { |
291 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
292 | types.add(PalladioComponentModelElementTypes.OpenWorkload_3016); |
293 | NodeToolEntry entry = new NodeToolEntry( |
294 | Messages.OpenWorkload1CreationTool_title, |
295 | Messages.OpenWorkload1CreationTool_desc, types); |
296 | entry.setId("createOpenWorkload1CreationTool"); //$NON-NLS-1$ |
297 | entry |
298 | .setSmallIcon(PalladioComponentModelElementTypes |
299 | .getImageDescriptor(PalladioComponentModelElementTypes.OpenWorkload_3016)); |
300 | entry.setLargeIcon(entry.getSmallIcon()); |
301 | return entry; |
302 | } |
303 | |
304 | /** |
305 | * @generated |
306 | */ |
307 | private ToolEntry createClosedWorkload2CreationTool() { |
308 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
309 | types.add(PalladioComponentModelElementTypes.ClosedWorkload_3015); |
310 | NodeToolEntry entry = new NodeToolEntry( |
311 | Messages.ClosedWorkload2CreationTool_title, |
312 | Messages.ClosedWorkload2CreationTool_desc, types); |
313 | entry.setId("createClosedWorkload2CreationTool"); //$NON-NLS-1$ |
314 | entry |
315 | .setSmallIcon(PalladioComponentModelElementTypes |
316 | .getImageDescriptor(PalladioComponentModelElementTypes.ClosedWorkload_3015)); |
317 | entry.setLargeIcon(entry.getSmallIcon()); |
318 | return entry; |
319 | } |
320 | |
321 | /** |
322 | * @generated |
323 | */ |
324 | private ToolEntry createUsageScenario3CreationTool() { |
325 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
326 | types.add(PalladioComponentModelElementTypes.UsageScenario_2004); |
327 | NodeToolEntry entry = new NodeToolEntry( |
328 | Messages.UsageScenario3CreationTool_title, |
329 | Messages.UsageScenario3CreationTool_desc, types); |
330 | entry.setId("createUsageScenario3CreationTool"); //$NON-NLS-1$ |
331 | entry |
332 | .setSmallIcon(PalladioComponentModelElementTypes |
333 | .getImageDescriptor(PalladioComponentModelElementTypes.UsageScenario_2004)); |
334 | entry.setLargeIcon(entry.getSmallIcon()); |
335 | return entry; |
336 | } |
337 | |
338 | /** |
339 | * @generated |
340 | */ |
341 | private static class NodeToolEntry extends ToolEntry { |
342 | |
343 | /** |
344 | * @generated |
345 | */ |
346 | private final List elementTypes; |
347 | |
348 | /** |
349 | * @generated |
350 | */ |
351 | private NodeToolEntry(String title, String description, |
352 | List elementTypes) { |
353 | super(title, description, null, null); |
354 | this.elementTypes = elementTypes; |
355 | } |
356 | |
357 | /** |
358 | * @generated |
359 | */ |
360 | public Tool createTool() { |
361 | Tool tool = new UnspecifiedTypeCreationTool(elementTypes); |
362 | tool.setProperties(getToolProperties()); |
363 | return tool; |
364 | } |
365 | } |
366 | |
367 | /** |
368 | * @generated |
369 | */ |
370 | private static class LinkToolEntry extends ToolEntry { |
371 | |
372 | /** |
373 | * @generated |
374 | */ |
375 | private final List relationshipTypes; |
376 | |
377 | /** |
378 | * @generated |
379 | */ |
380 | private LinkToolEntry(String title, String description, |
381 | List relationshipTypes) { |
382 | super(title, description, null, null); |
383 | this.relationshipTypes = relationshipTypes; |
384 | } |
385 | |
386 | /** |
387 | * @generated |
388 | */ |
389 | public Tool createTool() { |
390 | Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes); |
391 | tool.setProperties(getToolProperties()); |
392 | return tool; |
393 | } |
394 | } |
395 | } |