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

nameclass, %method, %block, %line, %
InfrastructureRequiredRoleEditPart.java0%   (0/4)0%   (0/29)0%   (0/319)0%   (0/93)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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