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

nameclass, %method, %block, %line, %
OperationRequiredRole2EditPart.java0%   (0/4)0%   (0/31)0%   (0/373)0%   (0/121)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationRequiredRole2EditPart0%   (0/1)0%   (0/22)0%   (0/275)0%   (0/96)
OperationRequiredRole2EditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (OperationRequiredRole2EditPart): 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/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 (): OperationRequiredRole2EditPart$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 OperationRequiredRole2EditPart$10%   (0/1)0%   (0/4)0%   (0/34)0%   (0/12)
OperationRequiredRole2EditPart$1 (OperationRequiredRole2EditPart): 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 OperationRequiredRole2EditPart$1$10%   (0/1)0%   (0/2)0%   (0/19)0%   (0/6)
OperationRequiredRole2EditPart$1$1 (OperationRequiredRole2EditPart$1): void 0%   (0/1)0%   (0/6)0%   (0/2)
createSelectionHandles (): List 0%   (0/1)0%   (0/13)0%   (0/4)
     
class OperationRequiredRole2EditPart$OperationRequiredRoleFigure0%   (0/1)0%   (0/3)0%   (0/45)0%   (0/11)
OperationRequiredRole2EditPart$OperationRequiredRoleFigure (OperationRequired... 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.OperationRequiredRole2ItemSemanticEditPolicy;
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 outer system operation required roles.
47 * 
48 * For assembly context operation required roles
49 * @see OperationRequiredRoleEditPart
50 * 
51 * @generated
52 */
53public class OperationRequiredRole2EditPart extends BorderedBorderItemEditPart {
54 
55        /**
56         * size of the figure in LP
57         * 
58         * @generated not
59         */
60        private static final int FIGURE_LOGICAL_SIZE = 60;
61 
62        /**
63         * @generated
64         */
65        public static final int VISUAL_ID = 3012;
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 OperationRequiredRole2EditPart(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 OperationRequiredRole2ItemSemanticEditPolicy());
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 OperationRequiredRoleEntityName2EditPart.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 OperationRequiredRoleEntityName2EditPart) {
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 not
170         */
171        protected NodeFigure createNodePlate() {
172                //DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode()
173                //                .DPtoLP(20), getMapMode().DPtoLP(20));
174 
175                SocketFigure result = new SocketFigure(getMapMode().DPtoLP(
176                                FIGURE_LOGICAL_SIZE), POSITION_TYPE.POS_EXTERNAL);
177 
178                //FIXME: workaround for #154536
179                result.getBounds().setSize(result.getPreferredSize());
180                return result;
181        }
182 
183        /**
184         * @generated
185         */
186        public EditPolicy getPrimaryDragEditPolicy() {
187                EditPolicy result = super.getPrimaryDragEditPolicy();
188                if (result instanceof ResizableEditPolicy) {
189                        ResizableEditPolicy ep = (ResizableEditPolicy) result;
190                        ep.setResizeDirections(PositionConstants.NONE);
191                }
192                return result;
193        }
194 
195        /**
196         * Creates figure for this edit part.
197         * 
198         * Body of this method does not depend on settings in generation model
199         * so you may safely remove <i>generated</i> tag and modify it.
200         * 
201         * @generated not
202         */
203        protected NodeFigure createMainFigure() {
204                NodeFigure figure = createNodePlate();
205                //figure.setLayoutManager(new StackLayout());
206                //IFigure shape = createNodeShape();
207                //figure.add(shape);
208                //contentPane = setupContentPane(shape);
209 
210                return figure;
211        }
212 
213        /**
214         * Default implementation treats passed figure as content pane.
215         * Respects layout one may have set for generated figure.
216         * @param nodeShape instance of generated figure class
217         * @generated
218         */
219        protected IFigure setupContentPane(IFigure nodeShape) {
220                return nodeShape; // use nodeShape itself as contentPane
221        }
222 
223        /**
224         * @generated
225         */
226        public IFigure getContentPane() {
227                if (contentPane != null) {
228                        return contentPane;
229                }
230                return super.getContentPane();
231        }
232 
233        /**
234         * @generated
235         */
236        protected void setForegroundColor(Color color) {
237                if (primaryShape != null) {
238                        primaryShape.setForegroundColor(color);
239                }
240        }
241 
242        /**
243         * @generated
244         */
245        protected void setBackgroundColor(Color color) {
246                if (primaryShape != null) {
247                        primaryShape.setBackgroundColor(color);
248                }
249        }
250 
251        /**
252         * @generated
253         */
254        protected void setLineWidth(int width) {
255                if (primaryShape instanceof Shape) {
256                        ((Shape) primaryShape).setLineWidth(width);
257                }
258        }
259 
260        /**
261         * @generated
262         */
263        protected void setLineType(int style) {
264                if (primaryShape instanceof Shape) {
265                        ((Shape) primaryShape).setLineStyle(style);
266                }
267        }
268 
269        /**
270         * @generated
271         */
272        public EditPart getPrimaryChildEditPart() {
273                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
274                                .getType(OperationRequiredRoleEntityName2EditPart.VISUAL_ID));
275        }
276 
277        /**
278         * @generated
279         */
280        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSource() {
281                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
282                types.add(PalladioComponentModelElementTypes.AssemblyConnector_4004);
283                types
284                                .add(PalladioComponentModelElementTypes.RequiredDelegationConnector_4005);
285                return types;
286        }
287 
288        /**
289         * @generated
290         */
291        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSourceAndTarget(
292                        IGraphicalEditPart targetEditPart) {
293                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
294                if (targetEditPart instanceof OperationProvidedRoleEditPart) {
295                        types
296                                        .add(PalladioComponentModelElementTypes.AssemblyConnector_4004);
297                }
298                if (targetEditPart instanceof OperationProvidedRole2EditPart) {
299                        types
300                                        .add(PalladioComponentModelElementTypes.AssemblyConnector_4004);
301                }
302                if (targetEditPart instanceof OperationRequiredRoleEditPart) {
303                        types
304                                        .add(PalladioComponentModelElementTypes.RequiredDelegationConnector_4005);
305                }
306                if (targetEditPart instanceof de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.OperationRequiredRole2EditPart) {
307                        types
308                                        .add(PalladioComponentModelElementTypes.RequiredDelegationConnector_4005);
309                }
310                return types;
311        }
312 
313        /**
314         * @generated
315         */
316        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForTarget(
317                        IElementType relationshipType) {
318                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
319                if (relationshipType == PalladioComponentModelElementTypes.AssemblyConnector_4004) {
320                        types
321                                        .add(PalladioComponentModelElementTypes.OperationProvidedRole_3007);
322                }
323                if (relationshipType == PalladioComponentModelElementTypes.AssemblyConnector_4004) {
324                        types
325                                        .add(PalladioComponentModelElementTypes.OperationProvidedRole_3011);
326                }
327                if (relationshipType == PalladioComponentModelElementTypes.RequiredDelegationConnector_4005) {
328                        types
329                                        .add(PalladioComponentModelElementTypes.OperationRequiredRole_3008);
330                }
331                if (relationshipType == PalladioComponentModelElementTypes.RequiredDelegationConnector_4005) {
332                        types
333                                        .add(PalladioComponentModelElementTypes.OperationRequiredRole_3012);
334                }
335                return types;
336        }
337 
338        /**
339         * @generated
340         */
341        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() {
342                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
343                types
344                                .add(PalladioComponentModelElementTypes.RequiredDelegationConnector_4005);
345                return types;
346        }
347 
348        /**
349         * @generated
350         */
351        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource(
352                        IElementType relationshipType) {
353                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
354                if (relationshipType == PalladioComponentModelElementTypes.RequiredDelegationConnector_4005) {
355                        types
356                                        .add(PalladioComponentModelElementTypes.OperationRequiredRole_3008);
357                }
358                if (relationshipType == PalladioComponentModelElementTypes.RequiredDelegationConnector_4005) {
359                        types
360                                        .add(PalladioComponentModelElementTypes.OperationRequiredRole_3012);
361                }
362                return types;
363        }
364 
365        /**
366         * @generated
367         */
368        public class OperationRequiredRoleFigure extends Ellipse {
369 
370                /**
371                 * @generated
372                 */
373                public OperationRequiredRoleFigure() {
374                        this.setLineWidth(1);
375                        this.setPreferredSize(new Dimension(getMapMode().DPtoLP(20),
376                                        getMapMode().DPtoLP(20)));
377                        this.setLocation(new Point(getMapMode().DPtoLP(50), getMapMode()
378                                        .DPtoLP(50)));
379                }
380 
381                /**
382                 * @generated
383                 */
384                private boolean myUseLocalCoordinates = false;
385 
386                /**
387                 * @generated
388                 */
389                protected boolean useLocalCoordinates() {
390                        return myUseLocalCoordinates;
391                }
392 
393                /**
394                 * @generated
395                 */
396                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
397                        myUseLocalCoordinates = useLocalCoordinates;
398                }
399 
400        }
401 
402}

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