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 [VariableUsage5EditPart.java]

nameclass, %method, %block, %line, %
VariableUsage5EditPart.java0%   (0/3)0%   (0/32)0%   (0/488)0%   (0/161)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VariableUsage5EditPart0%   (0/1)0%   (0/22)0%   (0/261)0%   (0/94)
<static initializer> 0%   (0/1)0%   (0/9)0%   (0/2)
VariableUsage5EditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (VariableUsage5EditPart): 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/14)
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 (): VariableUsage5EditPart$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 VariableUsage5EditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
VariableUsage5EditPart$1 (VariableUsage5EditPart): 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 VariableUsage5EditPart$ParametricParameterUsageFigure0%   (0/1)0%   (0/6)0%   (0/205)0%   (0/60)
VariableUsage5EditPart$ParametricParameterUsageFigure (VariableUsage5EditPart... 0%   (0/1)0%   (0/55)0%   (0/16)
createContents (): void 0%   (0/1)0%   (0/137)0%   (0/39)
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.VariableUsage5ItemSemanticEditPolicy;
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 VariableUsage5EditPart extends ShapeNodeEditPart {
45 
46        /**
47         * @generated
48         */
49        public static final int VISUAL_ID = 3054;
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 VariableUsage5EditPart(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 VariableUsage5ItemSemanticEditPolicy());
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 VariableUsage5LabelEditPart) {
128                        ((VariableUsage5LabelEditPart) childEditPart)
129                                        .setLabel(getPrimaryShape()
130                                                        .getFigureVariableUsageReferenceLabelFigure());
131                        return true;
132                }
133                if (childEditPart instanceof VariableUsageVariableCharacterisation5EditPart) {
134                        IFigure pane = getPrimaryShape()
135                                        .getFigureParametricParameterUsageRectangleCompartment();
136                        setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
137                        pane
138                                        .add(((VariableUsageVariableCharacterisation5EditPart) childEditPart)
139                                                        .getFigure());
140                        return true;
141                }
142                return false;
143        }
144 
145        /**
146         * @generated
147         */
148        protected boolean removeFixedChild(EditPart childEditPart) {
149                if (childEditPart instanceof VariableUsage5LabelEditPart) {
150                        return true;
151                }
152                if (childEditPart instanceof VariableUsageVariableCharacterisation5EditPart) {
153                        IFigure pane = getPrimaryShape()
154                                        .getFigureParametricParameterUsageRectangleCompartment();
155                        setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
156                        pane
157                                        .remove(((VariableUsageVariableCharacterisation5EditPart) childEditPart)
158                                                        .getFigure());
159                        return true;
160                }
161                return false;
162        }
163 
164        /**
165         * @generated
166         */
167        protected void addChildVisual(EditPart childEditPart, int index) {
168                if (addFixedChild(childEditPart)) {
169                        return;
170                }
171                super.addChildVisual(childEditPart, -1);
172        }
173 
174        /**
175         * @generated
176         */
177        protected void removeChildVisual(EditPart childEditPart) {
178                if (removeFixedChild(childEditPart)) {
179                        return;
180                }
181                super.removeChildVisual(childEditPart);
182        }
183 
184        /**
185         * @generated
186         */
187        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
188                if (editPart instanceof VariableUsageVariableCharacterisation5EditPart) {
189                        return getPrimaryShape()
190                                        .getFigureParametricParameterUsageRectangleCompartment();
191                }
192                return getContentPane();
193        }
194 
195        /**
196         * @generated
197         */
198        protected NodeFigure createNodePlate() {
199                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
200                return result;
201        }
202 
203        /**
204         * Creates figure for this edit part.
205         *
206         * Body of this method does not depend on settings in generation model
207         * so you may safely remove <i>generated</i> tag and modify it.
208         *
209         * @generated
210         */
211        protected NodeFigure createNodeFigure() {
212                NodeFigure figure = createNodePlate();
213                figure.setLayoutManager(new StackLayout());
214                IFigure shape = createNodeShape();
215                figure.add(shape);
216                contentPane = setupContentPane(shape);
217                return figure;
218        }
219 
220        /**
221         * Default implementation treats passed figure as content pane.
222         * Respects layout one may have set for generated figure.
223         * @param nodeShape instance of generated figure class
224         * @generated
225         */
226        protected IFigure setupContentPane(IFigure nodeShape) {
227                if (nodeShape.getLayoutManager() == null) {
228                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
229                        layout.setSpacing(5);
230                        nodeShape.setLayoutManager(layout);
231                }
232                return nodeShape; // use nodeShape itself as contentPane
233        }
234 
235        /**
236         * @generated
237         */
238        public IFigure getContentPane() {
239                if (contentPane != null) {
240                        return contentPane;
241                }
242                return super.getContentPane();
243        }
244 
245        /**
246         * @generated
247         */
248        protected void setForegroundColor(Color color) {
249                if (primaryShape != null) {
250                        primaryShape.setForegroundColor(color);
251                }
252        }
253 
254        /**
255         * @generated
256         */
257        protected void setBackgroundColor(Color color) {
258                if (primaryShape != null) {
259                        primaryShape.setBackgroundColor(color);
260                }
261        }
262 
263        /**
264         * @generated
265         */
266        protected void setLineWidth(int width) {
267                if (primaryShape instanceof Shape) {
268                        ((Shape) primaryShape).setLineWidth(width);
269                }
270        }
271 
272        /**
273         * @generated
274         */
275        protected void setLineType(int style) {
276                if (primaryShape instanceof Shape) {
277                        ((Shape) primaryShape).setLineStyle(style);
278                }
279        }
280 
281        /**
282         * @generated
283         */
284        public EditPart getPrimaryChildEditPart() {
285                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
286                                .getType(VariableUsage5LabelEditPart.VISUAL_ID));
287        }
288 
289        /**
290         * @generated
291         */
292        public EditPart getTargetEditPart(Request request) {
293                if (request instanceof CreateViewAndElementRequest) {
294                        CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request)
295                                        .getViewAndElementDescriptor()
296                                        .getCreateElementRequestAdapter();
297                        IElementType type = (IElementType) adapter
298                                        .getAdapter(IElementType.class);
299                        if (type == PalladioComponentModelElementTypes.VariableCharacterisation_3048) {
300                                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
301                                                .getType(VariableUsageVariableCharacterisation5EditPart.VISUAL_ID));
302                        }
303                }
304                return super.getTargetEditPart(request);
305        }
306 
307        /**
308         * @generated
309         */
310        public class ParametricParameterUsageFigure extends RectangleFigure {
311 
312                /**
313                 * @generated
314                 */
315                private WrappingLabel fFigureVariableUsageReferenceLabelFigure;
316                /**
317                 * @generated
318                 */
319                private RectangleFigure fFigureParametricParameterUsageRectangleCompartment;
320 
321                /**
322                 * @generated
323                 */
324                public ParametricParameterUsageFigure() {
325 
326                        GridLayout layoutThis = new GridLayout();
327                        layoutThis.numColumns = 1;
328                        layoutThis.makeColumnsEqualWidth = true;
329                        layoutThis.horizontalSpacing = 0;
330                        layoutThis.verticalSpacing = 0;
331                        layoutThis.marginWidth = 0;
332                        layoutThis.marginHeight = 0;
333                        this.setLayoutManager(layoutThis);
334 
335                        this.setLineWidth(1);
336                        this.setBackgroundColor(THIS_BACK);
337                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
338                                        getMapMode().DPtoLP(0)));
339                        createContents();
340                }
341 
342                /**
343                 * @generated not
344                 */
345                private void createContents() {
346 
347                        fFigureVariableUsageReferenceLabelFigure = new WrappingLabel();
348                        fFigureVariableUsageReferenceLabelFigure
349                                        .setText(new PCMStoExPrettyPrintVisitor()
350                                                        .prettyPrint(((VariableUsage) resolveSemanticElement())
351                                                                        .getNamedReference__VariableUsage()));
352                        fFigureVariableUsageReferenceLabelFigure
353                                        .setBorder(new MarginBorder(getMapMode().DPtoLP(2),
354                                                        getMapMode().DPtoLP(0), getMapMode().DPtoLP(2),
355                                                        getMapMode().DPtoLP(0)));
356 
357                        GridData constraintFFigureVariableUsageReferenceLabelFigure = new GridData();
358                        constraintFFigureVariableUsageReferenceLabelFigure.verticalAlignment = GridData.CENTER;
359                        constraintFFigureVariableUsageReferenceLabelFigure.horizontalAlignment = GridData.CENTER;
360                        constraintFFigureVariableUsageReferenceLabelFigure.horizontalIndent = 0;
361                        constraintFFigureVariableUsageReferenceLabelFigure.horizontalSpan = 1;
362                        constraintFFigureVariableUsageReferenceLabelFigure.verticalSpan = 1;
363                        constraintFFigureVariableUsageReferenceLabelFigure.grabExcessHorizontalSpace = false;
364                        constraintFFigureVariableUsageReferenceLabelFigure.grabExcessVerticalSpace = false;
365                        this.add(fFigureVariableUsageReferenceLabelFigure,
366                                        constraintFFigureVariableUsageReferenceLabelFigure);
367 
368                        fFigureParametricParameterUsageRectangleCompartment = new RectangleFigure();
369                        fFigureParametricParameterUsageRectangleCompartment.setFill(false);
370                        fFigureParametricParameterUsageRectangleCompartment
371                                        .setOutline(false);
372                        fFigureParametricParameterUsageRectangleCompartment.setLineWidth(1);
373                        fFigureParametricParameterUsageRectangleCompartment
374                                        .setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
375                                                        getMapMode().DPtoLP(0)));
376 
377                        GridData constraintFFigureParametricParameterUsageRectangleCompartment = new GridData();
378                        constraintFFigureParametricParameterUsageRectangleCompartment.verticalAlignment = GridData.FILL;
379                        constraintFFigureParametricParameterUsageRectangleCompartment.horizontalAlignment = GridData.FILL;
380                        constraintFFigureParametricParameterUsageRectangleCompartment.horizontalIndent = 0;
381                        constraintFFigureParametricParameterUsageRectangleCompartment.horizontalSpan = 1;
382                        constraintFFigureParametricParameterUsageRectangleCompartment.verticalSpan = 1;
383                        constraintFFigureParametricParameterUsageRectangleCompartment.grabExcessHorizontalSpace = true;
384                        constraintFFigureParametricParameterUsageRectangleCompartment.grabExcessVerticalSpace = true;
385                        this
386                                        .add(fFigureParametricParameterUsageRectangleCompartment,
387                                                        constraintFFigureParametricParameterUsageRectangleCompartment);
388 
389                }
390 
391                /**
392                 * @generated
393                 */
394                private boolean myUseLocalCoordinates = false;
395 
396                /**
397                 * @generated
398                 */
399                protected boolean useLocalCoordinates() {
400                        return myUseLocalCoordinates;
401                }
402 
403                /**
404                 * @generated
405                 */
406                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
407                        myUseLocalCoordinates = useLocalCoordinates;
408                }
409 
410                /**
411                 * @generated
412                 */
413                public WrappingLabel getFigureVariableUsageReferenceLabelFigure() {
414                        return fFigureVariableUsageReferenceLabelFigure;
415                }
416 
417                /**
418                 * @generated
419                 */
420                public RectangleFigure getFigureParametricParameterUsageRectangleCompartment() {
421                        return fFigureParametricParameterUsageRectangleCompartment;
422                }
423 
424        }
425 
426        /**
427         * @generated
428         */
429        static final Color THIS_BACK = new Color(null, 220, 220, 220);
430 
431}

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