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

COVERAGE SUMMARY FOR SOURCE FILE [OperationProvidedRole2EditPart.java]

nameclass, %method, %block, %line, %
OperationProvidedRole2EditPart.java0%   (0/4)0%   (0/31)0%   (0/372)0%   (0/117)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationProvidedRole2EditPart0%   (0/1)0%   (0/22)0%   (0/261)0%   (0/90)
OperationProvidedRole2EditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (OperationProvidedRole2EditPart): IMapMode 0%   (0/1)0%   (0/3)0%   (0/1)
addBorderItem (IFigure, IBorderItemEditPart): void 0%   (0/1)0%   (0/28)0%   (0/7)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/19)0%   (0/7)
createLayoutEditPolicy (): LayoutEditPolicy 0%   (0/1)0%   (0/7)0%   (0/2)
createMainFigure (): NodeFigure 0%   (0/1)0%   (0/5)0%   (0/2)
createNodePlate (): NodeFigure 0%   (0/1)0%   (0/17)0%   (0/4)
createNodeShape (): IFigure 0%   (0/1)0%   (0/10)0%   (0/2)
getContentPane (): IFigure 0%   (0/1)0%   (0/9)0%   (0/3)
getMARelTypesOnSource (): List 0%   (0/1)0%   (0/10)0%   (0/4)
getMARelTypesOnSourceAndTarget (IGraphicalEditPart): List 0%   (0/1)0%   (0/20)0%   (0/8)
getMARelTypesOnTarget (): List 0%   (0/1)0%   (0/14)0%   (0/5)
getMATypesForSource (IElementType): List 0%   (0/1)0%   (0/34)0%   (0/14)
getMATypesForTarget (IElementType): List 0%   (0/1)0%   (0/20)0%   (0/8)
getPrimaryChildEditPart (): EditPart 0%   (0/1)0%   (0/5)0%   (0/2)
getPrimaryDragEditPolicy (): EditPolicy 0%   (0/1)0%   (0/14)0%   (0/5)
getPrimaryShape (): OperationProvidedRole2EditPart$OperationProvidedRoleFigure 0%   (0/1)0%   (0/4)0%   (0/1)
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/2)0%   (0/1)
     
class OperationProvidedRole2EditPart$10%   (0/1)0%   (0/4)0%   (0/34)0%   (0/12)
OperationProvidedRole2EditPart$1 (OperationProvidedRole2EditPart): void 0%   (0/1)0%   (0/6)0%   (0/2)
createChildEditPolicy (EditPart): EditPolicy 0%   (0/1)0%   (0/24)0%   (0/8)
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 OperationProvidedRole2EditPart$1$10%   (0/1)0%   (0/2)0%   (0/19)0%   (0/6)
OperationProvidedRole2EditPart$1$1 (OperationProvidedRole2EditPart$1): void 0%   (0/1)0%   (0/6)0%   (0/2)
createSelectionHandles (): List 0%   (0/1)0%   (0/13)0%   (0/4)
     
class OperationProvidedRole2EditPart$OperationProvidedRoleFigure0%   (0/1)0%   (0/3)0%   (0/58)0%   (0/13)
OperationProvidedRole2EditPart$OperationProvidedRoleFigure (OperationProvided... 0%   (0/1)0%   (0/51)0%   (0/10)
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, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.parts;
5 
6import java.util.ArrayList;
7import java.util.Collections;
8import java.util.List;
9 
10import org.eclipse.draw2d.IFigure;
11import org.eclipse.draw2d.PositionConstants;
12import org.eclipse.draw2d.RectangleFigure;
13import org.eclipse.draw2d.Shape;
14import org.eclipse.draw2d.StackLayout;
15import org.eclipse.draw2d.geometry.Dimension;
16import org.eclipse.draw2d.geometry.Point;
17import org.eclipse.gef.EditPart;
18import org.eclipse.gef.EditPolicy;
19import org.eclipse.gef.GraphicalEditPart;
20import org.eclipse.gef.Request;
21import org.eclipse.gef.commands.Command;
22import org.eclipse.gef.editpolicies.LayoutEditPolicy;
23import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
24import org.eclipse.gef.editpolicies.ResizableEditPolicy;
25import org.eclipse.gef.handles.MoveHandle;
26import org.eclipse.gef.requests.CreateRequest;
27import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart;
28import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
29import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
30import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
31import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
32import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
33import org.eclipse.gmf.runtime.emf.type.core.IElementType;
34import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
35import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
36import org.eclipse.gmf.runtime.notation.View;
37import org.eclipse.swt.graphics.Color;
38 
39import de.uka.ipd.sdq.pcm.gmf.composite.BallFigure;
40import de.uka.ipd.sdq.pcm.gmf.composite.AbstractBorderFigure.POSITION_TYPE;
41import de.uka.ipd.sdq.pcm.gmf.composite.edit.policies.OperationProvidedRole2ItemSemanticEditPolicy;
42import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
43import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
44 
45/**
46 * Operation Provided Role Edit part for outer system provided roles.
47 * 
48 * For assembly context operation provided roles: 
49 * @see OperationProvidedRoleEditPart
50 * 
51 * @generated
52 */
53public class OperationProvidedRole2EditPart extends BorderedBorderItemEditPart {
54 
55        /**
56         * size of the figure in LP
57         * @generated not
58         */
59        private static final int FIGURE_LOGICAL_SIZE = 60;
60 
61        /**
62         * @generated
63         */
64        public static final int VISUAL_ID = 3011;
65 
66        /**
67         * @generated
68         */
69        protected IFigure contentPane;
70 
71        /**
72         * @generated
73         */
74        protected IFigure primaryShape;
75 
76        /**
77         * @generated
78         */
79        public OperationProvidedRole2EditPart(View view) {
80                super(view);
81        }
82 
83        /**
84         * @generated
85         */
86        protected void createDefaultEditPolicies() {
87                super.createDefaultEditPolicies();
88                installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
89                                getPrimaryDragEditPolicy());
90                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
91                                new OperationProvidedRole2ItemSemanticEditPolicy());
92                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
93                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
94                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
95        }
96 
97        /**
98         * @generated
99         */
100        protected LayoutEditPolicy createLayoutEditPolicy() {
101                LayoutEditPolicy lep = new LayoutEditPolicy() {
102 
103                        protected EditPolicy createChildEditPolicy(EditPart child) {
104                                View childView = (View) child.getModel();
105                                switch (PalladioComponentModelVisualIDRegistry
106                                                .getVisualID(childView)) {
107                                case OperationProvidedRoleEntityName2EditPart.VISUAL_ID:
108                                        return new BorderItemSelectionEditPolicy() {
109 
110                                                protected List createSelectionHandles() {
111                                                        MoveHandle mh = new MoveHandle(
112                                                                        (GraphicalEditPart) getHost());
113                                                        mh.setBorder(null);
114                                                        return Collections.singletonList(mh);
115                                                }
116                                        };
117                                }
118                                EditPolicy result = child
119                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
120                                if (result == null) {
121                                        result = new NonResizableEditPolicy();
122                                }
123                                return result;
124                        }
125 
126                        protected Command getMoveChildrenCommand(Request request) {
127                                return null;
128                        }
129 
130                        protected Command getCreateCommand(CreateRequest request) {
131                                return null;
132                        }
133                };
134                return lep;
135        }
136 
137        /**
138         * @generated
139         */
140        protected IFigure createNodeShape() {
141                OperationProvidedRoleFigure figure = new OperationProvidedRoleFigure();
142                return primaryShape = figure;
143        }
144 
145        /**
146         * @generated
147         */
148        public OperationProvidedRoleFigure getPrimaryShape() {
149                return (OperationProvidedRoleFigure) primaryShape;
150        }
151 
152        /**
153         * @generated
154         */
155        protected void addBorderItem(IFigure borderItemContainer,
156                        IBorderItemEditPart borderItemEditPart) {
157                if (borderItemEditPart instanceof OperationProvidedRoleEntityName2EditPart) {
158                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
159                                        PositionConstants.SOUTH);
160                        locator.setBorderItemOffset(new Dimension(-20, -20));
161                        borderItemContainer.add(borderItemEditPart.getFigure(), locator);
162                } else {
163                        super.addBorderItem(borderItemContainer, borderItemEditPart);
164                }
165        }
166 
167        /**
168         * Create the Node Plate.
169         * This triggers the drawing of the ball figure
170         * 
171         * @generated not
172         */
173        protected NodeFigure createNodePlate() {
174                //DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode()
175                //                .DPtoLP(20), getMapMode().DPtoLP(20));
176 
177                BallFigure result = new BallFigure(getMapMode().DPtoLP(
178                                FIGURE_LOGICAL_SIZE), POSITION_TYPE.POS_EXTERNAL);
179 
180                //FIXME: workaround for #154536
181                result.getBounds().setSize(result.getPreferredSize());
182                return result;
183        }
184 
185        /**
186         * @generated
187         */
188        public EditPolicy getPrimaryDragEditPolicy() {
189                EditPolicy result = super.getPrimaryDragEditPolicy();
190                if (result instanceof ResizableEditPolicy) {
191                        ResizableEditPolicy ep = (ResizableEditPolicy) result;
192                        ep.setResizeDirections(PositionConstants.NONE);
193                }
194                return result;
195        }
196 
197        /**
198         * Creates figure for this edit part.
199         * 
200         * Call the createNodePlate() method
201         * 
202         * Original generated Comment:
203         * Body of this method does not depend on settings in generation model
204         * so you may safely remove <i>generated</i> tag and modify it.
205         * 
206         * @generated not
207         */
208        protected NodeFigure createMainFigure() {
209                NodeFigure figure = createNodePlate();
210                //figure.setLayoutManager(new StackLayout());
211                //IFigure shape = createNodeShape();
212                //figure.add(shape);
213                //contentPane = setupContentPane(shape);
214 
215                return figure;
216        }
217 
218        /**
219         * Default implementation treats passed figure as content pane.
220         * Respects layout one may have set for generated figure.
221         * @param nodeShape instance of generated figure class
222         * @generated
223         */
224        protected IFigure setupContentPane(IFigure nodeShape) {
225                return nodeShape; // use nodeShape itself as contentPane
226        }
227 
228        /**
229         * @generated
230         */
231        public IFigure getContentPane() {
232                if (contentPane != null) {
233                        return contentPane;
234                }
235                return super.getContentPane();
236        }
237 
238        /**
239         * @generated
240         */
241        protected void setForegroundColor(Color color) {
242                if (primaryShape != null) {
243                        primaryShape.setForegroundColor(color);
244                }
245        }
246 
247        /**
248         * @generated
249         */
250        protected void setBackgroundColor(Color color) {
251                if (primaryShape != null) {
252                        primaryShape.setBackgroundColor(color);
253                }
254        }
255 
256        /**
257         * @generated
258         */
259        protected void setLineWidth(int width) {
260                if (primaryShape instanceof Shape) {
261                        ((Shape) primaryShape).setLineWidth(width);
262                }
263        }
264 
265        /**
266         * @generated
267         */
268        protected void setLineType(int style) {
269                if (primaryShape instanceof Shape) {
270                        ((Shape) primaryShape).setLineStyle(style);
271                }
272        }
273 
274        /**
275         * @generated
276         */
277        public EditPart getPrimaryChildEditPart() {
278                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
279                                .getType(OperationProvidedRoleEntityName2EditPart.VISUAL_ID));
280        }
281 
282        /**
283         * @generated
284         */
285        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSource() {
286                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
287                types
288                                .add(PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006);
289                return types;
290        }
291 
292        /**
293         * @generated
294         */
295        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSourceAndTarget(
296                        IGraphicalEditPart targetEditPart) {
297                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
298                if (targetEditPart instanceof OperationProvidedRoleEditPart) {
299                        types
300                                        .add(PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006);
301                }
302                if (targetEditPart instanceof de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.OperationProvidedRole2EditPart) {
303                        types
304                                        .add(PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006);
305                }
306                return types;
307        }
308 
309        /**
310         * @generated
311         */
312        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForTarget(
313                        IElementType relationshipType) {
314                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
315                if (relationshipType == PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006) {
316                        types
317                                        .add(PalladioComponentModelElementTypes.OperationProvidedRole_3007);
318                }
319                if (relationshipType == PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006) {
320                        types
321                                        .add(PalladioComponentModelElementTypes.OperationProvidedRole_3011);
322                }
323                return types;
324        }
325 
326        /**
327         * @generated
328         */
329        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() {
330                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
331                types.add(PalladioComponentModelElementTypes.AssemblyConnector_4004);
332                types
333                                .add(PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006);
334                return types;
335        }
336 
337        /**
338         * @generated
339         */
340        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource(
341                        IElementType relationshipType) {
342                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
343                if (relationshipType == PalladioComponentModelElementTypes.AssemblyConnector_4004) {
344                        types
345                                        .add(PalladioComponentModelElementTypes.OperationRequiredRole_3008);
346                }
347                if (relationshipType == PalladioComponentModelElementTypes.AssemblyConnector_4004) {
348                        types
349                                        .add(PalladioComponentModelElementTypes.OperationRequiredRole_3012);
350                }
351                if (relationshipType == PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006) {
352                        types
353                                        .add(PalladioComponentModelElementTypes.OperationProvidedRole_3007);
354                }
355                if (relationshipType == PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006) {
356                        types
357                                        .add(PalladioComponentModelElementTypes.OperationProvidedRole_3011);
358                }
359                return types;
360        }
361 
362        /**
363         * @generated
364         */
365        public class OperationProvidedRoleFigure extends RectangleFigure {
366 
367                /**
368                 * @generated
369                 */
370                public OperationProvidedRoleFigure() {
371                        this.setLineWidth(1);
372                        this.setPreferredSize(new Dimension(getMapMode().DPtoLP(20),
373                                        getMapMode().DPtoLP(20)));
374                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
375                                        getMapMode().DPtoLP(0)));
376                        this.setLocation(new Point(getMapMode().DPtoLP(40), getMapMode()
377                                        .DPtoLP(40)));
378                }
379 
380                /**
381                 * @generated
382                 */
383                private boolean myUseLocalCoordinates = false;
384 
385                /**
386                 * @generated
387                 */
388                protected boolean useLocalCoordinates() {
389                        return myUseLocalCoordinates;
390                }
391 
392                /**
393                 * @generated
394                 */
395                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
396                        myUseLocalCoordinates = useLocalCoordinates;
397                }
398 
399        }
400 
401}

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