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

nameclass, %method, %block, %line, %
InfrastructureProvidedRoleEditPart.java0%   (0/4)0%   (0/28)0%   (0/306)0%   (0/88)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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