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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelEditPartFactory.java]

nameclass, %method, %block, %line, %
PalladioComponentModelEditPartFactory.java0%   (0/3)0%   (0/10)0%   (0/215)0%   (0/48)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelEditPartFactory0%   (0/1)0%   (0/4)0%   (0/72)0%   (0/16)
PalladioComponentModelEditPartFactory (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createEditPart (EditPart, Object): EditPart 0%   (0/1)0%   (0/49)0%   (0/11)
createUnrecognizedEditPart (EditPart, Object): EditPart 0%   (0/1)0%   (0/2)0%   (0/1)
getTextCellEditorLocator (ITextAwareEditPart): CellEditorLocator 0%   (0/1)0%   (0/18)0%   (0/3)
     
class PalladioComponentModelEditPartFactory$LabelCellEditorLocator0%   (0/1)0%   (0/3)0%   (0/61)0%   (0/14)
PalladioComponentModelEditPartFactory$LabelCellEditorLocator (Label): void 0%   (0/1)0%   (0/6)0%   (0/3)
getLabel (): Label 0%   (0/1)0%   (0/3)0%   (0/1)
relocate (CellEditor): void 0%   (0/1)0%   (0/52)0%   (0/10)
     
class PalladioComponentModelEditPartFactory$TextCellEditorLocator0%   (0/1)0%   (0/3)0%   (0/82)0%   (0/18)
PalladioComponentModelEditPartFactory$TextCellEditorLocator (WrapLabel): void 0%   (0/1)0%   (0/6)0%   (0/3)
getWrapLabel (): WrapLabel 0%   (0/1)0%   (0/3)0%   (0/1)
relocate (CellEditor): void 0%   (0/1)0%   (0/73)0%   (0/14)

1/*
2 * Copyright 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts;
5 
6import org.eclipse.draw2d.FigureUtilities;
7import org.eclipse.draw2d.Label;
8import org.eclipse.draw2d.geometry.Dimension;
9import org.eclipse.draw2d.geometry.Rectangle;
10import org.eclipse.gef.EditPart;
11import org.eclipse.gef.EditPartFactory;
12import org.eclipse.gef.tools.CellEditorLocator;
13import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
14import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
15import org.eclipse.gmf.runtime.notation.View;
16import org.eclipse.jface.viewers.CellEditor;
17import org.eclipse.swt.SWT;
18import org.eclipse.swt.widgets.Text;
19 
20import de.uka.ipd.sdq.pcm.gmf.allocation.part.PalladioComponentModelVisualIDRegistry;
21 
22/**
23 * @generated
24 */
25public class PalladioComponentModelEditPartFactory implements EditPartFactory {
26 
27        /**
28         * @generated
29         */
30        public EditPart createEditPart(EditPart context, Object model) {
31                if (model instanceof View) {
32                        View view = (View) model;
33                        switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) {
34 
35                        case AllocationEditPart.VISUAL_ID:
36                                return new AllocationEditPart(view);
37 
38                        case ResourceContainerEditPart.VISUAL_ID:
39                                return new ResourceContainerEditPart(view);
40 
41                        case ResourceContainerEntityNameEditPart.VISUAL_ID:
42                                return new ResourceContainerEntityNameEditPart(view);
43 
44                        case AllocationContextEditPart.VISUAL_ID:
45                                return new AllocationContextEditPart(view);
46 
47                        case AllocationContextEntityNameEditPart.VISUAL_ID:
48                                return new AllocationContextEntityNameEditPart(view);
49 
50                        case AllocationComponentLabelEditPart.VISUAL_ID:
51                                return new AllocationComponentLabelEditPart(view);
52 
53                        case ResourceContainerAllocationCompartmentEditPart.VISUAL_ID:
54                                return new ResourceContainerAllocationCompartmentEditPart(view);
55                        }
56                }
57                return createUnrecognizedEditPart(context, model);
58        }
59 
60        /**
61         * @generated
62         */
63        private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
64                // Handle creation of unrecognized child node EditParts here
65                return null;
66        }
67 
68        /**
69         * @generated
70         */
71        public static CellEditorLocator getTextCellEditorLocator(
72                        ITextAwareEditPart source) {
73                if (source.getFigure() instanceof WrapLabel)
74                        return new TextCellEditorLocator((WrapLabel) source.getFigure());
75                else {
76                        return new LabelCellEditorLocator((Label) source.getFigure());
77                }
78        }
79 
80        /**
81         * @generated
82         */
83        static private class TextCellEditorLocator implements CellEditorLocator {
84 
85                /**
86                 * @generated
87                 */
88                private WrapLabel wrapLabel;
89 
90                /**
91                 * @generated
92                 */
93                public TextCellEditorLocator(WrapLabel wrapLabel) {
94                        this.wrapLabel = wrapLabel;
95                }
96 
97                /**
98                 * @generated
99                 */
100                public WrapLabel getWrapLabel() {
101                        return wrapLabel;
102                }
103 
104                /**
105                 * @generated
106                 */
107                public void relocate(CellEditor celleditor) {
108                        Text text = (Text) celleditor.getControl();
109                        Rectangle rect = getWrapLabel().getTextBounds().getCopy();
110                        getWrapLabel().translateToAbsolute(rect);
111                        if (getWrapLabel().isTextWrapped()
112                                        && getWrapLabel().getText().length() > 0) {
113                                rect.setSize(new Dimension(text.computeSize(rect.width,
114                                                SWT.DEFAULT)));
115                        } else {
116                                int avr = FigureUtilities.getFontMetrics(text.getFont())
117                                                .getAverageCharWidth();
118                                rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
119                                                SWT.DEFAULT)).expand(avr * 2, 0));
120                        }
121                        if (!rect.equals(new Rectangle(text.getBounds()))) {
122                                text.setBounds(rect.x, rect.y, rect.width, rect.height);
123                        }
124                }
125 
126        }
127 
128        /**
129         * @generated
130         */
131        private static class LabelCellEditorLocator implements CellEditorLocator {
132 
133                /**
134                 * @generated
135                 */
136                private Label label;
137 
138                /**
139                 * @generated
140                 */
141                public LabelCellEditorLocator(Label label) {
142                        this.label = label;
143                }
144 
145                /**
146                 * @generated
147                 */
148                public Label getLabel() {
149                        return label;
150                }
151 
152                /**
153                 * @generated
154                 */
155                public void relocate(CellEditor celleditor) {
156                        Text text = (Text) celleditor.getControl();
157                        Rectangle rect = getLabel().getTextBounds().getCopy();
158                        getLabel().translateToAbsolute(rect);
159                        int avr = FigureUtilities.getFontMetrics(text.getFont())
160                                        .getAverageCharWidth();
161                        rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
162                                        SWT.DEFAULT)).expand(avr * 2, 0));
163                        if (!rect.equals(new Rectangle(text.getBounds()))) {
164                                text.setBounds(rect.x, rect.y, rect.width, rect.height);
165                        }
166                }
167        }
168}

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