Skip to content

Package: ProcessorItemProvider

ProcessorItemProvider

nameinstructionbranchcomplexitylinemethod
ProcessorItemProvider(AdapterFactory)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
addClockSpeedPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addManufactoringProcessPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addNumberOfCoresPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addSocketconnectorTypePropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addThermalDesignPowerPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addVendorPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
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: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPropertyDescriptors(Object)
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
getResourceLocator()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getText(Object)
M: 26 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
notifyChanged(Notification)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (c) 2011-2018 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.emfforms.coffee.model.coffee.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.edit.provider.ComposeableAdapterFactory;
23: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
24: import org.eclipse.emf.edit.provider.IItemLabelProvider;
25: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
26: import org.eclipse.emf.edit.provider.IItemPropertySource;
27: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
28: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
29: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
30: import org.eclipse.emf.edit.provider.ViewerNotification;
31: import org.eclipse.emfforms.coffee.model.coffee.CoffeePackage;
32: import org.eclipse.emfforms.coffee.model.coffee.Processor;
33:
34: /**
35: * This is the item provider adapter for a {@link org.eclipse.emfforms.coffee.model.coffee.Processor} object.
36: * <!-- begin-user-doc -->
37: * <!-- end-user-doc -->
38: *
39: * @generated
40: */
41: public class ProcessorItemProvider
42:         extends ItemProviderAdapter
43:         implements
44:         IEditingDomainItemProvider,
45:         ITreeItemContentProvider,
46:         IItemLabelProvider,
47:         IItemPropertySource {
48:         /**
49:          * This constructs an instance from a factory and a notifier.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @generated
54:          */
55:         public ProcessorItemProvider(AdapterFactory adapterFactory) {
56:                 super(adapterFactory);
57:         }
58:
59:         /**
60:          * This returns the property descriptors for the adapted class.
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @generated
65:          */
66:         @Override
67:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
68:•                if (itemPropertyDescriptors == null) {
69:                         super.getPropertyDescriptors(object);
70:
71:                         addVendorPropertyDescriptor(object);
72:                         addClockSpeedPropertyDescriptor(object);
73:                         addNumberOfCoresPropertyDescriptor(object);
74:                         addSocketconnectorTypePropertyDescriptor(object);
75:                         addThermalDesignPowerPropertyDescriptor(object);
76:                         addManufactoringProcessPropertyDescriptor(object);
77:                 }
78:                 return itemPropertyDescriptors;
79:         }
80:
81:         /**
82:          * This adds a property descriptor for the Vendor feature.
83:          * <!-- begin-user-doc -->
84:          * <!-- end-user-doc -->
85:          *
86:          * @generated
87:          */
88:         protected void addVendorPropertyDescriptor(Object object) {
89:                 itemPropertyDescriptors
90:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
91:                                 getResourceLocator(),
92:                                 getString("_UI_Processor_vendor_feature"), //$NON-NLS-1$
93:                                 getString("_UI_PropertyDescriptor_description", "_UI_Processor_vendor_feature", "_UI_Processor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
94:                                 CoffeePackage.Literals.PROCESSOR__VENDOR,
95:                                 true,
96:                                 false,
97:                                 false,
98:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
99:                                 null,
100:                                 null));
101:         }
102:
103:         /**
104:          * This adds a property descriptor for the Clock Speed feature.
105:          * <!-- begin-user-doc -->
106:          * <!-- end-user-doc -->
107:          *
108:          * @generated
109:          */
110:         protected void addClockSpeedPropertyDescriptor(Object object) {
111:                 itemPropertyDescriptors
112:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
113:                                 getResourceLocator(),
114:                                 getString("_UI_Processor_clockSpeed_feature"), //$NON-NLS-1$
115:                                 getString("_UI_PropertyDescriptor_description", "_UI_Processor_clockSpeed_feature", //$NON-NLS-1$ //$NON-NLS-2$
116:                                         "_UI_Processor_type"), //$NON-NLS-1$
117:                                 CoffeePackage.Literals.PROCESSOR__CLOCK_SPEED,
118:                                 true,
119:                                 false,
120:                                 false,
121:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
122:                                 null,
123:                                 null));
124:         }
125:
126:         /**
127:          * This adds a property descriptor for the Number Of Cores feature.
128:          * <!-- begin-user-doc -->
129:          * <!-- end-user-doc -->
130:          *
131:          * @generated
132:          */
133:         protected void addNumberOfCoresPropertyDescriptor(Object object) {
134:                 itemPropertyDescriptors
135:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
136:                                 getResourceLocator(),
137:                                 getString("_UI_Processor_numberOfCores_feature"), //$NON-NLS-1$
138:                                 getString("_UI_PropertyDescriptor_description", "_UI_Processor_numberOfCores_feature", //$NON-NLS-1$ //$NON-NLS-2$
139:                                         "_UI_Processor_type"), //$NON-NLS-1$
140:                                 CoffeePackage.Literals.PROCESSOR__NUMBER_OF_CORES,
141:                                 true,
142:                                 false,
143:                                 false,
144:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
145:                                 null,
146:                                 null));
147:         }
148:
149:         /**
150:          * This adds a property descriptor for the Socketconnector Type feature.
151:          * <!-- begin-user-doc -->
152:          * <!-- end-user-doc -->
153:          *
154:          * @generated
155:          */
156:         protected void addSocketconnectorTypePropertyDescriptor(Object object) {
157:                 itemPropertyDescriptors
158:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
159:                                 getResourceLocator(),
160:                                 getString("_UI_Processor_socketconnectorType_feature"), //$NON-NLS-1$
161:                                 getString("_UI_PropertyDescriptor_description", "_UI_Processor_socketconnectorType_feature", //$NON-NLS-1$ //$NON-NLS-2$
162:                                         "_UI_Processor_type"), //$NON-NLS-1$
163:                                 CoffeePackage.Literals.PROCESSOR__SOCKETCONNECTOR_TYPE,
164:                                 true,
165:                                 false,
166:                                 false,
167:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
168:                                 null,
169:                                 null));
170:         }
171:
172:         /**
173:          * This adds a property descriptor for the Thermal Design Power feature.
174:          * <!-- begin-user-doc -->
175:          * <!-- end-user-doc -->
176:          *
177:          * @generated
178:          */
179:         protected void addThermalDesignPowerPropertyDescriptor(Object object) {
180:                 itemPropertyDescriptors
181:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
182:                                 getResourceLocator(),
183:                                 getString("_UI_Processor_thermalDesignPower_feature"), //$NON-NLS-1$
184:                                 getString("_UI_PropertyDescriptor_description", "_UI_Processor_thermalDesignPower_feature", //$NON-NLS-1$ //$NON-NLS-2$
185:                                         "_UI_Processor_type"), //$NON-NLS-1$
186:                                 CoffeePackage.Literals.PROCESSOR__THERMAL_DESIGN_POWER,
187:                                 true,
188:                                 false,
189:                                 false,
190:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
191:                                 null,
192:                                 null));
193:         }
194:
195:         /**
196:          * This adds a property descriptor for the Manufactoring Process feature.
197:          * <!-- begin-user-doc -->
198:          * <!-- end-user-doc -->
199:          *
200:          * @generated
201:          */
202:         protected void addManufactoringProcessPropertyDescriptor(Object object) {
203:                 itemPropertyDescriptors
204:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
205:                                 getResourceLocator(),
206:                                 getString("_UI_Processor_manufactoringProcess_feature"), //$NON-NLS-1$
207:                                 getString("_UI_PropertyDescriptor_description", "_UI_Processor_manufactoringProcess_feature", //$NON-NLS-1$ //$NON-NLS-2$
208:                                         "_UI_Processor_type"), //$NON-NLS-1$
209:                                 CoffeePackage.Literals.PROCESSOR__MANUFACTORING_PROCESS,
210:                                 true,
211:                                 false,
212:                                 false,
213:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
214:                                 null,
215:                                 null));
216:         }
217:
218:         /**
219:          * This returns Processor.gif.
220:          * <!-- begin-user-doc -->
221:          * <!-- end-user-doc -->
222:          *
223:          * @generated
224:          */
225:         @Override
226:         public Object getImage(Object object) {
227:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/Processor")); //$NON-NLS-1$
228:         }
229:
230:         /**
231:          * This returns the label text for the adapted class.
232:          * <!-- begin-user-doc -->
233:          * <!-- end-user-doc -->
234:          *
235:          * @generated
236:          */
237:         @Override
238:         public String getText(Object object) {
239:                 final String label = ((Processor) object).getVendor();
240:•                return label == null || label.length() == 0 ? getString("_UI_Processor_type") : //$NON-NLS-1$
241:                         getString("_UI_Processor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
242:         }
243:
244:         /**
245:          * This handles model notifications by calling {@link #updateChildren} to update any cached
246:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
247:          * <!-- begin-user-doc -->
248:          * <!-- end-user-doc -->
249:          *
250:          * @generated
251:          */
252:         @Override
253:         public void notifyChanged(Notification notification) {
254:                 updateChildren(notification);
255:
256:•                switch (notification.getFeatureID(Processor.class)) {
257:                 case CoffeePackage.PROCESSOR__VENDOR:
258:                 case CoffeePackage.PROCESSOR__CLOCK_SPEED:
259:                 case CoffeePackage.PROCESSOR__NUMBER_OF_CORES:
260:                 case CoffeePackage.PROCESSOR__SOCKETCONNECTOR_TYPE:
261:                 case CoffeePackage.PROCESSOR__THERMAL_DESIGN_POWER:
262:                 case CoffeePackage.PROCESSOR__MANUFACTORING_PROCESS:
263:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
264:                         return;
265:                 }
266:                 super.notifyChanged(notification);
267:         }
268:
269:         /**
270:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
271:          * that can be created under this object.
272:          * <!-- begin-user-doc -->
273:          * <!-- end-user-doc -->
274:          *
275:          * @generated
276:          */
277:         @Override
278:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
279:                 super.collectNewChildDescriptors(newChildDescriptors, object);
280:         }
281:
282:         /**
283:          * Return the resource locator for this item provider's resources.
284:          * <!-- begin-user-doc -->
285:          * <!-- end-user-doc -->
286:          *
287:          * @generated
288:          */
289:         @Override
290:         public ResourceLocator getResourceLocator() {
291:                 return CoffeeEditPlugin.INSTANCE;
292:         }
293:
294: }