Skip to content

Package: WidthConfigurationItemProvider

WidthConfigurationItemProvider

nameinstructionbranchcomplexitylinemethod
WidthConfigurationItemProvider(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%
addColumnDomainReferencePropertyDescriptor(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%
addMinWidthPropertyDescriptor(Object)
M: 26 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
addWeightPropertyDescriptor(Object)
M: 26 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: 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: 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: 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: 53 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
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-2013 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: * Eugen Neufeld - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.table.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.spi.model.VDomainModelReference;
23: import org.eclipse.emf.ecp.view.spi.table.model.VTablePackage;
24: import org.eclipse.emf.ecp.view.spi.table.model.VWidthConfiguration;
25: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
26: import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
27: import org.eclipse.emf.edit.provider.IChildCreationExtender;
28: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
29: import org.eclipse.emf.edit.provider.IItemLabelProvider;
30: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
31: import org.eclipse.emf.edit.provider.IItemPropertySource;
32: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
33: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
34: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
35: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
36: import org.eclipse.emf.edit.provider.ViewerNotification;
37:
38: /**
39: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.table.model.VWidthConfiguration} object.
40: * <!-- begin-user-doc -->
41: *
42: * @since 1.9
43: * <!-- end-user-doc -->
44: * @generated
45: */
46: public class WidthConfigurationItemProvider
47:         extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider,
48:         ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
49:         /**
50:          * This constructs an instance from a factory and a notifier.
51:          * <!-- begin-user-doc -->
52:          * <!-- end-user-doc -->
53:          *
54:          * @generated
55:          */
56:         public WidthConfigurationItemProvider(AdapterFactory adapterFactory) {
57:                 super(adapterFactory);
58:         }
59:
60:         /**
61:          * This returns the property descriptors for the adapted class.
62:          * <!-- begin-user-doc -->
63:          * <!-- end-user-doc -->
64:          *
65:          * @generated
66:          */
67:         @Override
68:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
69:•                if (itemPropertyDescriptors == null) {
70:                         super.getPropertyDescriptors(object);
71:
72:                         addColumnDomainReferencePropertyDescriptor(object);
73:                         addWeightPropertyDescriptor(object);
74:                         addMinWidthPropertyDescriptor(object);
75:                 }
76:                 return itemPropertyDescriptors;
77:         }
78:
79:         /**
80:          * This adds a property descriptor for the Column Domain Reference feature.
81:          * <!-- begin-user-doc -->
82:          * <!-- end-user-doc -->
83:          *
84:          * @generated
85:          */
86:         protected void addColumnDomainReferencePropertyDescriptor(Object object) {
87:                 itemPropertyDescriptors.add(createItemPropertyDescriptor(
88:                         ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
89:                         getResourceLocator(),
90:                         getString("_UI_SingleColumnConfiguration_columnDomainReference_feature"), //$NON-NLS-1$
91:                         getString("_UI_PropertyDescriptor_description", //$NON-NLS-1$
92:                                 "_UI_SingleColumnConfiguration_columnDomainReference_feature", "_UI_SingleColumnConfiguration_type"), //$NON-NLS-1$ //$NON-NLS-2$
93:                         VTablePackage.Literals.SINGLE_COLUMN_CONFIGURATION__COLUMN_DOMAIN_REFERENCE,
94:                         true,
95:                         false,
96:                         true,
97:                         null,
98:                         null,
99:                         null));
100:         }
101:
102:         /**
103:          * This adds a property descriptor for the Weight feature.
104:          * <!-- begin-user-doc -->
105:          * <!-- end-user-doc -->
106:          *
107:          * @generated
108:          */
109:         protected void addWeightPropertyDescriptor(Object object) {
110:                 itemPropertyDescriptors
111:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
112:                                 getResourceLocator(),
113:                                 getString("_UI_WidthConfiguration_weight_feature"), //$NON-NLS-1$
114:                                 getString("_UI_WidthConfiguration_weight_description"), //$NON-NLS-1$
115:                                 VTablePackage.Literals.WIDTH_CONFIGURATION__WEIGHT,
116:                                 true,
117:                                 false,
118:                                 false,
119:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
120:                                 null,
121:                                 null));
122:         }
123:
124:         /**
125:          * This adds a property descriptor for the Min Width feature.
126:          * <!-- begin-user-doc -->
127:          * <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         protected void addMinWidthPropertyDescriptor(Object object) {
132:                 itemPropertyDescriptors
133:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
134:                                 getResourceLocator(),
135:                                 getString("_UI_WidthConfiguration_minWidth_feature"), //$NON-NLS-1$
136:                                 getString("_UI_WidthConfiguration_minWidth_description"), //$NON-NLS-1$
137:                                 VTablePackage.Literals.WIDTH_CONFIGURATION__MIN_WIDTH,
138:                                 true,
139:                                 false,
140:                                 false,
141:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
142:                                 null,
143:                                 null));
144:         }
145:
146:         /**
147:          * This returns WidthConfiguration.gif.
148:          * <!-- begin-user-doc -->
149:          * <!-- end-user-doc -->
150:          *
151:          * @generated
152:          */
153:         @Override
154:         public Object getImage(Object object) {
155:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/WidthConfiguration")); //$NON-NLS-1$
156:         }
157:
158:         /**
159:          * This returns the label text for the adapted class.
160:          * <!-- begin-user-doc -->
161:          * <!-- end-user-doc -->
162:          *
163:          * @generated NOT
164:          */
165:         @Override
166:         public String getText(Object object) {
167:                 final VWidthConfiguration widthConfiguration = (VWidthConfiguration) object;
168:                 final VDomainModelReference columnDomainReference = widthConfiguration.getColumnDomainReference();
169:                 String label;
170:•                if (columnDomainReference == null) {
171:                         label = "<none>"; //$NON-NLS-1$
172:                 } else {
173:                         final ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactory(new AdapterFactory[] {
174:                                 new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) });
175:                         final IItemLabelProvider adapt = (IItemLabelProvider) composedAdapterFactory.adapt(columnDomainReference,
176:                                 IItemLabelProvider.class);
177:•                        label = adapt == null ? "<none>" : adapt.getText(columnDomainReference); //$NON-NLS-1$
178:                         composedAdapterFactory.dispose();
179:                 }
180:
181:                 return getString("_UI_WidthConfiguration_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
182:         }
183:
184:         /**
185:          * This handles model notifications by calling {@link #updateChildren} to update any cached
186:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
187:          * <!-- begin-user-doc -->
188:          * <!-- end-user-doc -->
189:          *
190:          * @generated
191:          */
192:         @Override
193:         public void notifyChanged(Notification notification) {
194:                 updateChildren(notification);
195:
196:•                switch (notification.getFeatureID(VWidthConfiguration.class)) {
197:                 case VTablePackage.WIDTH_CONFIGURATION__WEIGHT:
198:                 case VTablePackage.WIDTH_CONFIGURATION__MIN_WIDTH:
199:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
200:                         return;
201:                 }
202:                 super.notifyChanged(notification);
203:         }
204:
205:         /**
206:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
207:          * that can be created under this object.
208:          * <!-- begin-user-doc -->
209:          * <!-- end-user-doc -->
210:          *
211:          * @generated
212:          */
213:         @Override
214:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
215:                 super.collectNewChildDescriptors(newChildDescriptors, object);
216:         }
217:
218:         /**
219:          * Return the resource locator for this item provider's resources.
220:          * <!-- begin-user-doc -->
221:          * <!-- end-user-doc -->
222:          *
223:          * @generated
224:          */
225:         @Override
226:         public ResourceLocator getResourceLocator() {
227:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
228:         }
229:
230: }