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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelTextSelectionEditPolicy.java]

nameclass, %method, %block, %line, %
PalladioComponentModelTextSelectionEditPolicy.java0%   (0/2)0%   (0/15)0%   (0/260)0%   (0/75)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelTextSelectionEditPolicy0%   (0/1)0%   (0/13)0%   (0/246)0%   (0/72)
PalladioComponentModelTextSelectionEditPolicy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createFocusFeedbackFigure (): IFigure 0%   (0/1)0%   (0/5)0%   (0/1)
createSelectionFeedbackFigure (): IFigure 0%   (0/1)0%   (0/28)0%   (0/11)
getFeedbackBounds (): Rectangle 0%   (0/1)0%   (0/32)0%   (0/7)
hideFocus (): void 0%   (0/1)0%   (0/21)0%   (0/6)
hideSelection (): void 0%   (0/1)0%   (0/28)0%   (0/8)
refreshFeedback (): void 0%   (0/1)0%   (0/5)0%   (0/3)
refreshFocusFeedback (): void 0%   (0/1)0%   (0/9)0%   (0/3)
refreshSelectionFeedback (): void 0%   (0/1)0%   (0/27)0%   (0/7)
showFocus (): void 0%   (0/1)0%   (0/22)0%   (0/6)
showPrimarySelection (): void 0%   (0/1)0%   (0/20)0%   (0/6)
showSelection (): void 0%   (0/1)0%   (0/29)0%   (0/8)
updateLabel (Label): void 0%   (0/1)0%   (0/17)0%   (0/5)
     
class PalladioComponentModelTextSelectionEditPolicy$10%   (0/1)0%   (0/2)0%   (0/14)0%   (0/4)
PalladioComponentModelTextSelectionEditPolicy$1 (PalladioComponentModelTextSe... 0%   (0/1)0%   (0/6)0%   (0/2)
paintFigure (Graphics): void 0%   (0/1)0%   (0/8)0%   (0/2)

1/*
2 * Copyright 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.edit.policies;
5 
6import org.eclipse.draw2d.ColorConstants;
7import org.eclipse.draw2d.Figure;
8import org.eclipse.draw2d.Graphics;
9import org.eclipse.draw2d.IFigure;
10import org.eclipse.draw2d.Label;
11import org.eclipse.draw2d.RectangleFigure;
12import org.eclipse.draw2d.geometry.Rectangle;
13import org.eclipse.gef.editpolicies.SelectionEditPolicy;
14import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
15 
16/**
17 * @generated
18 */
19public class PalladioComponentModelTextSelectionEditPolicy extends
20                SelectionEditPolicy {
21 
22        /**
23         * @generated
24         */
25        private IFigure selectionFeedbackFigure;
26 
27        /**
28         * @generated
29         */
30        private IFigure focusFeedbackFigure;
31 
32        /**
33         * @generated
34         */
35        protected void showPrimarySelection() {
36                if (getHostFigure() instanceof WrapLabel) {
37                        ((WrapLabel) getHostFigure()).setSelected(true);
38                        ((WrapLabel) getHostFigure()).setFocus(true);
39                } else {
40                        showSelection();
41                        showFocus();
42                }
43        }
44 
45        /**
46         * @generated
47         */
48        protected void showSelection() {
49                if (getHostFigure() instanceof WrapLabel) {
50                        ((WrapLabel) getHostFigure()).setSelected(true);
51                        ((WrapLabel) getHostFigure()).setFocus(false);
52                } else {
53                        hideSelection();
54                        addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
55                        refreshSelectionFeedback();
56                        hideFocus();
57                }
58        }
59 
60        /**
61         * @generated
62         */
63        protected void hideSelection() {
64                if (getHostFigure() instanceof WrapLabel) {
65                        ((WrapLabel) getHostFigure()).setSelected(false);
66                        ((WrapLabel) getHostFigure()).setFocus(false);
67                } else {
68                        if (selectionFeedbackFigure != null) {
69                                removeFeedback(selectionFeedbackFigure);
70                                selectionFeedbackFigure = null;
71                        }
72                        hideFocus();
73                }
74        }
75 
76        /**
77         * @generated
78         */
79        protected void showFocus() {
80                if (getHostFigure() instanceof WrapLabel) {
81                        ((WrapLabel) getHostFigure()).setFocus(true);
82                } else {
83                        hideFocus();
84                        addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
85                        refreshFocusFeedback();
86                }
87        }
88 
89        /**
90         * @generated
91         */
92        protected void hideFocus() {
93                if (getHostFigure() instanceof WrapLabel) {
94                        ((WrapLabel) getHostFigure()).setFocus(false);
95                } else {
96                        if (focusFeedbackFigure != null) {
97                                removeFeedback(focusFeedbackFigure);
98                                focusFeedbackFigure = null;
99                        }
100                }
101        }
102 
103        /**
104         * @generated
105         */
106        protected Rectangle getFeedbackBounds() {
107                Rectangle bounds;
108                if (getHostFigure() instanceof Label) {
109                        bounds = ((Label) getHostFigure()).getTextBounds();
110                        bounds.intersect(getHostFigure().getBounds());
111                } else {
112                        bounds = getHostFigure().getBounds().getCopy();
113                }
114                getHostFigure().getParent().translateToAbsolute(bounds);
115                getFeedbackLayer().translateToRelative(bounds);
116                return bounds;
117        }
118 
119        /**
120         * @generated
121         */
122        protected IFigure createSelectionFeedbackFigure() {
123                if (getHostFigure() instanceof Label) {
124                        Label feedbackFigure = new Label();
125                        feedbackFigure.setOpaque(true);
126                        feedbackFigure
127                                        .setBackgroundColor(ColorConstants.menuBackgroundSelected);
128                        feedbackFigure
129                                        .setForegroundColor(ColorConstants.menuForegroundSelected);
130                        return feedbackFigure;
131                } else {
132                        RectangleFigure feedbackFigure = new RectangleFigure();
133                        feedbackFigure.setFill(false);
134                        return feedbackFigure;
135                }
136        }
137 
138        /**
139         * @generated
140         */
141        protected IFigure createFocusFeedbackFigure() {
142                return new Figure() {
143 
144                        protected void paintFigure(Graphics graphics) {
145                                graphics.drawFocus(getBounds().getResized(-1, -1));
146                        }
147                };
148        }
149 
150        /**
151         * @generated
152         */
153        protected void updateLabel(Label target) {
154                Label source = (Label) getHostFigure();
155                target.setText(source.getText());
156                target.setTextAlignment(source.getTextAlignment());
157                target.setFont(source.getFont());
158        }
159 
160        /**
161         * @generated
162         */
163        protected void refreshSelectionFeedback() {
164                if (selectionFeedbackFigure != null) {
165                        if (selectionFeedbackFigure instanceof Label) {
166                                updateLabel((Label) selectionFeedbackFigure);
167                                selectionFeedbackFigure.setBounds(getFeedbackBounds());
168                        } else {
169                                selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
170                                                5));
171                        }
172                }
173        }
174 
175        /**
176         * @generated
177         */
178        protected void refreshFocusFeedback() {
179                if (focusFeedbackFigure != null) {
180                        focusFeedbackFigure.setBounds(getFeedbackBounds());
181                }
182        }
183 
184        /**
185         * @generated
186         */
187        public void refreshFeedback() {
188                refreshSelectionFeedback();
189                refreshFocusFeedback();
190        }
191}

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