EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.repository.edit.parts]

COVERAGE SUMMARY FOR SOURCE FILE [VariableUsageEditPart.java]

nameclass, %method, %block, %line, %
VariableUsageEditPart.java0%   (0/3)0%   (0/32)0%   (0/339)0%   (0/112)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VariableUsageEditPart0%   (0/1)0%   (0/22)0%   (0/218)0%   (0/75)
<static initializer> 0%   (0/1)0%   (0/9)0%   (0/2)
VariableUsageEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (VariableUsageEditPart): IMapMode 0%   (0/1)0%   (0/3)0%   (0/1)
addChildVisual (EditPart, int): void 0%   (0/1)0%   (0/10)0%   (0/4)
addFixedChild (EditPart): boolean 0%   (0/1)0%   (0/13)0%   (0/6)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/20)0%   (0/7)
createLayoutEditPolicy (): LayoutEditPolicy 0%   (0/1)0%   (0/7)0%   (0/2)
createNodeFigure (): NodeFigure 0%   (0/1)0%   (0/21)0%   (0/6)
createNodePlate (): NodeFigure 0%   (0/1)0%   (0/8)0%   (0/2)
createNodeShape (): IFigure 0%   (0/1)0%   (0/10)0%   (0/2)
getContentPane (): IFigure 0%   (0/1)0%   (0/9)0%   (0/3)
getContentPaneFor (IGraphicalEditPart): IFigure 0%   (0/1)0%   (0/3)0%   (0/1)
getPrimaryChildEditPart (): EditPart 0%   (0/1)0%   (0/5)0%   (0/2)
getPrimaryShape (): VariableUsageEditPart$ParametricParameterUsageFigure 0%   (0/1)0%   (0/4)0%   (0/1)
getTargetEditPart (Request): EditPart 0%   (0/1)0%   (0/25)0%   (0/10)
removeChildVisual (EditPart): void 0%   (0/1)0%   (0/9)0%   (0/4)
removeFixedChild (EditPart): boolean 0%   (0/1)0%   (0/7)0%   (0/3)
setBackgroundColor (Color): void 0%   (0/1)0%   (0/8)0%   (0/3)
setForegroundColor (Color): void 0%   (0/1)0%   (0/8)0%   (0/3)
setLineType (int): void 0%   (0/1)0%   (0/10)0%   (0/3)
setLineWidth (int): void 0%   (0/1)0%   (0/10)0%   (0/3)
setupContentPane (IFigure): IFigure 0%   (0/1)0%   (0/15)0%   (0/5)
     
class VariableUsageEditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
VariableUsageEditPart$1 (VariableUsageEditPart): void 0%   (0/1)0%   (0/6)0%   (0/2)
createChildEditPolicy (EditPart): EditPolicy 0%   (0/1)0%   (0/12)0%   (0/5)
getCreateCommand (CreateRequest): Command 0%   (0/1)0%   (0/2)0%   (0/1)
getMoveChildrenCommand (Request): Command 0%   (0/1)0%   (0/2)0%   (0/1)
     
class VariableUsageEditPart$ParametricParameterUsageFigure0%   (0/1)0%   (0/6)0%   (0/99)0%   (0/30)
VariableUsageEditPart$ParametricParameterUsageFigure (VariableUsageEditPart):... 0%   (0/1)0%   (0/55)0%   (0/16)
createContents (): void 0%   (0/1)0%   (0/31)0%   (0/9)
getFigureParametricParameterUsageRectangleCompartment (): RectangleFigure 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureVariableUsageReferenceLabelFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
setUseLocalCoordinates (boolean): void 0%   (0/1)0%   (0/4)0%   (0/2)
useLocalCoordinates (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)

1/*
2 * Copyright 2007, IPD, SDQ, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.repository.edit.parts;
5 
6import org.eclipse.draw2d.ColorConstants;
7import org.eclipse.draw2d.GridData;
8import org.eclipse.draw2d.GridLayout;
9import org.eclipse.draw2d.IFigure;
10import org.eclipse.draw2d.MarginBorder;
11import org.eclipse.draw2d.RectangleFigure;
12import org.eclipse.draw2d.Shape;
13import org.eclipse.draw2d.StackLayout;
14import org.eclipse.draw2d.geometry.Dimension;
15import org.eclipse.gef.EditPart;
16import org.eclipse.gef.EditPolicy;
17import org.eclipse.gef.Request;
18import org.eclipse.gef.commands.Command;
19import org.eclipse.gef.editpolicies.LayoutEditPolicy;
20import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
21import org.eclipse.gef.requests.CreateRequest;
22import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
23import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
24import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
25import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
26import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
27import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
28import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
29import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
30import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
31import org.eclipse.gmf.runtime.emf.type.core.IElementType;
32import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
33import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
34import org.eclipse.gmf.runtime.notation.View;
35import org.eclipse.swt.graphics.Color;
36 
37import de.uka.ipd.sdq.pcm.gmf.repository.edit.policies.VariableUsageItemSemanticEditPolicy;
38import de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry;
39import de.uka.ipd.sdq.pcm.gmf.repository.providers.PalladioComponentModelElementTypes;
40import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
41import de.uka.ipd.sdq.pcm.stochasticexpressions.PCMStoExPrettyPrintVisitor;
42 
43/**
44 * @generated
45 */
46public class VariableUsageEditPart extends ShapeNodeEditPart {
47 
48        /**
49         * @generated
50         */
51        public static final int VISUAL_ID = 3104;
52 
53        /**
54         * @generated
55         */
56        protected IFigure contentPane;
57 
58        /**
59         * @generated
60         */
61        protected IFigure primaryShape;
62 
63        /**
64         * @generated
65         */
66        public VariableUsageEditPart(View view) {
67                super(view);
68        }
69 
70        /**
71         * @generated
72         */
73        protected void createDefaultEditPolicies() {
74                installEditPolicy(EditPolicyRoles.CREATION_ROLE,
75                                new CreationEditPolicy());
76                super.createDefaultEditPolicies();
77                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
78                                new VariableUsageItemSemanticEditPolicy());
79                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
80                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
81                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
82        }
83 
84        /**
85         * @generated
86         */
87        protected LayoutEditPolicy createLayoutEditPolicy() {
88                LayoutEditPolicy lep = new LayoutEditPolicy() {
89 
90                        protected EditPolicy createChildEditPolicy(EditPart child) {
91                                EditPolicy result = child
92                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
93                                if (result == null) {
94                                        result = new NonResizableEditPolicy();
95                                }
96                                return result;
97                        }
98 
99                        protected Command getMoveChildrenCommand(Request request) {
100                                return null;
101                        }
102 
103                        protected Command getCreateCommand(CreateRequest request) {
104                                return null;
105                        }
106                };
107                return lep;
108        }
109 
110        /**
111         * @generated
112         */
113        protected IFigure createNodeShape() {
114                ParametricParameterUsageFigure figure = new ParametricParameterUsageFigure();
115                return primaryShape = figure;
116        }
117 
118        /**
119         * @generated
120         */
121        public ParametricParameterUsageFigure getPrimaryShape() {
122                return (ParametricParameterUsageFigure) primaryShape;
123        }
124 
125        /**
126         * @generated
127         */
128        protected boolean addFixedChild(EditPart childEditPart) {
129                if (childEditPart instanceof VariableUsageLabelEditPart) {
130                        ((VariableUsageLabelEditPart) childEditPart)
131                                        .setLabel(getPrimaryShape()
132                                                        .getFigureVariableUsageReferenceLabelFigure());
133                        return true;
134                }
135                return false;
136        }
137 
138        /**
139         * @generated
140         */
141        protected boolean removeFixedChild(EditPart childEditPart) {
142                if (childEditPart instanceof VariableUsageLabelEditPart) {
143                        return true;
144                }
145                return false;
146        }
147 
148        /**
149         * @generated
150         */
151        protected void addChildVisual(EditPart childEditPart, int index) {
152                if (addFixedChild(childEditPart)) {
153                        return;
154                }
155                super.addChildVisual(childEditPart, -1);
156        }
157 
158        /**
159         * @generated
160         */
161        protected void removeChildVisual(EditPart childEditPart) {
162                if (removeFixedChild(childEditPart)) {
163                        return;
164                }
165                super.removeChildVisual(childEditPart);
166        }
167 
168        /**
169         * @generated
170         */
171        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
172                return getContentPane();
173        }
174 
175        /**
176         * @generated
177         */
178        protected NodeFigure createNodePlate() {
179                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
180                return result;
181        }
182 
183        /**
184         * Creates figure for this edit part.
185         * 
186         * Body of this method does not depend on settings in generation model so
187         * you may safely remove <i>generated</i> tag and modify it.
188         * 
189         * @generated
190         */
191        protected NodeFigure createNodeFigure() {
192                NodeFigure figure = createNodePlate();
193                figure.setLayoutManager(new StackLayout());
194                IFigure shape = createNodeShape();
195                figure.add(shape);
196                contentPane = setupContentPane(shape);
197                return figure;
198        }
199 
200        /**
201         * Default implementation treats passed figure as content pane. Respects
202         * layout one may have set for generated figure.
203         * 
204         * @param nodeShape
205         *            instance of generated figure class
206         * @generated
207         */
208        protected IFigure setupContentPane(IFigure nodeShape) {
209                if (nodeShape.getLayoutManager() == null) {
210                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
211                        layout.setSpacing(5);
212                        nodeShape.setLayoutManager(layout);
213                }
214                return nodeShape; // use nodeShape itself as contentPane
215        }
216 
217        /**
218         * @generated
219         */
220        public IFigure getContentPane() {
221                if (contentPane != null) {
222                        return contentPane;
223                }
224                return super.getContentPane();
225        }
226 
227        /**
228         * @generated
229         */
230        protected void setForegroundColor(Color color) {
231                if (primaryShape != null) {
232                        primaryShape.setForegroundColor(color);
233                }
234        }
235 
236        /**
237         * @generated
238         */
239        protected void setBackgroundColor(Color color) {
240                if (primaryShape != null) {
241                        primaryShape.setBackgroundColor(color);
242                }
243        }
244 
245        /**
246         * @generated
247         */
248        protected void setLineWidth(int width) {
249                if (primaryShape instanceof Shape) {
250                        ((Shape) primaryShape).setLineWidth(width);
251                }
252        }
253 
254        /**
255         * @generated
256         */
257        protected void setLineType(int style) {
258                if (primaryShape instanceof Shape) {
259                        ((Shape) primaryShape).setLineStyle(style);
260                }
261        }
262 
263        /**
264         * @generated
265         */
266        public EditPart getPrimaryChildEditPart() {
267                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
268                                .getType(VariableUsageLabelEditPart.VISUAL_ID));
269        }
270 
271        /**
272         * @generated
273         */
274        public EditPart getTargetEditPart(Request request) {
275                if (request instanceof CreateViewAndElementRequest) {
276                        CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request)
277                                        .getViewAndElementDescriptor()
278                                        .getCreateElementRequestAdapter();
279                        IElementType type = (IElementType) adapter
280                                        .getAdapter(IElementType.class);
281                        if (type == PalladioComponentModelElementTypes.VariableCharacterisation_3105) {
282                                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
283                                                .getType(VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart.VISUAL_ID));
284                        }
285                }
286                return super.getTargetEditPart(request);
287        }
288 
289        /**
290         * @generated
291         */
292        public class ParametricParameterUsageFigure extends RectangleFigure {
293 
294                /**
295                 * @generated
296                 */
297                private WrappingLabel fFigureVariableUsageReferenceLabelFigure;
298 
299                /**
300                 * @generated
301                 */
302                private RectangleFigure fFigureParametricParameterUsageRectangleCompartment;
303 
304                /**
305                 * @generated
306                 */
307                public ParametricParameterUsageFigure() {
308 
309                        GridLayout layoutThis = new GridLayout();
310                        layoutThis.numColumns = 1;
311                        layoutThis.makeColumnsEqualWidth = true;
312                        layoutThis.horizontalSpacing = 0;
313                        layoutThis.verticalSpacing = 0;
314                        layoutThis.marginWidth = 0;
315                        layoutThis.marginHeight = 0;
316                        this.setLayoutManager(layoutThis);
317 
318                        this.setLineWidth(1);
319                        this.setBackgroundColor(THIS_BACK);
320                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
321                                        getMapMode().DPtoLP(0)));
322                        createContents();
323                }
324 
325                /**
326                 * @generated not
327                 */
328                private void createContents() {
329 
330                        fFigureVariableUsageReferenceLabelFigure = new WrapLabel();
331                        if (resolveSemanticElement() != null) {
332                                fFigureVariableUsageReferenceLabelFigure
333                                                .setText(new PCMStoExPrettyPrintVisitor()
334                                                                .prettyPrint(((VariableUsage) resolveSemanticElement())
335                                                                                .getNamedReference__VariableUsage()));
336                        } else {
337                                fFigureVariableUsageReferenceLabelFigure.setText("<null>");
338                        }
339 
340                        this.add(fFigureVariableUsageReferenceLabelFigure);
341 
342                }
343 
344                /**
345                 * @generated
346                 */
347                private boolean myUseLocalCoordinates = false;
348 
349                /**
350                 * @generated
351                 */
352                protected boolean useLocalCoordinates() {
353                        return myUseLocalCoordinates;
354                }
355 
356                /**
357                 * @generated
358                 */
359                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
360                        myUseLocalCoordinates = useLocalCoordinates;
361                }
362 
363                /**
364                 * @generated
365                 */
366                public WrappingLabel getFigureVariableUsageReferenceLabelFigure() {
367                        return fFigureVariableUsageReferenceLabelFigure;
368                }
369 
370                /**
371                 * @generated
372                 */
373                public RectangleFigure getFigureParametricParameterUsageRectangleCompartment() {
374                        return fFigureParametricParameterUsageRectangleCompartment;
375                }
376 
377        }
378 
379        /**
380         * @generated
381         */
382        static final Color THIS_BACK = new Color(null, 220, 220, 220);
383 
384}

[all classes][de.uka.ipd.sdq.pcm.gmf.repository.edit.parts]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov