EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.usage.edit.parts]

COVERAGE SUMMARY FOR SOURCE FILE [BranchEditPart.java]

nameclass, %method, %block, %line, %
BranchEditPart.java0%   (0/3)0%   (0/34)0%   (0/593)0%   (0/187)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BranchEditPart0%   (0/1)0%   (0/24)0%   (0/364)0%   (0/126)
BranchEditPart (View): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (BranchEditPart): 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/20)0%   (0/8)
createDefaultEditPolicies (): void 0%   (0/1)0%   (0/14)0%   (0/5)
createLayoutEditPolicy (): LayoutEditPolicy 0%   (0/1)0%   (0/7)0%   (0/2)
createNodeFigure (): 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)
getMARelTypesOnSource (): List 0%   (0/1)0%   (0/10)0%   (0/4)
getMARelTypesOnSourceAndTarget (IGraphicalEditPart): List 0%   (0/1)0%   (0/48)0%   (0/20)
getMARelTypesOnTarget (): List 0%   (0/1)0%   (0/10)0%   (0/4)
getMATypesForSource (IElementType): List 0%   (0/1)0%   (0/48)0%   (0/15)
getMATypesForTarget (IElementType): List 0%   (0/1)0%   (0/48)0%   (0/15)
getPrimaryShape (): BranchEditPart$UsageBranchFigure 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/20)0%   (0/8)
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 BranchEditPart$10%   (0/1)0%   (0/4)0%   (0/22)0%   (0/9)
BranchEditPart$1 (BranchEditPart): void 0%   (0/1)0%   (0/6)0%   (0/2)
createChildEditPolicy (EditPart): EditPolicy 0%   (0/1)0%   (0/12)0%   (0/5)
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 BranchEditPart$UsageBranchFigure0%   (0/1)0%   (0/6)0%   (0/207)0%   (0/54)
BranchEditPart$UsageBranchFigure (BranchEditPart): void 0%   (0/1)0%   (0/65)0%   (0/17)
createContents (): void 0%   (0/1)0%   (0/129)0%   (0/32)
getFigureBranchCompartment (): RectangleFigure 0%   (0/1)0%   (0/3)0%   (0/1)
getFigureUsageBranchStereotypeLabelFigure (): 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, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.edit.parts;
5 
6import java.util.ArrayList;
7import java.util.List;
8 
9import org.eclipse.draw2d.GridData;
10import org.eclipse.draw2d.GridLayout;
11import org.eclipse.draw2d.IFigure;
12import org.eclipse.draw2d.MarginBorder;
13import org.eclipse.draw2d.RectangleFigure;
14import org.eclipse.draw2d.RoundedRectangle;
15import org.eclipse.draw2d.Shape;
16import org.eclipse.draw2d.StackLayout;
17import org.eclipse.draw2d.geometry.Dimension;
18import org.eclipse.gef.EditPart;
19import org.eclipse.gef.EditPolicy;
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.requests.CreateRequest;
25import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
26import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
27import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
28import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
29import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
30import org.eclipse.gmf.runtime.emf.type.core.IElementType;
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.usage.edit.policies.BranchItemSemanticEditPolicy;
37import de.uka.ipd.sdq.pcm.gmf.usage.providers.PalladioComponentModelElementTypes;
38 
39/**
40 * @generated
41 */
42public class BranchEditPart extends ShapeNodeEditPart {
43 
44        /**
45         * @generated
46         */
47        public static final int VISUAL_ID = 3008;
48 
49        /**
50         * @generated
51         */
52        protected IFigure contentPane;
53 
54        /**
55         * @generated
56         */
57        protected IFigure primaryShape;
58 
59        /**
60         * @generated
61         */
62        public BranchEditPart(View view) {
63                super(view);
64        }
65 
66        /**
67         * @generated
68         */
69        protected void createDefaultEditPolicies() {
70                super.createDefaultEditPolicies();
71                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
72                                new BranchItemSemanticEditPolicy());
73                installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
74                // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
75                // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
76        }
77 
78        /**
79         * @generated
80         */
81        protected LayoutEditPolicy createLayoutEditPolicy() {
82                LayoutEditPolicy lep = new LayoutEditPolicy() {
83 
84                        protected EditPolicy createChildEditPolicy(EditPart child) {
85                                EditPolicy result = child
86                                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
87                                if (result == null) {
88                                        result = new NonResizableEditPolicy();
89                                }
90                                return result;
91                        }
92 
93                        protected Command getMoveChildrenCommand(Request request) {
94                                return null;
95                        }
96 
97                        protected Command getCreateCommand(CreateRequest request) {
98                                return null;
99                        }
100                };
101                return lep;
102        }
103 
104        /**
105         * @generated
106         */
107        protected IFigure createNodeShape() {
108                UsageBranchFigure figure = new UsageBranchFigure();
109                return primaryShape = figure;
110        }
111 
112        /**
113         * @generated
114         */
115        public UsageBranchFigure getPrimaryShape() {
116                return (UsageBranchFigure) primaryShape;
117        }
118 
119        /**
120         * @generated
121         */
122        protected boolean addFixedChild(EditPart childEditPart) {
123                if (childEditPart instanceof BranchUsageBranchTransitionsCompartmentEditPart) {
124                        IFigure pane = getPrimaryShape().getFigureBranchCompartment();
125                        setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
126                        pane
127                                        .add(((BranchUsageBranchTransitionsCompartmentEditPart) childEditPart)
128                                                        .getFigure());
129                        return true;
130                }
131                return false;
132        }
133 
134        /**
135         * @generated
136         */
137        protected boolean removeFixedChild(EditPart childEditPart) {
138                if (childEditPart instanceof BranchUsageBranchTransitionsCompartmentEditPart) {
139                        IFigure pane = getPrimaryShape().getFigureBranchCompartment();
140                        setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
141                        pane
142                                        .remove(((BranchUsageBranchTransitionsCompartmentEditPart) childEditPart)
143                                                        .getFigure());
144                        return true;
145                }
146                return false;
147        }
148 
149        /**
150         * @generated
151         */
152        protected void addChildVisual(EditPart childEditPart, int index) {
153                if (addFixedChild(childEditPart)) {
154                        return;
155                }
156                super.addChildVisual(childEditPart, -1);
157        }
158 
159        /**
160         * @generated
161         */
162        protected void removeChildVisual(EditPart childEditPart) {
163                if (removeFixedChild(childEditPart)) {
164                        return;
165                }
166                super.removeChildVisual(childEditPart);
167        }
168 
169        /**
170         * @generated
171         */
172        protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
173                if (editPart instanceof BranchUsageBranchTransitionsCompartmentEditPart) {
174                        return getPrimaryShape().getFigureBranchCompartment();
175                }
176                return getContentPane();
177        }
178 
179        /**
180         * @generated
181         */
182        protected NodeFigure createNodePlate() {
183                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
184                return result;
185        }
186 
187        /**
188         * Creates figure for this edit part.
189         * 
190         * Body of this method does not depend on settings in generation model
191         * so you may safely remove <i>generated</i> tag and modify it.
192         * 
193         * @generated
194         */
195        protected NodeFigure createNodeFigure() {
196                NodeFigure figure = createNodePlate();
197                figure.setLayoutManager(new StackLayout());
198                IFigure shape = createNodeShape();
199                figure.add(shape);
200                contentPane = setupContentPane(shape);
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                if (nodeShape.getLayoutManager() == null) {
212                        ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
213                        layout.setSpacing(5);
214                        nodeShape.setLayoutManager(layout);
215                }
216                return nodeShape; // use nodeShape itself as contentPane
217        }
218 
219        /**
220         * @generated
221         */
222        public IFigure getContentPane() {
223                if (contentPane != null) {
224                        return contentPane;
225                }
226                return super.getContentPane();
227        }
228 
229        /**
230         * @generated
231         */
232        protected void setForegroundColor(Color color) {
233                if (primaryShape != null) {
234                        primaryShape.setForegroundColor(color);
235                }
236        }
237 
238        /**
239         * @generated
240         */
241        protected void setBackgroundColor(Color color) {
242                if (primaryShape != null) {
243                        primaryShape.setBackgroundColor(color);
244                }
245        }
246 
247        /**
248         * @generated
249         */
250        protected void setLineWidth(int width) {
251                if (primaryShape instanceof Shape) {
252                        ((Shape) primaryShape).setLineWidth(width);
253                }
254        }
255 
256        /**
257         * @generated
258         */
259        protected void setLineType(int style) {
260                if (primaryShape instanceof Shape) {
261                        ((Shape) primaryShape).setLineStyle(style);
262                }
263        }
264 
265        /**
266         * @generated
267         */
268        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSource() {
269                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
270                types
271                                .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
272                return types;
273        }
274 
275        /**
276         * @generated
277         */
278        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSourceAndTarget(
279                        IGraphicalEditPart targetEditPart) {
280                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
281                if (targetEditPart instanceof StartEditPart) {
282                        types
283                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
284                }
285                if (targetEditPart instanceof StopEditPart) {
286                        types
287                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
288                }
289                if (targetEditPart instanceof EntryLevelSystemCallEditPart) {
290                        types
291                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
292                }
293                if (targetEditPart instanceof LoopEditPart) {
294                        types
295                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
296                }
297                if (targetEditPart instanceof de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchEditPart) {
298                        types
299                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
300                }
301                if (targetEditPart instanceof DelayEditPart) {
302                        types
303                                        .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
304                }
305                return types;
306        }
307 
308        /**
309         * @generated
310         */
311        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForTarget(
312                        IElementType relationshipType) {
313                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
314                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
315                        types.add(PalladioComponentModelElementTypes.Start_3001);
316                }
317                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
318                        types.add(PalladioComponentModelElementTypes.Stop_3002);
319                }
320                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
321                        types
322                                        .add(PalladioComponentModelElementTypes.EntryLevelSystemCall_3003);
323                }
324                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
325                        types.add(PalladioComponentModelElementTypes.Loop_3005);
326                }
327                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
328                        types.add(PalladioComponentModelElementTypes.Branch_3008);
329                }
330                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
331                        types.add(PalladioComponentModelElementTypes.Delay_3017);
332                }
333                return types;
334        }
335 
336        /**
337         * @generated
338         */
339        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() {
340                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
341                types
342                                .add(PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002);
343                return types;
344        }
345 
346        /**
347         * @generated
348         */
349        public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource(
350                        IElementType relationshipType) {
351                List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
352                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
353                        types.add(PalladioComponentModelElementTypes.Start_3001);
354                }
355                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
356                        types.add(PalladioComponentModelElementTypes.Stop_3002);
357                }
358                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
359                        types
360                                        .add(PalladioComponentModelElementTypes.EntryLevelSystemCall_3003);
361                }
362                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
363                        types.add(PalladioComponentModelElementTypes.Loop_3005);
364                }
365                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
366                        types.add(PalladioComponentModelElementTypes.Branch_3008);
367                }
368                if (relationshipType == PalladioComponentModelElementTypes.AbstractUserActionSuccessor_4002) {
369                        types.add(PalladioComponentModelElementTypes.Delay_3017);
370                }
371                return types;
372        }
373 
374        /**
375         * @generated
376         */
377        public class UsageBranchFigure extends RoundedRectangle {
378                /**
379                 * @generated
380                 */
381                private WrappingLabel fFigureUsageBranchStereotypeLabelFigure;
382 
383                /**
384                 * @generated
385                 */
386                private RectangleFigure fFigureBranchCompartment;
387 
388                /**
389                 * @generated
390                 */
391                public UsageBranchFigure() {
392 
393                        GridLayout layoutThis = new GridLayout();
394                        layoutThis.numColumns = 1;
395                        layoutThis.makeColumnsEqualWidth = true;
396                        layoutThis.horizontalSpacing = 0;
397                        layoutThis.verticalSpacing = 0;
398                        layoutThis.marginWidth = 0;
399                        layoutThis.marginHeight = 0;
400                        this.setLayoutManager(layoutThis);
401 
402                        this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(8),
403                                        getMapMode().DPtoLP(8)));
404                        this.setLineWidth(1);
405                        this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0),
406                                        getMapMode().DPtoLP(0)));
407                        createContents();
408                }
409 
410                /**
411                 * @generated
412                 */
413                private void createContents() {
414 
415                        fFigureUsageBranchStereotypeLabelFigure = new WrappingLabel();
416                        fFigureUsageBranchStereotypeLabelFigure.setText("<<Branch>>");
417                        fFigureUsageBranchStereotypeLabelFigure.setBorder(new MarginBorder(
418                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0),
419                                        getMapMode().DPtoLP(2), getMapMode().DPtoLP(0)));
420 
421                        GridData constraintFFigureUsageBranchStereotypeLabelFigure = new GridData();
422                        constraintFFigureUsageBranchStereotypeLabelFigure.verticalAlignment = GridData.BEGINNING;
423                        constraintFFigureUsageBranchStereotypeLabelFigure.horizontalAlignment = GridData.CENTER;
424                        constraintFFigureUsageBranchStereotypeLabelFigure.horizontalIndent = 0;
425                        constraintFFigureUsageBranchStereotypeLabelFigure.horizontalSpan = 1;
426                        constraintFFigureUsageBranchStereotypeLabelFigure.verticalSpan = 1;
427                        constraintFFigureUsageBranchStereotypeLabelFigure.grabExcessHorizontalSpace = true;
428                        constraintFFigureUsageBranchStereotypeLabelFigure.grabExcessVerticalSpace = false;
429                        this.add(fFigureUsageBranchStereotypeLabelFigure,
430                                        constraintFFigureUsageBranchStereotypeLabelFigure);
431 
432                        fFigureBranchCompartment = new RectangleFigure();
433                        fFigureBranchCompartment.setFill(false);
434                        fFigureBranchCompartment.setOutline(false);
435                        fFigureBranchCompartment.setLineWidth(1);
436                        fFigureBranchCompartment.setMinimumSize(new Dimension(getMapMode()
437                                        .DPtoLP(0), getMapMode().DPtoLP(0)));
438 
439                        GridData constraintFFigureBranchCompartment = new GridData();
440                        constraintFFigureBranchCompartment.verticalAlignment = GridData.FILL;
441                        constraintFFigureBranchCompartment.horizontalAlignment = GridData.FILL;
442                        constraintFFigureBranchCompartment.horizontalIndent = 0;
443                        constraintFFigureBranchCompartment.horizontalSpan = 1;
444                        constraintFFigureBranchCompartment.verticalSpan = 1;
445                        constraintFFigureBranchCompartment.grabExcessHorizontalSpace = true;
446                        constraintFFigureBranchCompartment.grabExcessVerticalSpace = true;
447                        this.add(fFigureBranchCompartment,
448                                        constraintFFigureBranchCompartment);
449 
450                }
451 
452                /**
453                 * @generated
454                 */
455                public WrappingLabel getFigureUsageBranchStereotypeLabelFigure() {
456                        return fFigureUsageBranchStereotypeLabelFigure;
457                }
458 
459                /**
460                 * @generated
461                 */
462                public RectangleFigure getFigureBranchCompartment() {
463                        return fFigureBranchCompartment;
464                }
465 
466                /**
467                 * @generated
468                 */
469                private boolean myUseLocalCoordinates = false;
470 
471                /**
472                 * @generated
473                 */
474                protected boolean useLocalCoordinates() {
475                        return myUseLocalCoordinates;
476                }
477 
478                /**
479                 * @generated
480                 */
481                protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
482                        myUseLocalCoordinates = useLocalCoordinates;
483                }
484 
485        }
486 
487}

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