Skip to content

Package: ErrorReportItemProvider

ErrorReportItemProvider

nameinstructionbranchcomplexitylinemethod
ErrorReportItemProvider(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%
addMessagePropertyDescriptor(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%
addSeverityPropertyDescriptor(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: 21 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getChildFeature(Object, Object)
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%
getChildrenFeatures(Object)
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 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: 16 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 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: 33 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
notifyChanged(Notification)
M: 33 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 8 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.ecore.EStructuralFeature;
23: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
24: import org.eclipse.emf.edit.provider.IChildCreationExtender;
25: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
26: import org.eclipse.emf.edit.provider.IItemLabelProvider;
27: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
28: import org.eclipse.emf.edit.provider.IItemPropertySource;
29: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
30: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
31: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
32: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
33: import org.eclipse.emf.edit.provider.ViewerNotification;
34: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorFactory;
35: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorPackage;
36: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorReport;
37: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.Severity;
38:
39: /**
40: * This is the item provider adapter for a {@link org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorReport}
41: * object.
42: * <!-- begin-user-doc --> <!-- end-user-doc -->
43: *
44: * @generated
45: */
46: public class ErrorReportItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
47:         IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
48:         /**
49:          * This constructs an instance from a factory and a notifier. <!--
50:          * begin-user-doc --> <!-- end-user-doc -->
51:          *
52:          * @generated
53:          */
54:         public ErrorReportItemProvider(AdapterFactory adapterFactory) {
55:                 super(adapterFactory);
56:         }
57:
58:         /**
59:          * This returns the property descriptors for the adapted class. <!--
60:          * begin-user-doc --> <!-- end-user-doc -->
61:          *
62:          * @generated
63:          */
64:         @Override
65:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
66:•                if (itemPropertyDescriptors == null) {
67:                         super.getPropertyDescriptors(object);
68:
69:                         addSeverityPropertyDescriptor(object);
70:                         addMessagePropertyDescriptor(object);
71:                 }
72:                 return itemPropertyDescriptors;
73:         }
74:
75:         /**
76:          * This adds a property descriptor for the Severity feature. <!--
77:          * begin-user-doc --> <!-- end-user-doc -->
78:          *
79:          * @generated
80:          */
81:         protected void addSeverityPropertyDescriptor(Object object) {
82:                 itemPropertyDescriptors
83:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
84:                                 getResourceLocator(),
85:                                 getString("_UI_ErrorReport_severity_feature"), //$NON-NLS-1$
86:                                 getString("_UI_PropertyDescriptor_description", "_UI_ErrorReport_severity_feature", //$NON-NLS-1$ //$NON-NLS-2$
87:                                         "_UI_ErrorReport_type"), //$NON-NLS-1$
88:                                 ErrorPackage.Literals.ERROR_REPORT__SEVERITY,
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 Message feature. <!--
99:          * begin-user-doc --> <!-- end-user-doc -->
100:          *
101:          * @generated
102:          */
103:         protected void addMessagePropertyDescriptor(Object object) {
104:                 itemPropertyDescriptors
105:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
106:                                 getResourceLocator(),
107:                                 getString("_UI_ErrorReport_message_feature"), //$NON-NLS-1$
108:                                 getString("_UI_PropertyDescriptor_description", "_UI_ErrorReport_message_feature", //$NON-NLS-1$ //$NON-NLS-2$
109:                                         "_UI_ErrorReport_type"), //$NON-NLS-1$
110:                                 ErrorPackage.Literals.ERROR_REPORT__MESSAGE,
111:                                 true,
112:                                 false,
113:                                 false,
114:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
115:                                 null,
116:                                 null));
117:         }
118:
119:         /**
120:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
121:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
122:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
123:          * <!-- begin-user-doc --> <!-- end-user-doc -->
124:          *
125:          * @generated
126:          */
127:         @Override
128:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
129:•                if (childrenFeatures == null) {
130:                         super.getChildrenFeatures(object);
131:                         childrenFeatures.add(ErrorPackage.Literals.ERROR_REPORT__EMF_LOCATION);
132:                         childrenFeatures.add(ErrorPackage.Literals.ERROR_REPORT__SHEET_LOCATION);
133:                 }
134:                 return childrenFeatures;
135:         }
136:
137:         /**
138:          * <!-- begin-user-doc --> <!-- end-user-doc -->
139:          *
140:          * @generated
141:          */
142:         @Override
143:         protected EStructuralFeature getChildFeature(Object object, Object child) {
144:                 // Check the type of the specified child object and return the proper feature to use for
145:                 // adding (see {@link AddCommand}) it as a child.
146:
147:                 return super.getChildFeature(object, child);
148:         }
149:
150:         /**
151:          * This returns ErrorReport.gif. <!-- begin-user-doc --> <!-- end-user-doc
152:          * -->
153:          *
154:          * @generated
155:          */
156:         @Override
157:         public Object getImage(Object object) {
158:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/ErrorReport")); //$NON-NLS-1$
159:         }
160:
161:         /**
162:          * This returns the label text for the adapted class.
163:          * <!-- begin-user-doc
164:          * --> <!-- end-user-doc -->
165:          *
166:          * @generated
167:          */
168:         @Override
169:         public String getText(Object object) {
170:                 final Severity labelValue = ((ErrorReport) object).getSeverity();
171:•                final String label = labelValue == null ? null : labelValue.toString();
172:•                return label == null || label.length() == 0 ? getString("_UI_ErrorReport_type") //$NON-NLS-1$
173:                         : getString("_UI_ErrorReport_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
174:         }
175:
176:         /**
177:          * This handles model notifications by calling {@link #updateChildren} to update any cached
178:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
179:          * <!-- begin-user-doc --> <!--
180:          * end-user-doc -->
181:          *
182:          * @generated
183:          */
184:         @Override
185:         public void notifyChanged(Notification notification) {
186:                 updateChildren(notification);
187:
188:•                switch (notification.getFeatureID(ErrorReport.class)) {
189:                 case ErrorPackage.ERROR_REPORT__SEVERITY:
190:                 case ErrorPackage.ERROR_REPORT__MESSAGE:
191:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
192:                         return;
193:                 case ErrorPackage.ERROR_REPORT__EMF_LOCATION:
194:                 case ErrorPackage.ERROR_REPORT__SHEET_LOCATION:
195:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
196:                         return;
197:                 }
198:                 super.notifyChanged(notification);
199:         }
200:
201:         /**
202:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
203:          * describing the children that can be created under this object. <!--
204:          * begin-user-doc --> <!-- end-user-doc -->
205:          *
206:          * @generated
207:          */
208:         @Override
209:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
210:                 super.collectNewChildDescriptors(newChildDescriptors, object);
211:
212:                 newChildDescriptors.add(createChildParameter(ErrorPackage.Literals.ERROR_REPORT__EMF_LOCATION,
213:                         ErrorFactory.eINSTANCE.createEMFLocation()));
214:
215:                 newChildDescriptors.add(createChildParameter(ErrorPackage.Literals.ERROR_REPORT__SHEET_LOCATION,
216:                         ErrorFactory.eINSTANCE.createSheetLocation()));
217:         }
218:
219:         /**
220:          * Return the resource locator for this item provider's resources. <!--
221:          * begin-user-doc --> <!-- end-user-doc -->
222:          *
223:          * @generated
224:          */
225:         @Override
226:         public ResourceLocator getResourceLocator() {
227:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
228:         }
229:
230: }