Skip to content

Package: SheetLocationItemProvider

SheetLocationItemProvider

nameinstructionbranchcomplexitylinemethod
SheetLocationItemProvider(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%
addColumnNamePropertyDescriptor(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%
addColumnPropertyDescriptor(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%
addRowPropertyDescriptor(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%
addSheetPropertyDescriptor(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%
addValidPropertyDescriptor(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%
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: 25 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getResourceLocator()
M: 5 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-2015 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: * Johannes Faltermeier - initial API and implementation
13: */
14: package org.eclipse.emfforms.spi.spreadsheet.core.error.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.edit.provider.ComposeableAdapterFactory;
23: import org.eclipse.emf.edit.provider.IChildCreationExtender;
24: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
25: import org.eclipse.emf.edit.provider.IItemLabelProvider;
26: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
27: import org.eclipse.emf.edit.provider.IItemPropertySource;
28: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
29: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
30: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
31: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
32: import org.eclipse.emf.edit.provider.ViewerNotification;
33: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorPackage;
34: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.SheetLocation;
35:
36: /**
37: * This is the item provider adapter for a {@link org.eclipse.emfforms.spi.spreadsheet.core.error.model.SheetLocation}
38: * object.
39: * <!-- begin-user-doc --> <!-- end-user-doc -->
40: *
41: * @generated
42: */
43: public class SheetLocationItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
44:         IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
45:         /**
46:          * This constructs an instance from a factory and a notifier. <!--
47:          * begin-user-doc --> <!-- end-user-doc -->
48:          *
49:          * @generated
50:          */
51:         public SheetLocationItemProvider(AdapterFactory adapterFactory) {
52:                 super(adapterFactory);
53:         }
54:
55:         /**
56:          * This returns the property descriptors for the adapted class. <!--
57:          * begin-user-doc --> <!-- end-user-doc -->
58:          *
59:          * @generated
60:          */
61:         @Override
62:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
63:•                if (itemPropertyDescriptors == null) {
64:                         super.getPropertyDescriptors(object);
65:
66:                         addSheetPropertyDescriptor(object);
67:                         addColumnPropertyDescriptor(object);
68:                         addRowPropertyDescriptor(object);
69:                         addColumnNamePropertyDescriptor(object);
70:                         addValidPropertyDescriptor(object);
71:                 }
72:                 return itemPropertyDescriptors;
73:         }
74:
75:         /**
76:          * This adds a property descriptor for the Sheet feature. <!--
77:          * begin-user-doc --> <!-- end-user-doc -->
78:          *
79:          * @generated
80:          */
81:         protected void addSheetPropertyDescriptor(Object object) {
82:                 itemPropertyDescriptors
83:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
84:                                 getResourceLocator(),
85:                                 getString("_UI_SheetLocation_sheet_feature"), //$NON-NLS-1$
86:                                 getString("_UI_PropertyDescriptor_description", "_UI_SheetLocation_sheet_feature", //$NON-NLS-1$ //$NON-NLS-2$
87:                                         "_UI_SheetLocation_type"), //$NON-NLS-1$
88:                                 ErrorPackage.Literals.SHEET_LOCATION__SHEET,
89:                                 true,
90:                                 false,
91:                                 false,
92:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
93:                                 null,
94:                                 null));
95:         }
96:
97:         /**
98:          * This adds a property descriptor for the Column feature. <!--
99:          * begin-user-doc --> <!-- end-user-doc -->
100:          *
101:          * @generated
102:          */
103:         protected void addColumnPropertyDescriptor(Object object) {
104:                 itemPropertyDescriptors
105:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
106:                                 getResourceLocator(),
107:                                 getString("_UI_SheetLocation_column_feature"), //$NON-NLS-1$
108:                                 getString("_UI_PropertyDescriptor_description", "_UI_SheetLocation_column_feature", //$NON-NLS-1$ //$NON-NLS-2$
109:                                         "_UI_SheetLocation_type"), //$NON-NLS-1$
110:                                 ErrorPackage.Literals.SHEET_LOCATION__COLUMN,
111:                                 true,
112:                                 false,
113:                                 false,
114:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
115:                                 null,
116:                                 null));
117:         }
118:
119:         /**
120:          * This adds a property descriptor for the Row feature.
121:          * <!-- begin-user-doc
122:          * --> <!-- end-user-doc -->
123:          *
124:          * @generated
125:          */
126:         protected void addRowPropertyDescriptor(Object object) {
127:                 itemPropertyDescriptors
128:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
129:                                 getResourceLocator(),
130:                                 getString("_UI_SheetLocation_row_feature"), //$NON-NLS-1$
131:                                 getString("_UI_PropertyDescriptor_description", "_UI_SheetLocation_row_feature", //$NON-NLS-1$ //$NON-NLS-2$
132:                                         "_UI_SheetLocation_type"), //$NON-NLS-1$
133:                                 ErrorPackage.Literals.SHEET_LOCATION__ROW,
134:                                 true,
135:                                 false,
136:                                 false,
137:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
138:                                 null,
139:                                 null));
140:         }
141:
142:         /**
143:          * This adds a property descriptor for the Column Name feature.
144:          * <!-- begin-user-doc -->
145:          * <!-- end-user-doc -->
146:          *
147:          * @generated
148:          */
149:         protected void addColumnNamePropertyDescriptor(Object object) {
150:                 itemPropertyDescriptors
151:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
152:                                 getResourceLocator(),
153:                                 getString("_UI_SheetLocation_columnName_feature"), //$NON-NLS-1$
154:                                 getString("_UI_PropertyDescriptor_description", "_UI_SheetLocation_columnName_feature", //$NON-NLS-1$ //$NON-NLS-2$
155:                                         "_UI_SheetLocation_type"), //$NON-NLS-1$
156:                                 ErrorPackage.Literals.SHEET_LOCATION__COLUMN_NAME,
157:                                 true,
158:                                 false,
159:                                 false,
160:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
161:                                 null,
162:                                 null));
163:         }
164:
165:         /**
166:          * This adds a property descriptor for the Valid feature.
167:          * <!-- begin-user-doc -->
168:          * <!-- end-user-doc -->
169:          *
170:          * @generated
171:          */
172:         protected void addValidPropertyDescriptor(Object object) {
173:                 itemPropertyDescriptors
174:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
175:                                 getResourceLocator(),
176:                                 getString("_UI_SheetLocation_valid_feature"), //$NON-NLS-1$
177:                                 getString("_UI_PropertyDescriptor_description", "_UI_SheetLocation_valid_feature", //$NON-NLS-1$ //$NON-NLS-2$
178:                                         "_UI_SheetLocation_type"), //$NON-NLS-1$
179:                                 ErrorPackage.Literals.SHEET_LOCATION__VALID,
180:                                 true,
181:                                 false,
182:                                 false,
183:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
184:                                 null,
185:                                 null));
186:         }
187:
188:         /**
189:          * This returns ExcelLocation.gif. <!-- begin-user-doc --> <!-- end-user-doc
190:          * -->
191:          *
192:          * @generated
193:          */
194:         @Override
195:         public Object getImage(Object object) {
196:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/SheetLocation")); //$NON-NLS-1$
197:         }
198:
199:         /**
200:          * This returns the label text for the adapted class.
201:          * <!-- begin-user-doc
202:          * --> <!-- end-user-doc -->
203:          *
204:          * @generated
205:          */
206:         @Override
207:         public String getText(Object object) {
208:                 final String label = ((SheetLocation) object).getColumnName();
209:•                return label == null || label.length() == 0 ? getString("_UI_SheetLocation_type") //$NON-NLS-1$
210:                         : getString("_UI_SheetLocation_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
211:         }
212:
213:         /**
214:          * This handles model notifications by calling {@link #updateChildren} to update any cached
215:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
216:          * <!-- begin-user-doc --> <!--
217:          * end-user-doc -->
218:          *
219:          * @generated
220:          */
221:         @Override
222:         public void notifyChanged(Notification notification) {
223:                 updateChildren(notification);
224:
225:•                switch (notification.getFeatureID(SheetLocation.class)) {
226:                 case ErrorPackage.SHEET_LOCATION__SHEET:
227:                 case ErrorPackage.SHEET_LOCATION__COLUMN:
228:                 case ErrorPackage.SHEET_LOCATION__ROW:
229:                 case ErrorPackage.SHEET_LOCATION__COLUMN_NAME:
230:                 case ErrorPackage.SHEET_LOCATION__VALID:
231:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
232:                         return;
233:                 }
234:                 super.notifyChanged(notification);
235:         }
236:
237:         /**
238:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
239:          * describing the children that can be created under this object. <!--
240:          * begin-user-doc --> <!-- end-user-doc -->
241:          *
242:          * @generated
243:          */
244:         @Override
245:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
246:                 super.collectNewChildDescriptors(newChildDescriptors, object);
247:         }
248:
249:         /**
250:          * Return the resource locator for this item provider's resources. <!--
251:          * begin-user-doc --> <!-- end-user-doc -->
252:          *
253:          * @generated
254:          */
255:         @Override
256:         public ResourceLocator getResourceLocator() {
257:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
258:         }
259:
260: }