Skip to content

Package: ViewModelLoadingPropertiesItemProvider

ViewModelLoadingPropertiesItemProvider

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