Skip to content

Package: DimensionItemProvider

DimensionItemProvider

nameinstructionbranchcomplexitylinemethod
DimensionItemProvider(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%
addHeightPropertyDescriptor(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%
addLengthPropertyDescriptor(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%
addWidthPropertyDescriptor(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: 19 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 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: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 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.Dimension;
33:
34: /**
35: * This is the item provider adapter for a {@link org.eclipse.emfforms.coffee.model.coffee.Dimension} object.
36: * <!-- begin-user-doc -->
37: * <!-- end-user-doc -->
38: *
39: * @generated
40: */
41: public class DimensionItemProvider
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 DimensionItemProvider(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:                         addWidthPropertyDescriptor(object);
72:                         addHeightPropertyDescriptor(object);
73:                         addLengthPropertyDescriptor(object);
74:                 }
75:                 return itemPropertyDescriptors;
76:         }
77:
78:         /**
79:          * This adds a property descriptor for the Width feature.
80:          * <!-- begin-user-doc -->
81:          * <!-- end-user-doc -->
82:          *
83:          * @generated
84:          */
85:         protected void addWidthPropertyDescriptor(Object object) {
86:                 itemPropertyDescriptors
87:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
88:                                 getResourceLocator(),
89:                                 getString("_UI_Dimension_width_feature"), //$NON-NLS-1$
90:                                 getString("_UI_PropertyDescriptor_description", "_UI_Dimension_width_feature", "_UI_Dimension_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
91:                                 CoffeePackage.Literals.DIMENSION__WIDTH,
92:                                 true,
93:                                 false,
94:                                 false,
95:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
96:                                 null,
97:                                 null));
98:         }
99:
100:         /**
101:          * This adds a property descriptor for the Height feature.
102:          * <!-- begin-user-doc -->
103:          * <!-- end-user-doc -->
104:          *
105:          * @generated
106:          */
107:         protected void addHeightPropertyDescriptor(Object object) {
108:                 itemPropertyDescriptors
109:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
110:                                 getResourceLocator(),
111:                                 getString("_UI_Dimension_height_feature"), //$NON-NLS-1$
112:                                 getString("_UI_PropertyDescriptor_description", "_UI_Dimension_height_feature", "_UI_Dimension_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
113:                                 CoffeePackage.Literals.DIMENSION__HEIGHT,
114:                                 true,
115:                                 false,
116:                                 false,
117:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
118:                                 null,
119:                                 null));
120:         }
121:
122:         /**
123:          * This adds a property descriptor for the Length feature.
124:          * <!-- begin-user-doc -->
125:          * <!-- end-user-doc -->
126:          *
127:          * @generated
128:          */
129:         protected void addLengthPropertyDescriptor(Object object) {
130:                 itemPropertyDescriptors
131:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
132:                                 getResourceLocator(),
133:                                 getString("_UI_Dimension_length_feature"), //$NON-NLS-1$
134:                                 getString("_UI_PropertyDescriptor_description", "_UI_Dimension_length_feature", "_UI_Dimension_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
135:                                 CoffeePackage.Literals.DIMENSION__LENGTH,
136:                                 true,
137:                                 false,
138:                                 false,
139:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
140:                                 null,
141:                                 null));
142:         }
143:
144:         /**
145:          * This returns Dimension.gif.
146:          * <!-- begin-user-doc -->
147:          * <!-- end-user-doc -->
148:          *
149:          * @generated
150:          */
151:         @Override
152:         public Object getImage(Object object) {
153:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/Dimension")); //$NON-NLS-1$
154:         }
155:
156:         /**
157:          * This returns the label text for the adapted class.
158:          * <!-- begin-user-doc -->
159:          * <!-- end-user-doc -->
160:          *
161:          * @generated
162:          */
163:         @Override
164:         public String getText(Object object) {
165:                 final Dimension dimension = (Dimension) object;
166:                 return getString("_UI_Dimension_type") + " " + dimension.getWidth(); //$NON-NLS-1$ //$NON-NLS-2$
167:         }
168:
169:         /**
170:          * This handles model notifications by calling {@link #updateChildren} to update any cached
171:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
172:          * <!-- begin-user-doc -->
173:          * <!-- end-user-doc -->
174:          *
175:          * @generated
176:          */
177:         @Override
178:         public void notifyChanged(Notification notification) {
179:                 updateChildren(notification);
180:
181:•                switch (notification.getFeatureID(Dimension.class)) {
182:                 case CoffeePackage.DIMENSION__WIDTH:
183:                 case CoffeePackage.DIMENSION__HEIGHT:
184:                 case CoffeePackage.DIMENSION__LENGTH:
185:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
186:                         return;
187:                 }
188:                 super.notifyChanged(notification);
189:         }
190:
191:         /**
192:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
193:          * that can be created under this object.
194:          * <!-- begin-user-doc -->
195:          * <!-- end-user-doc -->
196:          *
197:          * @generated
198:          */
199:         @Override
200:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
201:                 super.collectNewChildDescriptors(newChildDescriptors, object);
202:         }
203:
204:         /**
205:          * Return the resource locator for this item provider's resources.
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @generated
210:          */
211:         @Override
212:         public ResourceLocator getResourceLocator() {
213:                 return CoffeeEditPlugin.INSTANCE;
214:         }
215:
216: }