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

nameclass, %method, %block, %line, %
OperationRequiredRoleEditPart.java0%   (0/4)0%   (0/31)0%   (0/382)0%   (0/122)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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