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

nameclass, %method, %block, %line, %
AssemblyContextEditPart.java0%   (0/3)0%   (0/29)0%   (0/508)0%   (0/171)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AssemblyContextEditPart0%   (0/1)0%   (0/20)0%   (0/395)0%   (0/141)
AssemblyContextEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (AssemblyContextEditPart): IMapMode 0%   (0/1)0%   (0/3)0%   (0/1)
addChildVisual (EditPart, int): void 0%   (0/1)0%   (0/10)0%   (0/4)
addFixedChild (EditPart): boolean 0%   (0/1)0%   (0/133)0%   (0/48)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/32)0%   (0/11)
createLayoutEditPolicy (): LayoutEditPolicy 0%   (0/1)0%   (0/7)0%   (0/2)
createMainFigure (): NodeFigure 0%   (0/1)0%   (0/21)0%   (0/6)
createNodePlate (): NodeFigure 0%   (0/1)0%   (0/8)0%   (0/2)
createNodeShape (): IFigure 0%   (0/1)0%   (0/10)0%   (0/2)
getContentPane (): IFigure 0%   (0/1)0%   (0/9)0%   (0/3)
getContentPaneFor (IGraphicalEditPart): IFigure 0%   (0/1)0%   (0/10)0%   (0/3)
getPrimaryChildEditPart (): EditPart 0%   (0/1)0%   (0/5)0%   (0/2)
getPrimaryShape (): AssemblyContextEditPart$AssemblyContextFigure 0%   (0/1)0%   (0/4)0%   (0/1)
removeChildVisual (EditPart): void 0%   (0/1)0%   (0/9)0%   (0/4)
removeFixedChild (EditPart): boolean 0%   (0/1)0%   (0/79)0%   (0/33)
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/15)0%   (0/5)
     
class AssemblyContextEditPart$10%   (0/1)0%   (0/4)0%   (0/33)0%   (0/12)
AssemblyContextEditPart$1 (AssemblyContextEditPart): void 0%   (0/1)0%   (0/6)0%   (0/2)
createChildEditPolicy (EditPart): EditPolicy 0%   (0/1)0%   (0/23)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 AssemblyContextEditPart$AssemblyContextFigure0%   (0/1)0%   (0/5)0%   (0/80)0%   (0/20)
AssemblyContextEditPart$AssemblyContextFigure (AssemblyContextEditPart): void 0%   (0/1)0%   (0/56)0%   (0/12)
createContents (): void 0%   (0/1)0%   (0/14)0%   (0/4)
getFigureAssemblyContextLabelFigure (): WrappingLabel 0%   (0/1)0%   (0/3)0%   (0/1)
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 org.eclipse.draw2d.Graphics;
7import org.eclipse.draw2d.IFigure;
8import org.eclipse.draw2d.PositionConstants;
9import org.eclipse.draw2d.RectangleFigure;
10import org.eclipse.draw2d.Shape;
11import org.eclipse.draw2d.StackLayout;
12import org.eclipse.draw2d.geometry.Dimension;
13import org.eclipse.draw2d.geometry.Point;
14import org.eclipse.gef.EditPart;
15import org.eclipse.gef.EditPolicy;
16import org.eclipse.gef.Request;
17import org.eclipse.gef.commands.Command;
18import org.eclipse.gef.editpolicies.LayoutEditPolicy;
19import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
20import org.eclipse.gef.requests.CreateRequest;
21import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
22import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
23import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
24import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
25import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
26import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
27import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
28import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
29import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
30import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
31import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
32import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
33import org.eclipse.gmf.runtime.notation.View;
34import org.eclipse.swt.graphics.Color;
35 
36import de.uka.ipd.sdq.pcm.gmf.composite.edit.policies.AssemblyContextCanonicalEditPolicy;
37import de.uka.ipd.sdq.pcm.gmf.composite.edit.policies.AssemblyContextItemSemanticEditPolicy;
38import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
39 
40/**
41 * @generated
42 */
43public class AssemblyContextEditPart extends AbstractBorderedShapeEditPart {
44 
45        /**
46         * @generated
47         */
48        public static final int VISUAL_ID = 3006;
49 
50        /**
51         * @generated
52         */
53        protected IFigure contentPane;
54 
55        /**
56         * @generated
57         */
58        protected IFigure primaryShape;
59 
60        /**
61         * @generated
62         */
63        public AssemblyContextEditPart(View view) {
64                super(view);
65        }
66 
67        /**
68         * @generated
69         */
70        protected void createDefaultEditPolicies() {
71                installEditPolicy(EditPolicyRoles.CREATION_ROLE,
72                                new CreationEditPolicy());
73                super.createDefaultEditPolicies();
74                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
75                                new AssemblyContextItemSemanticEditPolicy());
76                installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
77                                new DragDropEditPolicy());
78                installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
79                                new AssemblyContextCanonicalEditPolicy());
80                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
81                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
82                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
83        }
84 
85        /**
86         * @generated
87         */
88        protected LayoutEditPolicy createLayoutEditPolicy() {
89                LayoutEditPolicy lep = new LayoutEditPolicy() {
90 
91                        protected EditPolicy createChildEditPolicy(EditPart child) {
92                                View childView = (View) child.getModel();
93                                switch (PalladioComponentModelVisualIDRegistry
94                                                .getVisualID(childView)) {
95                                case OperationProvidedRoleEditPart.VISUAL_ID:
96                                case OperationRequiredRoleEditPart.VISUAL_ID:
97                                case SourceRoleEditPart.VISUAL_ID:
98                                case SinkRoleEditPart.VISUAL_ID:
99                                case InfrastructureProvidedRoleEditPart.VISUAL_ID:
100                                case InfrastructureRequiredRoleEditPart.VISUAL_ID:
101                                        return new BorderItemSelectionEditPolicy();
102                                }
103                                EditPolicy result = child
104                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
105                                if (result == null) {
106                                        result = new NonResizableEditPolicy();
107                                }
108                                return result;
109                        }
110 
111                        protected Command getMoveChildrenCommand(Request request) {
112                                return null;
113                        }
114 
115                        protected Command getCreateCommand(CreateRequest request) {
116                                return null;
117                        }
118                };
119                return lep;
120        }
121 
122        /**
123         * @generated
124         */
125        protected IFigure createNodeShape() {
126                AssemblyContextFigure figure = new AssemblyContextFigure();
127                return primaryShape = figure;
128        }
129 
130        /**
131         * @generated
132         */
133        public AssemblyContextFigure getPrimaryShape() {
134                return (AssemblyContextFigure) primaryShape;
135        }
136 
137        /**
138         * @generated
139         */
140        protected boolean addFixedChild(EditPart childEditPart) {
141                if (childEditPart instanceof AssemblyContextEntityNameEditPart) {
142                        ((AssemblyContextEntityNameEditPart) childEditPart)
143                                        .setLabel(getPrimaryShape()
144                                                        .getFigureAssemblyContextLabelFigure());
145                        return true;
146                }
147                if (childEditPart instanceof OperationProvidedRoleEditPart) {
148                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
149                                        PositionConstants.WEST);
150                        getBorderedFigure().getBorderItemContainer()
151                                        .add(
152                                                        ((OperationProvidedRoleEditPart) childEditPart)
153                                                                        .getFigure(), locator);
154                        return true;
155                }
156                if (childEditPart instanceof OperationRequiredRoleEditPart) {
157                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
158                                        PositionConstants.EAST);
159                        getBorderedFigure().getBorderItemContainer()
160                                        .add(
161                                                        ((OperationRequiredRoleEditPart) childEditPart)
162                                                                        .getFigure(), locator);
163                        return true;
164                }
165                if (childEditPart instanceof SourceRoleEditPart) {
166                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
167                                        PositionConstants.EAST);
168                        getBorderedFigure().getBorderItemContainer().add(
169                                        ((SourceRoleEditPart) childEditPart).getFigure(), locator);
170                        return true;
171                }
172                if (childEditPart instanceof SinkRoleEditPart) {
173                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
174                                        PositionConstants.WEST);
175                        getBorderedFigure().getBorderItemContainer().add(
176                                        ((SinkRoleEditPart) childEditPart).getFigure(), locator);
177                        return true;
178                }
179                if (childEditPart instanceof InfrastructureProvidedRoleEditPart) {
180                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
181                                        PositionConstants.WEST);
182                        getBorderedFigure().getBorderItemContainer().add(
183                                        ((InfrastructureProvidedRoleEditPart) childEditPart)
184                                                        .getFigure(), locator);
185                        return true;
186                }
187                if (childEditPart instanceof InfrastructureRequiredRoleEditPart) {
188                        BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
189                                        PositionConstants.EAST);
190                        getBorderedFigure().getBorderItemContainer().add(
191                                        ((InfrastructureRequiredRoleEditPart) childEditPart)
192                                                        .getFigure(), locator);
193                        return true;
194                }
195                return false;
196        }
197 
198        /**
199         * @generated
200         */
201        protected boolean removeFixedChild(EditPart childEditPart) {
202                if (childEditPart instanceof AssemblyContextEntityNameEditPart) {
203                        return true;
204                }
205                if (childEditPart instanceof OperationProvidedRoleEditPart) {
206                        getBorderedFigure().getBorderItemContainer()
207                                        .remove(
208                                                        ((OperationProvidedRoleEditPart) childEditPart)
209                                                                        .getFigure());
210                        return true;
211                }
212                if (childEditPart instanceof OperationRequiredRoleEditPart) {
213                        getBorderedFigure().getBorderItemContainer()
214                                        .remove(
215                                                        ((OperationRequiredRoleEditPart) childEditPart)
216                                                                        .getFigure());
217                        return true;
218                }
219                if (childEditPart instanceof SourceRoleEditPart) {
220                        getBorderedFigure().getBorderItemContainer().remove(
221                                        ((SourceRoleEditPart) childEditPart).getFigure());
222                        return true;
223                }
224                if (childEditPart instanceof SinkRoleEditPart) {
225                        getBorderedFigure().getBorderItemContainer().remove(
226                                        ((SinkRoleEditPart) childEditPart).getFigure());
227                        return true;
228                }
229                if (childEditPart instanceof InfrastructureProvidedRoleEditPart) {
230                        getBorderedFigure().getBorderItemContainer().remove(
231                                        ((InfrastructureProvidedRoleEditPart) childEditPart)
232                                                        .getFigure());
233                        return true;
234                }
235                if (childEditPart instanceof InfrastructureRequiredRoleEditPart) {
236                        getBorderedFigure().getBorderItemContainer().remove(
237                                        ((InfrastructureRequiredRoleEditPart) childEditPart)
238                                                        .getFigure());
239                        return true;
240                }
241                return false;
242        }
243 
244        /**
245         * @generated
246         */
247        protected void addChildVisual(EditPart childEditPart, int index) {
248                if (addFixedChild(childEditPart)) {
249                        return;
250                }
251                super.addChildVisual(childEditPart, -1);
252        }
253 
254        /**
255         * @generated
256         */
257        protected void removeChildVisual(EditPart childEditPart) {
258                if (removeFixedChild(childEditPart)) {
259                        return;
260                }
261                super.removeChildVisual(childEditPart);
262        }
263 
264        /**
265         * @generated
266         */
267        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
268                if (editPart instanceof IBorderItemEditPart) {
269                        return getBorderedFigure().getBorderItemContainer();
270                }
271                return getContentPane();
272        }
273 
274        /**
275         * @generated
276         */
277        protected NodeFigure createNodePlate() {
278                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(80, 80);
279                return result;
280        }
281 
282        /**
283         * Creates figure for this edit part.
284         * 
285         * Body of this method does not depend on settings in generation model
286         * so you may safely remove <i>generated</i> tag and modify it.
287         * 
288         * @generated
289         */
290        protected NodeFigure createMainFigure() {
291                NodeFigure figure = createNodePlate();
292                figure.setLayoutManager(new StackLayout());
293                IFigure shape = createNodeShape();
294                figure.add(shape);
295                contentPane = setupContentPane(shape);
296                return figure;
297        }
298 
299        /**
300         * Default implementation treats passed figure as content pane.
301         * Respects layout one may have set for generated figure.
302         * @param nodeShape instance of generated figure class
303         * @generated
304         */
305        protected IFigure setupContentPane(IFigure nodeShape) {
306                if (nodeShape.getLayoutManager() == null) {
307                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
308                        layout.setSpacing(5);
309                        nodeShape.setLayoutManager(layout);
310                }
311                return nodeShape; // use nodeShape itself as contentPane
312        }
313 
314        /**
315         * @generated
316         */
317        public IFigure getContentPane() {
318                if (contentPane != null) {
319                        return contentPane;
320                }
321                return super.getContentPane();
322        }
323 
324        /**
325         * @generated
326         */
327        protected void setForegroundColor(Color color) {
328                if (primaryShape != null) {
329                        primaryShape.setForegroundColor(color);
330                }
331        }
332 
333        /**
334         * @generated
335         */
336        protected void setBackgroundColor(Color color) {
337                if (primaryShape != null) {
338                        primaryShape.setBackgroundColor(color);
339                }
340        }
341 
342        /**
343         * @generated
344         */
345        protected void setLineWidth(int width) {
346                if (primaryShape instanceof Shape) {
347                        ((Shape) primaryShape).setLineWidth(width);
348                }
349        }
350 
351        /**
352         * @generated
353         */
354        protected void setLineType(int style) {
355                if (primaryShape instanceof Shape) {
356                        ((Shape) primaryShape).setLineStyle(style);
357                }
358        }
359 
360        /**
361         * @generated
362         */
363        public EditPart getPrimaryChildEditPart() {
364                return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry
365                                .getType(AssemblyContextEntityNameEditPart.VISUAL_ID));
366        }
367 
368        /**
369         * @generated
370         */
371        public class AssemblyContextFigure extends RectangleFigure {
372                /**
373                 * @generated
374                 */
375                private WrappingLabel fFigureAssemblyContextLabelFigure;
376 
377                /**
378                 * @generated
379                 */
380                public AssemblyContextFigure() {
381                        this.setLineWidth(1);
382                        this.setLineStyle(Graphics.LINE_DASH);
383                        this.setPreferredSize(new Dimension(getMapMode().DPtoLP(80),
384                                        getMapMode().DPtoLP(80)));
385                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
386                                        getMapMode().DPtoLP(0)));
387                        this.setLocation(new Point(getMapMode().DPtoLP(10), getMapMode()
388                                        .DPtoLP(10)));
389                        createContents();
390                }
391 
392                /**
393                 * @generated
394                 */
395                private void createContents() {
396 
397                        fFigureAssemblyContextLabelFigure = new WrappingLabel();
398                        fFigureAssemblyContextLabelFigure.setText("<...>");
399 
400                        this.add(fFigureAssemblyContextLabelFigure);
401 
402                }
403 
404                /**
405                 * @generated
406                 */
407                private boolean myUseLocalCoordinates = false;
408 
409                /**
410                 * @generated
411                 */
412                protected boolean useLocalCoordinates() {
413                        return myUseLocalCoordinates;
414                }
415 
416                /**
417                 * @generated
418                 */
419                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
420                        myUseLocalCoordinates = useLocalCoordinates;
421                }
422 
423                /**
424                 * @generated
425                 */
426                public WrappingLabel getFigureAssemblyContextLabelFigure() {
427                        return fFigureAssemblyContextLabelFigure;
428                }
429 
430        }
431 
432}

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