Skip to content

Package: EMFLocationItemProvider

EMFLocationItemProvider

nameinstructionbranchcomplexitylinemethod
EMFLocationItemProvider(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%
addRootPropertyDescriptor(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: 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: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 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: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 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.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.ItemProviderAdapter;
32: import org.eclipse.emf.edit.provider.ViewerNotification;
33: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.EMFLocation;
34: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorFactory;
35: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorPackage;
36:
37: /**
38: * This is the item provider adapter for a {@link org.eclipse.emfforms.spi.spreadsheet.core.error.model.EMFLocation}
39: * object.
40: * <!-- begin-user-doc --> <!-- end-user-doc -->
41: *
42: * @generated
43: */
44: public class EMFLocationItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
45:         IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
46:         /**
47:          * This constructs an instance from a factory and a notifier. <!--
48:          * begin-user-doc --> <!-- end-user-doc -->
49:          *
50:          * @generated
51:          */
52:         public EMFLocationItemProvider(AdapterFactory adapterFactory) {
53:                 super(adapterFactory);
54:         }
55:
56:         /**
57:          * This returns the property descriptors for the adapted class. <!--
58:          * begin-user-doc --> <!-- end-user-doc -->
59:          *
60:          * @generated
61:          */
62:         @Override
63:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
64:•                if (itemPropertyDescriptors == null) {
65:                         super.getPropertyDescriptors(object);
66:
67:                         addRootPropertyDescriptor(object);
68:                 }
69:                 return itemPropertyDescriptors;
70:         }
71:
72:         /**
73:          * This adds a property descriptor for the Root feature.
74:          * <!-- begin-user-doc -->
75:          * <!-- end-user-doc -->
76:          *
77:          * @generated
78:          */
79:         protected void addRootPropertyDescriptor(Object object) {
80:                 itemPropertyDescriptors
81:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
82:                                 getResourceLocator(),
83:                                 getString("_UI_EMFLocation_root_feature"), //$NON-NLS-1$
84:                                 getString("_UI_PropertyDescriptor_description", "_UI_EMFLocation_root_feature", "_UI_EMFLocation_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
85:                                 ErrorPackage.Literals.EMF_LOCATION__ROOT,
86:                                 true,
87:                                 false,
88:                                 true,
89:                                 null,
90:                                 null,
91:                                 null));
92:         }
93:
94:         /**
95:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
96:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
97:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
98:          * <!-- begin-user-doc --> <!-- end-user-doc -->
99:          *
100:          * @generated
101:          */
102:         @Override
103:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
104:•                if (childrenFeatures == null) {
105:                         super.getChildrenFeatures(object);
106:                         childrenFeatures.add(ErrorPackage.Literals.EMF_LOCATION__SETTING_LOCATION);
107:                         childrenFeatures.add(ErrorPackage.Literals.EMF_LOCATION__DMR_LOCATION);
108:                 }
109:                 return childrenFeatures;
110:         }
111:
112:         /**
113:          * <!-- begin-user-doc --> <!-- end-user-doc -->
114:          *
115:          * @generated
116:          */
117:         @Override
118:         protected EStructuralFeature getChildFeature(Object object, Object child) {
119:                 // Check the type of the specified child object and return the proper feature to use for
120:                 // adding (see {@link AddCommand}) it as a child.
121:
122:                 return super.getChildFeature(object, child);
123:         }
124:
125:         /**
126:          * This returns EMFLocation.gif. <!-- begin-user-doc --> <!-- end-user-doc
127:          * -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public Object getImage(Object object) {
133:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/EMFLocation")); //$NON-NLS-1$
134:         }
135:
136:         /**
137:          * This returns the label text for the adapted class.
138:          * <!-- begin-user-doc
139:          * --> <!-- end-user-doc -->
140:          *
141:          * @generated
142:          */
143:         @Override
144:         public String getText(Object object) {
145:                 return getString("_UI_EMFLocation_type"); //$NON-NLS-1$
146:         }
147:
148:         /**
149:          * This handles model notifications by calling {@link #updateChildren} to update any cached
150:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
151:          * <!-- begin-user-doc --> <!--
152:          * end-user-doc -->
153:          *
154:          * @generated
155:          */
156:         @Override
157:         public void notifyChanged(Notification notification) {
158:                 updateChildren(notification);
159:
160:•                switch (notification.getFeatureID(EMFLocation.class)) {
161:                 case ErrorPackage.EMF_LOCATION__SETTING_LOCATION:
162:                 case ErrorPackage.EMF_LOCATION__DMR_LOCATION:
163:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
164:                         return;
165:                 }
166:                 super.notifyChanged(notification);
167:         }
168:
169:         /**
170:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
171:          * describing the children that can be created under this object. <!--
172:          * begin-user-doc --> <!-- end-user-doc -->
173:          *
174:          * @generated
175:          */
176:         @Override
177:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
178:                 super.collectNewChildDescriptors(newChildDescriptors, object);
179:
180:                 newChildDescriptors.add(createChildParameter(ErrorPackage.Literals.EMF_LOCATION__SETTING_LOCATION,
181:                         ErrorFactory.eINSTANCE.createSettingLocation()));
182:
183:                 newChildDescriptors.add(createChildParameter(ErrorPackage.Literals.EMF_LOCATION__DMR_LOCATION,
184:                         ErrorFactory.eINSTANCE.createDMRLocation()));
185:         }
186:
187:         /**
188:          * Return the resource locator for this item provider's resources. <!--
189:          * begin-user-doc --> <!-- end-user-doc -->
190:          *
191:          * @generated
192:          */
193:         @Override
194:         public ResourceLocator getResourceLocator() {
195:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
196:         }
197:
198: }