1 | /* |
2 | * Copyright 2009, SDQ, IPD, Uni Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.resource.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.PaletteGroup; |
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.resource.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(createPcm1Group()); |
29 | } |
30 | |
31 | /** |
32 | * Creates "pcm" palette tool group |
33 | * @generated |
34 | */ |
35 | private PaletteContainer createPcm1Group() { |
36 | PaletteGroup paletteContainer = new PaletteGroup( |
37 | Messages.Pcm1Group_title); |
38 | paletteContainer.setId("createPcm1Group"); //$NON-NLS-1$ |
39 | paletteContainer.add(createResourceContainer1CreationTool()); |
40 | paletteContainer.add(createLinkingResource2CreationTool()); |
41 | paletteContainer |
42 | .add(createProcessingResourceSpecification3CreationTool()); |
43 | paletteContainer.add(createConnection4CreationTool()); |
44 | return paletteContainer; |
45 | } |
46 | |
47 | /** |
48 | * @generated |
49 | */ |
50 | private ToolEntry createResourceContainer1CreationTool() { |
51 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
52 | types.add(PalladioComponentModelElementTypes.ResourceContainer_2001); |
53 | NodeToolEntry entry = new NodeToolEntry( |
54 | Messages.ResourceContainer1CreationTool_title, |
55 | Messages.ResourceContainer1CreationTool_desc, types); |
56 | entry.setId("createResourceContainer1CreationTool"); //$NON-NLS-1$ |
57 | entry |
58 | .setSmallIcon(PalladioComponentModelElementTypes |
59 | .getImageDescriptor(PalladioComponentModelElementTypes.ResourceContainer_2001)); |
60 | entry.setLargeIcon(entry.getSmallIcon()); |
61 | return entry; |
62 | } |
63 | |
64 | /** |
65 | * @generated |
66 | */ |
67 | private ToolEntry createLinkingResource2CreationTool() { |
68 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
69 | types.add(PalladioComponentModelElementTypes.LinkingResource_2003); |
70 | NodeToolEntry entry = new NodeToolEntry( |
71 | Messages.LinkingResource2CreationTool_title, |
72 | Messages.LinkingResource2CreationTool_desc, types); |
73 | entry.setId("createLinkingResource2CreationTool"); //$NON-NLS-1$ |
74 | entry |
75 | .setSmallIcon(PalladioComponentModelElementTypes |
76 | .getImageDescriptor(PalladioComponentModelElementTypes.LinkingResource_2003)); |
77 | entry.setLargeIcon(entry.getSmallIcon()); |
78 | return entry; |
79 | } |
80 | |
81 | /** |
82 | * @generated |
83 | */ |
84 | private ToolEntry createProcessingResourceSpecification3CreationTool() { |
85 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
86 | types |
87 | .add(PalladioComponentModelElementTypes.ProcessingResourceSpecification_3001); |
88 | NodeToolEntry entry = new NodeToolEntry( |
89 | Messages.ProcessingResourceSpecification3CreationTool_title, |
90 | Messages.ProcessingResourceSpecification3CreationTool_desc, |
91 | types); |
92 | entry.setId("createProcessingResourceSpecification3CreationTool"); //$NON-NLS-1$ |
93 | entry |
94 | .setSmallIcon(PalladioComponentModelElementTypes |
95 | .getImageDescriptor(PalladioComponentModelElementTypes.ProcessingResourceSpecification_3001)); |
96 | entry.setLargeIcon(entry.getSmallIcon()); |
97 | return entry; |
98 | } |
99 | |
100 | /** |
101 | * @generated |
102 | */ |
103 | private ToolEntry createConnection4CreationTool() { |
104 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
105 | types |
106 | .add(PalladioComponentModelElementTypes.LinkingResourceConnectedResourceContainers_LinkingResource_4002); |
107 | LinkToolEntry entry = new LinkToolEntry( |
108 | Messages.Connection4CreationTool_title, |
109 | Messages.Connection4CreationTool_desc, types); |
110 | entry.setId("createConnection4CreationTool"); //$NON-NLS-1$ |
111 | entry |
112 | .setSmallIcon(PalladioComponentModelDiagramEditorPlugin |
113 | .findImageDescriptor("/de.uka.ipd.sdq.pcm.edit/icons/full/obj16/CommunicationLink.gif")); //$NON-NLS-1$ |
114 | entry |
115 | .setLargeIcon(PalladioComponentModelDiagramEditorPlugin |
116 | .findImageDescriptor("/de.uka.ipd.sdq.pcm.edit/icons/full/obj16/CommunicationLink.gif")); //$NON-NLS-1$ |
117 | return entry; |
118 | } |
119 | |
120 | /** |
121 | * @generated |
122 | */ |
123 | private static class NodeToolEntry extends ToolEntry { |
124 | |
125 | /** |
126 | * @generated |
127 | */ |
128 | private final List elementTypes; |
129 | |
130 | /** |
131 | * @generated |
132 | */ |
133 | private NodeToolEntry(String title, String description, |
134 | List elementTypes) { |
135 | super(title, description, null, null); |
136 | this.elementTypes = elementTypes; |
137 | } |
138 | |
139 | /** |
140 | * @generated |
141 | */ |
142 | public Tool createTool() { |
143 | Tool tool = new UnspecifiedTypeCreationTool(elementTypes); |
144 | tool.setProperties(getToolProperties()); |
145 | return tool; |
146 | } |
147 | } |
148 | |
149 | /** |
150 | * @generated |
151 | */ |
152 | private static class LinkToolEntry extends ToolEntry { |
153 | |
154 | /** |
155 | * @generated |
156 | */ |
157 | private final List relationshipTypes; |
158 | |
159 | /** |
160 | * @generated |
161 | */ |
162 | private LinkToolEntry(String title, String description, |
163 | List relationshipTypes) { |
164 | super(title, description, null, null); |
165 | this.relationshipTypes = relationshipTypes; |
166 | } |
167 | |
168 | /** |
169 | * @generated |
170 | */ |
171 | public Tool createTool() { |
172 | Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes); |
173 | tool.setProperties(getToolProperties()); |
174 | return tool; |
175 | } |
176 | } |
177 | } |