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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelEditPartFactory.java]

nameclass, %method, %block, %line, %
PalladioComponentModelEditPartFactory.java0%   (0/3)0%   (0/10)0%   (0/420)0%   (0/97)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelEditPartFactory0%   (0/1)0%   (0/4)0%   (0/277)0%   (0/65)
PalladioComponentModelEditPartFactory (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createEditPart (EditPart, Object): EditPart 0%   (0/1)0%   (0/254)0%   (0/60)
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 (WrappingLabel): ... 0%   (0/1)0%   (0/6)0%   (0/3)
getWrapLabel (): WrappingLabel 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, IPD, SDQ, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.repository.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.WrappingLabel;
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.repository.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 RepositoryEditPart.VISUAL_ID:
36                                return new RepositoryEditPart(view);
37 
38                        case OperationInterfaceEditPart.VISUAL_ID:
39                                return new OperationInterfaceEditPart(view);
40 
41                        case OperationInterfaceEntityNameEditPart.VISUAL_ID:
42                                return new OperationInterfaceEntityNameEditPart(view);
43 
44                        case EventGroupEditPart.VISUAL_ID:
45                                return new EventGroupEditPart(view);
46 
47                        case EventGroupEntityNameEditPart.VISUAL_ID:
48                                return new EventGroupEntityNameEditPart(view);
49 
50                        case BasicComponentEditPart.VISUAL_ID:
51                                return new BasicComponentEditPart(view);
52 
53                        case BasicComponentEntityNameEditPart.VISUAL_ID:
54                                return new BasicComponentEntityNameEditPart(view);
55 
56                        case CompositeComponentEditPart.VISUAL_ID:
57                                return new CompositeComponentEditPart(view);
58 
59                        case CompositeComponentEntityNameEditPart.VISUAL_ID:
60                                return new CompositeComponentEntityNameEditPart(view);
61 
62                        case CompleteComponentTypeEditPart.VISUAL_ID:
63                                return new CompleteComponentTypeEditPart(view);
64 
65                        case CompleteComponentTypeEntityNameEditPart.VISUAL_ID:
66                                return new CompleteComponentTypeEntityNameEditPart(view);
67 
68                        case ProvidesComponentTypeEditPart.VISUAL_ID:
69                                return new ProvidesComponentTypeEditPart(view);
70 
71                        case ProvidesComponentTypeEntityNameEditPart.VISUAL_ID:
72                                return new ProvidesComponentTypeEntityNameEditPart(view);
73 
74                        case SubSystemEditPart.VISUAL_ID:
75                                return new SubSystemEditPart(view);
76 
77                        case SubSystemEntityNameEditPart.VISUAL_ID:
78                                return new SubSystemEntityNameEditPart(view);
79 
80                        case InfrastructureInterfaceEditPart.VISUAL_ID:
81                                return new InfrastructureInterfaceEditPart(view);
82 
83                        case InfrastructureInterfaceEntityNameEditPart.VISUAL_ID:
84                                return new InfrastructureInterfaceEntityNameEditPart(view);
85 
86                        case OperationSignatureEditPart.VISUAL_ID:
87                                return new OperationSignatureEditPart(view);
88 
89                        case EventTypeEditPart.VISUAL_ID:
90                                return new EventTypeEditPart(view);
91 
92                        case ResourceDemandingSEFFEditPart.VISUAL_ID:
93                                return new ResourceDemandingSEFFEditPart(view);
94 
95                        case PassiveResourceEditPart.VISUAL_ID:
96                                return new PassiveResourceEditPart(view);
97 
98                        case VariableUsageEditPart.VISUAL_ID:
99                                return new VariableUsageEditPart(view);
100 
101                        case VariableUsageLabelEditPart.VISUAL_ID:
102                                return new VariableUsageLabelEditPart(view);
103 
104                        case VariableCharacterisationEditPart.VISUAL_ID:
105                                return new VariableCharacterisationEditPart(view);
106 
107                        case InfrastructureSignatureEditPart.VISUAL_ID:
108                                return new InfrastructureSignatureEditPart(view);
109 
110                        case OperationInterfaceSignatureListEditPart.VISUAL_ID:
111                                return new OperationInterfaceSignatureListEditPart(view);
112 
113                        case EventGroupEventTypeListEditPart.VISUAL_ID:
114                                return new EventGroupEventTypeListEditPart(view);
115 
116                        case BasicComponentSEFFCompartmentEditPart.VISUAL_ID:
117                                return new BasicComponentSEFFCompartmentEditPart(view);
118 
119                        case BasicComponentPassiveResourceCompartmentEditPart.VISUAL_ID:
120                                return new BasicComponentPassiveResourceCompartmentEditPart(
121                                                view);
122 
123                        case BasicComponentComponentParameterCompartmentEditPart.VISUAL_ID:
124                                return new BasicComponentComponentParameterCompartmentEditPart(
125                                                view);
126 
127                        case VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart.VISUAL_ID:
128                                return new VariableUsageComponentParameterVariableCharacterisationCompartmentEditPart(
129                                                view);
130 
131                        case InfrastructureInterfaceInfrastructureSignatureListEditPart.VISUAL_ID:
132                                return new InfrastructureInterfaceInfrastructureSignatureListEditPart(
133                                                view);
134 
135                        case OperationProvidedRoleEditPart.VISUAL_ID:
136                                return new OperationProvidedRoleEditPart(view);
137 
138                        case OperationProvidedRoleLabelEditPart.VISUAL_ID:
139                                return new OperationProvidedRoleLabelEditPart(view);
140 
141                        case InfrastructureProvidedRoleEditPart.VISUAL_ID:
142                                return new InfrastructureProvidedRoleEditPart(view);
143 
144                        case WrappingLabelEditPart.VISUAL_ID:
145                                return new WrappingLabelEditPart(view);
146 
147                        case InfrastructureRequiredRoleEditPart.VISUAL_ID:
148                                return new InfrastructureRequiredRoleEditPart(view);
149 
150                        case WrappingLabel2EditPart.VISUAL_ID:
151                                return new WrappingLabel2EditPart(view);
152 
153                        case SinkRoleEditPart.VISUAL_ID:
154                                return new SinkRoleEditPart(view);
155 
156                        case SinkRoleLabelEditPart.VISUAL_ID:
157                                return new SinkRoleLabelEditPart(view);
158 
159                        case OperationRequiredRoleEditPart.VISUAL_ID:
160                                return new OperationRequiredRoleEditPart(view);
161 
162                        case OperationRequiredRoleLabelEditPart.VISUAL_ID:
163                                return new OperationRequiredRoleLabelEditPart(view);
164 
165                        case ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID:
166                                return new ImplementationComponentTypeParentCompleteComponentTypesEditPart(
167                                                view);
168 
169                        case ImplementationComponentTypeParentCompleteTypesLabelEditPart.VISUAL_ID:
170                                return new ImplementationComponentTypeParentCompleteTypesLabelEditPart(
171                                                view);
172 
173                        case CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID:
174                                return new CompleteComponentTypeParentProvidesComponentTypesEditPart(
175                                                view);
176 
177                        case CompleteComponentTypeParentProvidesComponentTypesLabelEditPart.VISUAL_ID:
178                                return new CompleteComponentTypeParentProvidesComponentTypesLabelEditPart(
179                                                view);
180 
181                        case SourceRoleEditPart.VISUAL_ID:
182                                return new SourceRoleEditPart(view);
183 
184                        case SourceRoleLabelEditPart.VISUAL_ID:
185                                return new SourceRoleLabelEditPart(view);
186 
187                        }
188                }
189                return createUnrecognizedEditPart(context, model);
190        }
191 
192        /**
193         * @generated
194         */
195        private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
196                // Handle creation of unrecognized child node EditParts here
197                return null;
198        }
199 
200        /**
201         * @generated
202         */
203        public static CellEditorLocator getTextCellEditorLocator(
204                        ITextAwareEditPart source) {
205                if (source.getFigure() instanceof WrappingLabel)
206                        return new TextCellEditorLocator((WrappingLabel) source.getFigure());
207                else {
208                        return new LabelCellEditorLocator((Label) source.getFigure());
209                }
210        }
211 
212        /**
213         * @generated
214         */
215        static private class TextCellEditorLocator implements CellEditorLocator {
216 
217                /**
218                 * @generated
219                 */
220                private WrappingLabel wrapLabel;
221 
222                /**
223                 * @generated
224                 */
225                public TextCellEditorLocator(WrappingLabel wrapLabel) {
226                        this.wrapLabel = wrapLabel;
227                }
228 
229                /**
230                 * @generated
231                 */
232                public WrappingLabel getWrapLabel() {
233                        return wrapLabel;
234                }
235 
236                /**
237                 * @generated
238                 */
239                public void relocate(CellEditor celleditor) {
240                        Text text = (Text) celleditor.getControl();
241                        Rectangle rect = getWrapLabel().getTextBounds().getCopy();
242                        getWrapLabel().translateToAbsolute(rect);
243                        if (getWrapLabel().isTextWrapOn()
244                                        && getWrapLabel().getText().length() > 0) {
245                                rect.setSize(new Dimension(text.computeSize(rect.width,
246                                                SWT.DEFAULT)));
247                        } else {
248                                int avr = FigureUtilities.getFontMetrics(text.getFont())
249                                                .getAverageCharWidth();
250                                rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
251                                                SWT.DEFAULT)).expand(avr * 2, 0));
252                        }
253                        if (!rect.equals(new Rectangle(text.getBounds()))) {
254                                text.setBounds(rect.x, rect.y, rect.width, rect.height);
255                        }
256                }
257 
258        }
259 
260        /**
261         * @generated
262         */
263        private static class LabelCellEditorLocator implements CellEditorLocator {
264 
265                /**
266                 * @generated
267                 */
268                private Label label;
269 
270                /**
271                 * @generated
272                 */
273                public LabelCellEditorLocator(Label label) {
274                        this.label = label;
275                }
276 
277                /**
278                 * @generated
279                 */
280                public Label getLabel() {
281                        return label;
282                }
283 
284                /**
285                 * @generated
286                 */
287                public void relocate(CellEditor celleditor) {
288                        Text text = (Text) celleditor.getControl();
289                        Rectangle rect = getLabel().getTextBounds().getCopy();
290                        getLabel().translateToAbsolute(rect);
291                        int avr = FigureUtilities.getFontMetrics(text.getFont())
292                                        .getAverageCharWidth();
293                        rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
294                                        SWT.DEFAULT)).expand(avr * 2, 0));
295                        if (!rect.equals(new Rectangle(text.getBounds()))) {
296                                text.setBounds(rect.x, rect.y, rect.width, rect.height);
297                        }
298                }
299        }
300}

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