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

COVERAGE SUMMARY FOR SOURCE FILE [LoopEditPart.java]

nameclass, %method, %block, %line, %
LoopEditPart.java0%   (0/3)0%   (0/35)0%   (0/618)0%   (0/196)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LoopEditPart0%   (0/1)0%   (0/25)0%   (0/360)0%   (0/125)
LoopEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (LoopEditPart): 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/32)0%   (0/11)
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)
getMARelTypesOnSource (): List 0%   (0/1)0%   (0/10)0%   (0/4)
getMARelTypesOnSourceAndTarget (IGraphicalEditPart): List 0%   (0/1)0%   (0/48)0%   (0/20)
getMARelTypesOnTarget (): List 0%   (0/1)0%   (0/10)0%   (0/4)
getMATypesForSource (IElementType): List 0%   (0/1)0%   (0/48)0%   (0/15)
getMATypesForTarget (IElementType): List 0%   (0/1)0%   (0/48)0%   (0/15)
getPrimaryChildEditPart (): EditPart 0%   (0/1)0%   (0/5)0%   (0/2)
getPrimaryShape (): LoopEditPart$UsageLoopFigure 0%   (0/1)0%   (0/4)0%   (0/1)
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 LoopEditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
LoopEditPart$1 (LoopEditPart): 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 LoopEditPart$UsageLoopFigure0%   (0/1)0%   (0/6)0%   (0/236)0%   (0/64)
LoopEditPart$UsageLoopFigure (LoopEditPart): void 0%   (0/1)0%   (0/65)0%   (0/17)
add (IFigure, Object, int): void 0%   (0/1)0%   (0/34)0%   (0/12)
createContents (): void 0%   (0/1)0%   (0/127)0%   (0/31)
getFigureUsageLoopIterationsLabelFigure (): 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, SDQ, IPD, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.edit.parts;
5 
6import java.util.ArrayList;
7import java.util.List;
8 
9import org.eclipse.draw2d.GridData;
10import org.eclipse.draw2d.GridLayout;
11import org.eclipse.draw2d.IFigure;
12import org.eclipse.draw2d.MarginBorder;
13import org.eclipse.draw2d.RoundedRectangle;
14import org.eclipse.draw2d.Shape;
15import org.eclipse.draw2d.StackLayout;
16import org.eclipse.draw2d.geometry.Dimension;
17import org.eclipse.gef.EditPart;
18import org.eclipse.gef.EditPolicy;
19import org.eclipse.gef.Request;
20import org.eclipse.gef.commands.Command;
21import org.eclipse.gef.editpolicies.LayoutEditPolicy;
22import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
23import org.eclipse.gef.requests.CreateRequest;
24import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
25import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
26import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
27import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
28import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.SWT;
36import org.eclipse.swt.graphics.Color;
37 
38import de.uka.ipd.sdq.pcm.gmf.usage.edit.policies.LoopCanonicalEditPolicy;
39import de.uka.ipd.sdq.pcm.gmf.usage.edit.policies.LoopItemSemanticEditPolicy;
40import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry;
41import de.uka.ipd.sdq.pcm.gmf.usage.providers.PalladioComponentModelElementTypes;
42 
43/**
44 * @generated
45 */
46public class LoopEditPart extends ShapeNodeEditPart {
47 
48        /**
49         * @generated
50         */
51        public static final int VISUAL_ID = 3005;
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 LoopEditPart(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 LoopItemSemanticEditPolicy());
79                installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
80                                new DragDropEditPolicy());
81                installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
82                                new LoopCanonicalEditPolicy());
83                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
84                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
85                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
86        }
87 
88        /**
89         * @generated
90         */
91        protected LayoutEditPolicy createLayoutEditPolicy() {
92                LayoutEditPolicy lep = new LayoutEditPolicy() {
93 
94                        protected EditPolicy createChildEditPolicy(EditPart child) {
95                                EditPolicy result = child
96                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
97                                if (result == null) {
98                                        result = new NonResizableEditPolicy();
99                                }
100                                return result;
101                        }
102 
103                        protected Command getMoveChildrenCommand(Request request) {
104                                return null;
105                        }
106 
107                        protected Command getCreateCommand(CreateRequest request) {
108                                return null;
109                        }
110                };
111                return lep;
112        }
113 
114        /**
115         * @generated
116         */
117        protected IFigure createNodeShape() {
118                UsageLoopFigure figure = new UsageLoopFigure();
119                return primaryShape = figure;
120        }
121 
122        /**
123         * @generated
124         */
125        public UsageLoopFigure getPrimaryShape() {
126                return (UsageLoopFigure) primaryShape;
127        }
128 
129        /**
130         * @generated
131         */
132        protected boolean addFixedChild(EditPart childEditPart) {
133                if (childEditPart instanceof UsageLoopIterationsLabelEditPart) {
134                        ((UsageLoopIterationsLabelEditPart) childEditPart)
135                                        .setLabel(getPrimaryShape()
136                                                        .getFigureUsageLoopIterationsLabelFigure());
137                        return true;
138                }
139                return false;
140        }
141 
142        /**
143         * @generated
144         */
145        protected boolean removeFixedChild(EditPart childEditPart) {
146                if (childEditPart instanceof UsageLoopIterationsLabelEditPart) {
147                        return true;
148                }
149                return false;
150        }
151 
152        /**
153         * @generated
154         */
155        protected void addChildVisual(EditPart childEditPart, int index) {
156                if (addFixedChild(childEditPart)) {
157                        return;
158                }
159                super.addChildVisual(childEditPart, -1);
160        }
161 
162        /**
163         * @generated
164         */
165        protected void removeChildVisual(EditPart childEditPart) {
166                if (removeFixedChild(childEditPart)) {
167                        return;
168                }
169                super.removeChildVisual(childEditPart);
170        }
171 
172        /**
173         * @generated
174         */
175        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
176                return getContentPane();
177        }
178 
179        /**
180         * @generated
181         */
182        protected NodeFigure createNodePlate() {
183                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
184                return result;
185        }
186 
187        /**
188         * Creates figure for this edit part.
189         * 
190         * Body of this method does not depend on settings in generation model
191         * so you may safely remove <i>generated</i> tag and modify it.
192         * 
193         * @generated
194         */
195        protected NodeFigure createNodeFigure() {
196                NodeFigure figure = createNodePlate();
197                figure.setLayoutManager(new StackLayout());
198                IFigure shape = createNodeShape();
199                figure.add(shape);
200                contentPane = setupContentPane(shape);
201                return figure;
202        }
203 
204        /**
205         * Default implementation treats passed figure as content pane.
206         * Respects layout one may have set for generated figure.
207         * @param nodeShape instance of generated figure class
208         * @generated
209         */
210        protected IFigure setupContentPane(IFigure nodeShape) {
211                if (nodeShape.getLayoutManager() == null) {
212                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
213                        layout.setSpacing(5);
214                        nodeShape.setLayoutManager(layout);
215                }
216                return nodeShape; // use nodeShape itself as contentPane
217        }
218 
219        /**
220         * @generated
221         */
222        public IFigure getContentPane() {
223                if (contentPane != null) {
224                        return contentPane;
225                }
226                return super.getContentPane();
227        }
228 
229        /**
230         * @generated
231         */
232        protected void setForegroundColor(Color color) {
233                if (primaryShape != null) {
234                        primaryShape.setForegroundColor(color);
235                }
236        }
237 
238        /**
239         * @generated
240         */
241        protected void setBackgroundColor(Color color) {
242                if (primaryShape != null) {
243                        primaryShape.setBackgroundColor(color);
244                }
245        }
246 
247        /**
248         * @generated
249         */
250        protected void setLineWidth(int width) {
251                if (primaryShape instanceof Shape) {
252                        ((Shape) primaryShape).setLineWidth(width);
253                }
254        }
255 
256        /**
257         * @generated
258         */
259        protected void setLineType(int style) {
260                if (primaryShape instanceof Shape) {
261                        ((Shape) primaryShape).setLineStyle(style);
262                }
263        }
264 
265        /**
266         * @generated
267         */
268        public EditPart getPrimaryChildEditPart() {
269                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
270                                .getType(UsageLoopIterationsLabelEditPart.VISUAL_ID));
271        }
272 
273        /**
274         * @generated
275         */
276        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSource() {
277                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
278                types
279                                .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
280                return types;
281        }
282 
283        /**
284         * @generated
285         */
286        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSourceAndTarget(
287                        IGraphicalEditPart targetEditPart) {
288                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
289                if (targetEditPart instanceof StartEditPart) {
290                        types
291                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
292                }
293                if (targetEditPart instanceof StopEditPart) {
294                        types
295                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
296                }
297                if (targetEditPart instanceof EntryLevelSystemCallEditPart) {
298                        types
299                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
300                }
301                if (targetEditPart instanceof de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.LoopEditPart) {
302                        types
303                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
304                }
305                if (targetEditPart instanceof BranchEditPart) {
306                        types
307                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
308                }
309                if (targetEditPart instanceof DelayEditPart) {
310                        types
311                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
312                }
313                return types;
314        }
315 
316        /**
317         * @generated
318         */
319        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForTarget(
320                        IElementType relationshipType) {
321                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
322                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
323                        types.add(PalladioComponentModelElementTypes.Start_3001);
324                }
325                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
326                        types.add(PalladioComponentModelElementTypes.Stop_3002);
327                }
328                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
329                        types
330                                        .add(PalladioComponentModelElementTypes.EntryLevelSystemCall_3003);
331                }
332                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
333                        types.add(PalladioComponentModelElementTypes.Loop_3005);
334                }
335                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
336                        types.add(PalladioComponentModelElementTypes.Branch_3008);
337                }
338                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
339                        types.add(PalladioComponentModelElementTypes.Delay_3017);
340                }
341                return types;
342        }
343 
344        /**
345         * @generated
346         */
347        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() {
348                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
349                types
350                                .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
351                return types;
352        }
353 
354        /**
355         * @generated
356         */
357        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource(
358                        IElementType relationshipType) {
359                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
360                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
361                        types.add(PalladioComponentModelElementTypes.Start_3001);
362                }
363                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
364                        types.add(PalladioComponentModelElementTypes.Stop_3002);
365                }
366                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
367                        types
368                                        .add(PalladioComponentModelElementTypes.EntryLevelSystemCall_3003);
369                }
370                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
371                        types.add(PalladioComponentModelElementTypes.Loop_3005);
372                }
373                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
374                        types.add(PalladioComponentModelElementTypes.Branch_3008);
375                }
376                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
377                        types.add(PalladioComponentModelElementTypes.Delay_3017);
378                }
379                return types;
380        }
381 
382        /**
383         * @generated
384         */
385        public class UsageLoopFigure extends RoundedRectangle {
386                /**
387                 * @generated
388                 */
389                private WrappingLabel fFigureUsageLoopIterationsLabelFigure;
390 
391                /**
392                 * @generated
393                 */
394                public UsageLoopFigure() {
395 
396                        GridLayout layoutThis = new GridLayout();
397                        layoutThis.numColumns = 1;
398                        layoutThis.makeColumnsEqualWidth = true;
399                        layoutThis.horizontalSpacing = 0;
400                        layoutThis.verticalSpacing = 0;
401                        layoutThis.marginWidth = 0;
402                        layoutThis.marginHeight = 0;
403                        this.setLayoutManager(layoutThis);
404 
405                        this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(8),
406                                        getMapMode().DPtoLP(8)));
407                        this.setLineWidth(1);
408                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
409                                        getMapMode().DPtoLP(0)));
410                        createContents();
411                }
412 
413                /**
414                 * @generated
415                 */
416                private void createContents() {
417 
418                        WrappingLabel usageLoopStereotypeLabelFigure0 = new WrappingLabel();
419                        usageLoopStereotypeLabelFigure0.setText("<<Loop>>");
420                        usageLoopStereotypeLabelFigure0.setBorder(new MarginBorder(
421                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0),
422                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0)));
423 
424                        GridData constraintUsageLoopStereotypeLabelFigure0 = new GridData();
425                        constraintUsageLoopStereotypeLabelFigure0.verticalAlignment = GridData.BEGINNING;
426                        constraintUsageLoopStereotypeLabelFigure0.horizontalAlignment = GridData.CENTER;
427                        constraintUsageLoopStereotypeLabelFigure0.horizontalIndent = 0;
428                        constraintUsageLoopStereotypeLabelFigure0.horizontalSpan = 1;
429                        constraintUsageLoopStereotypeLabelFigure0.verticalSpan = 1;
430                        constraintUsageLoopStereotypeLabelFigure0.grabExcessHorizontalSpace = true;
431                        constraintUsageLoopStereotypeLabelFigure0.grabExcessVerticalSpace = false;
432                        this.add(usageLoopStereotypeLabelFigure0,
433                                        constraintUsageLoopStereotypeLabelFigure0);
434 
435                        fFigureUsageLoopIterationsLabelFigure = new WrappingLabel();
436                        fFigureUsageLoopIterationsLabelFigure.setText("");
437                        fFigureUsageLoopIterationsLabelFigure.setBorder(new MarginBorder(
438                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0),
439                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0)));
440 
441                        GridData constraintFFigureUsageLoopIterationsLabelFigure = new GridData();
442                        constraintFFigureUsageLoopIterationsLabelFigure.verticalAlignment = GridData.CENTER;
443                        constraintFFigureUsageLoopIterationsLabelFigure.horizontalAlignment = GridData.CENTER;
444                        constraintFFigureUsageLoopIterationsLabelFigure.horizontalIndent = 0;
445                        constraintFFigureUsageLoopIterationsLabelFigure.horizontalSpan = 1;
446                        constraintFFigureUsageLoopIterationsLabelFigure.verticalSpan = 1;
447                        constraintFFigureUsageLoopIterationsLabelFigure.grabExcessHorizontalSpace = false;
448                        constraintFFigureUsageLoopIterationsLabelFigure.grabExcessVerticalSpace = false;
449                        this.add(fFigureUsageLoopIterationsLabelFigure,
450                                        constraintFFigureUsageLoopIterationsLabelFigure);
451 
452                }
453 
454                /**
455                 * @generated
456                 */
457                public WrappingLabel getFigureUsageLoopIterationsLabelFigure() {
458                        return fFigureUsageLoopIterationsLabelFigure;
459                }
460 
461                /**
462                 * @generated
463                 */
464                private boolean myUseLocalCoordinates = false;
465 
466                /**
467                 * @generated
468                 */
469                protected boolean useLocalCoordinates() {
470                        return myUseLocalCoordinates;
471                }
472 
473                /**
474                 * @generated
475                 */
476                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
477                        myUseLocalCoordinates = useLocalCoordinates;
478                }
479 
480                @Override
481                public void add(IFigure figure, Object constraint, int index) {
482                        Object newConstraint = constraint;
483                        if (newConstraint == null) {
484                                GridData layout = new GridData();
485                                layout.grabExcessHorizontalSpace = true;
486                                layout.grabExcessVerticalSpace = true;
487                                layout.horizontalAlignment = SWT.FILL;
488                                layout.verticalAlignment = SWT.FILL;
489                                layout.horizontalSpan = 1;
490                                layout.verticalSpan = 1;
491 
492                                newConstraint = layout;
493                        }
494                        super.add(figure, newConstraint, index);
495                }
496 
497        }
498 
499}

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