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

nameclass, %method, %block, %line, %
InfrastructureCallEditPart.java0%   (0/3)0%   (0/32)0%   (0/565)0%   (0/181)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureCallEditPart0%   (0/1)0%   (0/21)0%   (0/268)0%   (0/99)
InfrastructureCallEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (InfrastructureCallEditPart): 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/42)0%   (0/19)
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 (): InfrastructureCallEditPart$InfrastructureCallFigure 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/30)0%   (0/13)
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 InfrastructureCallEditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
InfrastructureCallEditPart$1 (InfrastructureCallEditPart): 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 InfrastructureCallEditPart$InfrastructureCallFigure0%   (0/1)0%   (0/7)0%   (0/275)0%   (0/75)
InfrastructureCallEditPart$InfrastructureCallFigure (InfrastructureCallEditPa... 0%   (0/1)0%   (0/65)0%   (0/17)
createContents (): void 0%   (0/1)0%   (0/194)0%   (0/52)
getFigureInfrastructureCallNumberOfCallsLabel (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureInfrastructureCallTargetLabel (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureInfrastructureCallVariableUsagesCompartment (): RectangleFigure 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.RoundedRectangle;
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.DragDropEditPolicy;
27import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
28import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
29import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
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.seff.edit.policies.InfrastructureCallItemSemanticEditPolicy;
38import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry;
39import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes;
40 
41/**
42 * @generated
43 */
44public class InfrastructureCallEditPart extends ShapeNodeEditPart {
45 
46        /**
47         * @generated
48         */
49        public static final int VISUAL_ID = 3053;
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 InfrastructureCallEditPart(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 InfrastructureCallItemSemanticEditPolicy());
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                InfrastructureCallFigure figure = new InfrastructureCallFigure();
113                return primaryShape = figure;
114        }
115 
116        /**
117         * @generated
118         */
119        public InfrastructureCallFigure getPrimaryShape() {
120                return (InfrastructureCallFigure) primaryShape;
121        }
122 
123        /**
124         * @generated
125         */
126        protected boolean addFixedChild(EditPart childEditPart) {
127                if (childEditPart instanceof InfrastructureCallNumberOfCallsLabelEditPart) {
128                        ((InfrastructureCallNumberOfCallsLabelEditPart) childEditPart)
129                                        .setLabel(getPrimaryShape()
130                                                        .getFigureInfrastructureCallNumberOfCallsLabel());
131                        return true;
132                }
133                if (childEditPart instanceof InfrastructureCallTargetLabelEditPart) {
134                        ((InfrastructureCallTargetLabelEditPart) childEditPart)
135                                        .setLabel(getPrimaryShape()
136                                                        .getFigureInfrastructureCallTargetLabel());
137                        return true;
138                }
139                if (childEditPart instanceof InfrastructureCallInfrastructureCallInputVariableUsagesEditPart) {
140                        IFigure pane = getPrimaryShape()
141                                        .getFigureInfrastructureCallVariableUsagesCompartment();
142                        setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
143                        pane
144                                        .add(((InfrastructureCallInfrastructureCallInputVariableUsagesEditPart) childEditPart)
145                                                        .getFigure());
146                        return true;
147                }
148                return false;
149        }
150 
151        /**
152         * @generated
153         */
154        protected boolean removeFixedChild(EditPart childEditPart) {
155                if (childEditPart instanceof InfrastructureCallNumberOfCallsLabelEditPart) {
156                        return true;
157                }
158                if (childEditPart instanceof InfrastructureCallTargetLabelEditPart) {
159                        return true;
160                }
161                if (childEditPart instanceof InfrastructureCallInfrastructureCallInputVariableUsagesEditPart) {
162                        IFigure pane = getPrimaryShape()
163                                        .getFigureInfrastructureCallVariableUsagesCompartment();
164                        setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
165                        pane
166                                        .remove(((InfrastructureCallInfrastructureCallInputVariableUsagesEditPart) childEditPart)
167                                                        .getFigure());
168                        return true;
169                }
170                return false;
171        }
172 
173        /**
174         * @generated
175         */
176        protected void addChildVisual(EditPart childEditPart, int index) {
177                if (addFixedChild(childEditPart)) {
178                        return;
179                }
180                super.addChildVisual(childEditPart, -1);
181        }
182 
183        /**
184         * @generated
185         */
186        protected void removeChildVisual(EditPart childEditPart) {
187                if (removeFixedChild(childEditPart)) {
188                        return;
189                }
190                super.removeChildVisual(childEditPart);
191        }
192 
193        /**
194         * @generated
195         */
196        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
197                if (editPart instanceof InfrastructureCallInfrastructureCallInputVariableUsagesEditPart) {
198                        return getPrimaryShape()
199                                        .getFigureInfrastructureCallVariableUsagesCompartment();
200                }
201                return getContentPane();
202        }
203 
204        /**
205         * @generated
206         */
207        protected NodeFigure createNodePlate() {
208                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
209                return result;
210        }
211 
212        /**
213         * Creates figure for this edit part.
214         * 
215         * Body of this method does not depend on settings in generation model
216         * so you may safely remove <i>generated</i> tag and modify it.
217         * 
218         * @generated
219         */
220        protected NodeFigure createNodeFigure() {
221                NodeFigure figure = createNodePlate();
222                figure.setLayoutManager(new StackLayout());
223                IFigure shape = createNodeShape();
224                figure.add(shape);
225                contentPane = setupContentPane(shape);
226                return figure;
227        }
228 
229        /**
230         * Default implementation treats passed figure as content pane.
231         * Respects layout one may have set for generated figure.
232         * @param nodeShape instance of generated figure class
233         * @generated
234         */
235        protected IFigure setupContentPane(IFigure nodeShape) {
236                if (nodeShape.getLayoutManager() == null) {
237                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
238                        layout.setSpacing(5);
239                        nodeShape.setLayoutManager(layout);
240                }
241                return nodeShape; // use nodeShape itself as contentPane
242        }
243 
244        /**
245         * @generated
246         */
247        public IFigure getContentPane() {
248                if (contentPane != null) {
249                        return contentPane;
250                }
251                return super.getContentPane();
252        }
253 
254        /**
255         * @generated
256         */
257        protected void setForegroundColor(Color color) {
258                if (primaryShape != null) {
259                        primaryShape.setForegroundColor(color);
260                }
261        }
262 
263        /**
264         * @generated
265         */
266        protected void setBackgroundColor(Color color) {
267                if (primaryShape != null) {
268                        primaryShape.setBackgroundColor(color);
269                }
270        }
271 
272        /**
273         * @generated
274         */
275        protected void setLineWidth(int width) {
276                if (primaryShape instanceof Shape) {
277                        ((Shape) primaryShape).setLineWidth(width);
278                }
279        }
280 
281        /**
282         * @generated
283         */
284        protected void setLineType(int style) {
285                if (primaryShape instanceof Shape) {
286                        ((Shape) primaryShape).setLineStyle(style);
287                }
288        }
289 
290        /**
291         * @generated
292         */
293        public EditPart getPrimaryChildEditPart() {
294                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
295                                .getType(InfrastructureCallNumberOfCallsLabelEditPart.VISUAL_ID));
296        }
297 
298        /**
299         * @generated
300         */
301        public EditPart getTargetEditPart(Request request) {
302                if (request instanceof CreateViewAndElementRequest) {
303                        CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request)
304                                        .getViewAndElementDescriptor()
305                                        .getCreateElementRequestAdapter();
306                        IElementType type = (IElementType) adapter
307                                        .getAdapter(IElementType.class);
308                        if (type == PalladioComponentModelElementTypes.VariableUsage_3054) {
309                                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
310                                                .getType(InfrastructureCallInfrastructureCallInputVariableUsagesEditPart.VISUAL_ID));
311                        }
312                }
313                return super.getTargetEditPart(request);
314        }
315 
316        /**
317         * @generated
318         */
319        public class InfrastructureCallFigure extends RoundedRectangle {
320 
321                /**
322                 * @generated
323                 */
324                private RectangleFigure fFigureInfrastructureCallVariableUsagesCompartment;
325                /**
326                 * @generated
327                 */
328                private WrappingLabel fFigureInfrastructureCallTargetLabel;
329                /**
330                 * @generated
331                 */
332                private WrappingLabel fFigureInfrastructureCallNumberOfCallsLabel;
333 
334                /**
335                 * @generated
336                 */
337                public InfrastructureCallFigure() {
338 
339                        GridLayout layoutThis = new GridLayout();
340                        layoutThis.numColumns = 2;
341                        layoutThis.makeColumnsEqualWidth = false;
342                        layoutThis.horizontalSpacing = 0;
343                        layoutThis.verticalSpacing = 0;
344                        layoutThis.marginWidth = 0;
345                        layoutThis.marginHeight = 0;
346                        this.setLayoutManager(layoutThis);
347 
348                        this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(8),
349                                        getMapMode().DPtoLP(8)));
350                        this.setLineWidth(1);
351                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
352                                        getMapMode().DPtoLP(0)));
353                        createContents();
354                }
355 
356                /**
357                 * @generated
358                 */
359                private void createContents() {
360 
361                        fFigureInfrastructureCallNumberOfCallsLabel = new WrappingLabel();
362                        fFigureInfrastructureCallNumberOfCallsLabel.setText("x");
363                        fFigureInfrastructureCallNumberOfCallsLabel
364                                        .setBorder(new MarginBorder(getMapMode().DPtoLP(2),
365                                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(2),
366                                                        getMapMode().DPtoLP(2)));
367 
368                        GridData constraintFFigureInfrastructureCallNumberOfCallsLabel = new GridData();
369                        constraintFFigureInfrastructureCallNumberOfCallsLabel.verticalAlignment = GridData.CENTER;
370                        constraintFFigureInfrastructureCallNumberOfCallsLabel.horizontalAlignment = GridData.BEGINNING;
371                        constraintFFigureInfrastructureCallNumberOfCallsLabel.horizontalIndent = 0;
372                        constraintFFigureInfrastructureCallNumberOfCallsLabel.horizontalSpan = 1;
373                        constraintFFigureInfrastructureCallNumberOfCallsLabel.verticalSpan = 1;
374                        constraintFFigureInfrastructureCallNumberOfCallsLabel.grabExcessHorizontalSpace = false;
375                        constraintFFigureInfrastructureCallNumberOfCallsLabel.grabExcessVerticalSpace = false;
376                        this.add(fFigureInfrastructureCallNumberOfCallsLabel,
377                                        constraintFFigureInfrastructureCallNumberOfCallsLabel);
378 
379                        fFigureInfrastructureCallTargetLabel = new WrappingLabel();
380                        fFigureInfrastructureCallTargetLabel
381                                        .setText("infrastructureCallTargetLabel");
382                        fFigureInfrastructureCallTargetLabel.setBorder(new MarginBorder(
383                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0),
384                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(2)));
385 
386                        GridData constraintFFigureInfrastructureCallTargetLabel = new GridData();
387                        constraintFFigureInfrastructureCallTargetLabel.verticalAlignment = GridData.CENTER;
388                        constraintFFigureInfrastructureCallTargetLabel.horizontalAlignment = GridData.BEGINNING;
389                        constraintFFigureInfrastructureCallTargetLabel.horizontalIndent = 0;
390                        constraintFFigureInfrastructureCallTargetLabel.horizontalSpan = 1;
391                        constraintFFigureInfrastructureCallTargetLabel.verticalSpan = 1;
392                        constraintFFigureInfrastructureCallTargetLabel.grabExcessHorizontalSpace = false;
393                        constraintFFigureInfrastructureCallTargetLabel.grabExcessVerticalSpace = false;
394                        this.add(fFigureInfrastructureCallTargetLabel,
395                                        constraintFFigureInfrastructureCallTargetLabel);
396 
397                        fFigureInfrastructureCallVariableUsagesCompartment = new RectangleFigure();
398                        fFigureInfrastructureCallVariableUsagesCompartment.setFill(false);
399                        fFigureInfrastructureCallVariableUsagesCompartment
400                                        .setOutline(false);
401                        fFigureInfrastructureCallVariableUsagesCompartment.setLineWidth(1);
402                        fFigureInfrastructureCallVariableUsagesCompartment
403                                        .setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
404                                                        getMapMode().DPtoLP(0)));
405 
406                        GridData constraintFFigureInfrastructureCallVariableUsagesCompartment = new GridData();
407                        constraintFFigureInfrastructureCallVariableUsagesCompartment.verticalAlignment = GridData.FILL;
408                        constraintFFigureInfrastructureCallVariableUsagesCompartment.horizontalAlignment = GridData.FILL;
409                        constraintFFigureInfrastructureCallVariableUsagesCompartment.horizontalIndent = 0;
410                        constraintFFigureInfrastructureCallVariableUsagesCompartment.horizontalSpan = 2;
411                        constraintFFigureInfrastructureCallVariableUsagesCompartment.verticalSpan = 1;
412                        constraintFFigureInfrastructureCallVariableUsagesCompartment.grabExcessHorizontalSpace = true;
413                        constraintFFigureInfrastructureCallVariableUsagesCompartment.grabExcessVerticalSpace = true;
414                        this
415                                        .add(fFigureInfrastructureCallVariableUsagesCompartment,
416                                                        constraintFFigureInfrastructureCallVariableUsagesCompartment);
417 
418                }
419 
420                /**
421                 * @generated
422                 */
423                private boolean myUseLocalCoordinates = false;
424 
425                /**
426                 * @generated
427                 */
428                protected boolean useLocalCoordinates() {
429                        return myUseLocalCoordinates;
430                }
431 
432                /**
433                 * @generated
434                 */
435                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
436                        myUseLocalCoordinates = useLocalCoordinates;
437                }
438 
439                /**
440                 * @generated
441                 */
442                public RectangleFigure getFigureInfrastructureCallVariableUsagesCompartment() {
443                        return fFigureInfrastructureCallVariableUsagesCompartment;
444                }
445 
446                /**
447                 * @generated
448                 */
449                public WrappingLabel getFigureInfrastructureCallTargetLabel() {
450                        return fFigureInfrastructureCallTargetLabel;
451                }
452 
453                /**
454                 * @generated
455                 */
456                public WrappingLabel getFigureInfrastructureCallNumberOfCallsLabel() {
457                        return fFigureInfrastructureCallNumberOfCallsLabel;
458                }
459 
460        }
461 
462}

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