Skip to content

Package: FontPropertiesStylePropertyItemProvider

FontPropertiesStylePropertyItemProvider

nameinstructionbranchcomplexitylinemethod
FontPropertiesStylePropertyItemProvider(AdapterFactory)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
addBoldPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 15
100%
M: 0 C: 1
100%
addColorHEXPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 15
100%
M: 0 C: 1
100%
addFontNamePropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 15
100%
M: 0 C: 1
100%
addHeightPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 15
100%
M: 0 C: 1
100%
addItalicPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 15
100%
M: 0 C: 1
100%
collectNewChildDescriptors(Collection, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getImage(Object)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPropertyDescriptors(Object)
M: 0 C: 25
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 8
100%
M: 0 C: 1
100%
getResourceLocator()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getText(Object)
M: 15 C: 11
42%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 1 C: 2
67%
M: 0 C: 1
100%
notifyChanged(Notification)
M: 11 C: 11
50%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 4
67%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.template.style.fontProperties.model.provider;
15:
16: import java.util.Collection;
17: import java.util.List;
18:
19: import org.eclipse.emf.common.notify.AdapterFactory;
20: import org.eclipse.emf.common.notify.Notification;
21: import org.eclipse.emf.common.util.ResourceLocator;
22: import org.eclipse.emf.ecp.view.template.style.fontProperties.model.VTFontPropertiesPackage;
23: import org.eclipse.emf.ecp.view.template.style.fontProperties.model.VTFontPropertiesStyleProperty;
24: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
25: import org.eclipse.emf.edit.provider.IChildCreationExtender;
26: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
27: import org.eclipse.emf.edit.provider.IItemLabelProvider;
28: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
29: import org.eclipse.emf.edit.provider.IItemPropertySource;
30: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
31: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
32: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
33: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
34: import org.eclipse.emf.edit.provider.ViewerNotification;
35:
36: /**
37: * This is the item provider adapter for a
38: * {@link org.eclipse.emf.ecp.view.template.style.fontProperties.model.VTFontPropertiesStyleProperty} object.
39: * <!-- begin-user-doc -->
40: * <!-- end-user-doc -->
41: *
42: * @generated
43: */
44: public class FontPropertiesStylePropertyItemProvider
45:         extends ItemProviderAdapter
46:         implements
47:         IEditingDomainItemProvider,
48:         IStructuredItemContentProvider,
49:         ITreeItemContentProvider,
50:         IItemLabelProvider,
51:         IItemPropertySource {
52:         /**
53:          * This constructs an instance from a factory and a notifier.
54:          * <!-- begin-user-doc -->
55:          * <!-- end-user-doc -->
56:          *
57:          * @generated
58:          */
59:         public FontPropertiesStylePropertyItemProvider(AdapterFactory adapterFactory) {
60:                 super(adapterFactory);
61:         }
62:
63:         /**
64:          * This returns the property descriptors for the adapted class.
65:          * <!-- begin-user-doc -->
66:          * <!-- end-user-doc -->
67:          *
68:          * @generated
69:          */
70:         @Override
71:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
72:•                if (itemPropertyDescriptors == null) {
73:                         super.getPropertyDescriptors(object);
74:
75:                         addItalicPropertyDescriptor(object);
76:                         addBoldPropertyDescriptor(object);
77:                         addColorHEXPropertyDescriptor(object);
78:                         addHeightPropertyDescriptor(object);
79:                         addFontNamePropertyDescriptor(object);
80:                 }
81:                 return itemPropertyDescriptors;
82:         }
83:
84:         /**
85:          * This adds a property descriptor for the Italic feature.
86:          * <!-- begin-user-doc -->
87:          * <!-- end-user-doc -->
88:          *
89:          * @generated
90:          */
91:         protected void addItalicPropertyDescriptor(Object object) {
92:                 itemPropertyDescriptors
93:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
94:                                 getResourceLocator(),
95:                                 getString("_UI_FontPropertiesStyleProperty_italic_feature"), //$NON-NLS-1$
96:                                 getString(
97:                                         "_UI_PropertyDescriptor_description", "_UI_FontPropertiesStyleProperty_italic_feature", //$NON-NLS-1$ //$NON-NLS-2$
98:                                         "_UI_FontPropertiesStyleProperty_type"), //$NON-NLS-1$
99:                                 VTFontPropertiesPackage.Literals.FONT_PROPERTIES_STYLE_PROPERTY__ITALIC,
100:                                 true,
101:                                 false,
102:                                 false,
103:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
104:                                 null,
105:                                 null));
106:         }
107:
108:         /**
109:          * This adds a property descriptor for the Bold feature.
110:          * <!-- begin-user-doc -->
111:          * <!-- end-user-doc -->
112:          *
113:          * @generated
114:          */
115:         protected void addBoldPropertyDescriptor(Object object) {
116:                 itemPropertyDescriptors
117:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
118:                                 getResourceLocator(),
119:                                 getString("_UI_FontPropertiesStyleProperty_bold_feature"), //$NON-NLS-1$
120:                                 getString(
121:                                         "_UI_PropertyDescriptor_description", "_UI_FontPropertiesStyleProperty_bold_feature", //$NON-NLS-1$ //$NON-NLS-2$
122:                                         "_UI_FontPropertiesStyleProperty_type"), //$NON-NLS-1$
123:                                 VTFontPropertiesPackage.Literals.FONT_PROPERTIES_STYLE_PROPERTY__BOLD,
124:                                 true,
125:                                 false,
126:                                 false,
127:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
128:                                 null,
129:                                 null));
130:         }
131:
132:         /**
133:          * This adds a property descriptor for the Color HEX feature.
134:          * <!-- begin-user-doc -->
135:          * <!-- end-user-doc -->
136:          *
137:          * @generated
138:          */
139:         protected void addColorHEXPropertyDescriptor(Object object) {
140:                 itemPropertyDescriptors
141:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
142:                                 getResourceLocator(),
143:                                 getString("_UI_FontPropertiesStyleProperty_colorHEX_feature"), //$NON-NLS-1$
144:                                 getString(
145:                                         "_UI_PropertyDescriptor_description", "_UI_FontPropertiesStyleProperty_colorHEX_feature", //$NON-NLS-1$ //$NON-NLS-2$
146:                                         "_UI_FontPropertiesStyleProperty_type"), //$NON-NLS-1$
147:                                 VTFontPropertiesPackage.Literals.FONT_PROPERTIES_STYLE_PROPERTY__COLOR_HEX,
148:                                 true,
149:                                 false,
150:                                 false,
151:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
152:                                 null,
153:                                 null));
154:         }
155:
156:         /**
157:          * This adds a property descriptor for the Height feature.
158:          * <!-- begin-user-doc -->
159:          * <!-- end-user-doc -->
160:          *
161:          * @generated
162:          */
163:         protected void addHeightPropertyDescriptor(Object object) {
164:                 itemPropertyDescriptors
165:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
166:                                 getResourceLocator(),
167:                                 getString("_UI_FontPropertiesStyleProperty_height_feature"), //$NON-NLS-1$
168:                                 getString(
169:                                         "_UI_PropertyDescriptor_description", "_UI_FontPropertiesStyleProperty_height_feature", //$NON-NLS-1$ //$NON-NLS-2$
170:                                         "_UI_FontPropertiesStyleProperty_type"), //$NON-NLS-1$
171:                                 VTFontPropertiesPackage.Literals.FONT_PROPERTIES_STYLE_PROPERTY__HEIGHT,
172:                                 true,
173:                                 false,
174:                                 false,
175:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
176:                                 null,
177:                                 null));
178:         }
179:
180:         /**
181:          * This adds a property descriptor for the Font Name feature.
182:          * <!-- begin-user-doc -->
183:          * <!-- end-user-doc -->
184:          *
185:          * @generated
186:          */
187:         protected void addFontNamePropertyDescriptor(Object object) {
188:                 itemPropertyDescriptors
189:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
190:                                 getResourceLocator(),
191:                                 getString("_UI_FontPropertiesStyleProperty_fontName_feature"), //$NON-NLS-1$
192:                                 getString(
193:                                         "_UI_PropertyDescriptor_description", "_UI_FontPropertiesStyleProperty_fontName_feature", //$NON-NLS-1$ //$NON-NLS-2$
194:                                         "_UI_FontPropertiesStyleProperty_type"), //$NON-NLS-1$
195:                                 VTFontPropertiesPackage.Literals.FONT_PROPERTIES_STYLE_PROPERTY__FONT_NAME,
196:                                 true,
197:                                 false,
198:                                 false,
199:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
200:                                 null,
201:                                 null));
202:         }
203:
204:         /**
205:          * This returns FontPropertiesStyleProperty.gif.
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @generated
210:          */
211:         @Override
212:         public Object getImage(Object object) {
213:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/FontPropertiesStyleProperty")); //$NON-NLS-1$
214:         }
215:
216:         /**
217:          * This returns the label text for the adapted class.
218:          * <!-- begin-user-doc -->
219:          * <!-- end-user-doc -->
220:          *
221:          * @generated
222:          */
223:         @Override
224:         public String getText(Object object) {
225:                 final String label = ((VTFontPropertiesStyleProperty) object).getFontName();
226:•                return label == null || label.length() == 0 ? getString("_UI_FontPropertiesStyleProperty_type") : //$NON-NLS-1$
227:                         getString("_UI_FontPropertiesStyleProperty_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
228:         }
229:
230:         /**
231:          * This handles model notifications by calling {@link #updateChildren} to update any cached
232:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
233:          * <!-- begin-user-doc -->
234:          * <!-- end-user-doc -->
235:          *
236:          * @generated
237:          */
238:         @Override
239:         public void notifyChanged(Notification notification) {
240:                 updateChildren(notification);
241:
242:•                switch (notification.getFeatureID(VTFontPropertiesStyleProperty.class)) {
243:                 case VTFontPropertiesPackage.FONT_PROPERTIES_STYLE_PROPERTY__ITALIC:
244:                 case VTFontPropertiesPackage.FONT_PROPERTIES_STYLE_PROPERTY__BOLD:
245:                 case VTFontPropertiesPackage.FONT_PROPERTIES_STYLE_PROPERTY__COLOR_HEX:
246:                 case VTFontPropertiesPackage.FONT_PROPERTIES_STYLE_PROPERTY__HEIGHT:
247:                 case VTFontPropertiesPackage.FONT_PROPERTIES_STYLE_PROPERTY__FONT_NAME:
248:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
249:                         return;
250:                 }
251:                 super.notifyChanged(notification);
252:         }
253:
254:         /**
255:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
256:          * that can be created under this object.
257:          * <!-- begin-user-doc -->
258:          * <!-- end-user-doc -->
259:          *
260:          * @generated
261:          */
262:         @Override
263:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
264:                 super.collectNewChildDescriptors(newChildDescriptors, object);
265:         }
266:
267:         /**
268:          * Return the resource locator for this item provider's resources.
269:          * <!-- begin-user-doc -->
270:          * <!-- end-user-doc -->
271:          *
272:          * @generated
273:          */
274:         @Override
275:         public ResourceLocator getResourceLocator() {
276:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
277:         }
278:
279: }