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

COVERAGE SUMMARY FOR SOURCE FILE [VariableUsage2EditPart.java]

nameclass, %method, %block, %line, %
VariableUsage2EditPart.java0%   (0/3)0%   (0/32)0%   (0/468)0%   (0/156)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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