Skip to content

Package: CourseItemProvider

CourseItemProvider

nameinstructionbranchcomplexitylinemethod
CourseItemProvider(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%
addEtcsPropertyDescriptor(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%
addIdPropertyDescriptor(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%
addNamePropertyDescriptor(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: 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: 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: 2 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-2014 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: * EclipseSource - Generated code
13: */
14: package org.eclipse.emf.ecp.test.university.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.test.university.Course;
23: import org.eclipse.emf.ecp.test.university.UniversityPackage;
24: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
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:
35: /**
36: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.test.university.Course} object.
37: * <!-- begin-user-doc -->
38: * <!-- end-user-doc -->
39: *
40: * @generated
41: */
42: public class CourseItemProvider extends ItemProviderAdapter implements
43:         IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider,
44:         IItemPropertySource {
45:         /**
46:          * This constructs an instance from a factory and a notifier.
47:          * <!-- begin-user-doc -->
48:          * <!-- end-user-doc -->
49:          *
50:          * @generated
51:          */
52:         public CourseItemProvider(AdapterFactory adapterFactory) {
53:                 super(adapterFactory);
54:         }
55:
56:         /**
57:          * This returns the property descriptors for the adapted class.
58:          * <!-- begin-user-doc -->
59:          * <!-- end-user-doc -->
60:          *
61:          * @generated
62:          */
63:         @Override
64:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
65:•                if (itemPropertyDescriptors == null) {
66:                         super.getPropertyDescriptors(object);
67:
68:                         addIdPropertyDescriptor(object);
69:                         addNamePropertyDescriptor(object);
70:                         addEtcsPropertyDescriptor(object);
71:                 }
72:                 return itemPropertyDescriptors;
73:         }
74:
75:         /**
76:          * This adds a property descriptor for the Id feature.
77:          * <!-- begin-user-doc -->
78:          * <!-- end-user-doc -->
79:          *
80:          * @generated
81:          */
82:         protected void addIdPropertyDescriptor(Object object) {
83:                 itemPropertyDescriptors
84:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
85:                                 getResourceLocator(),
86:                                 getString("_UI_Course_id_feature"), //$NON-NLS-1$
87:                                 getString("_UI_PropertyDescriptor_description", "_UI_Course_id_feature", "_UI_Course_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
88:                                 UniversityPackage.Literals.COURSE__ID,
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 Name feature.
99:          * <!-- begin-user-doc -->
100:          * <!-- end-user-doc -->
101:          *
102:          * @generated
103:          */
104:         protected void addNamePropertyDescriptor(Object object) {
105:                 itemPropertyDescriptors
106:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
107:                                 getResourceLocator(),
108:                                 getString("_UI_Course_name_feature"), //$NON-NLS-1$
109:                                 getString("_UI_PropertyDescriptor_description", "_UI_Course_name_feature", "_UI_Course_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
110:                                 UniversityPackage.Literals.COURSE__NAME,
111:                                 true,
112:                                 false,
113:                                 false,
114:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
115:                                 null,
116:                                 null));
117:         }
118:
119:         /**
120:          * This adds a property descriptor for the Etcs feature.
121:          * <!-- begin-user-doc -->
122:          * <!-- end-user-doc -->
123:          *
124:          * @generated
125:          */
126:         protected void addEtcsPropertyDescriptor(Object object) {
127:                 itemPropertyDescriptors
128:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
129:                                 getResourceLocator(),
130:                                 getString("_UI_Course_etcs_feature"), //$NON-NLS-1$
131:                                 getString("_UI_PropertyDescriptor_description", "_UI_Course_etcs_feature", "_UI_Course_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
132:                                 UniversityPackage.Literals.COURSE__ETCS,
133:                                 true,
134:                                 false,
135:                                 false,
136:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
137:                                 null,
138:                                 null));
139:         }
140:
141:         /**
142:          * This returns Course.gif.
143:          * <!-- begin-user-doc -->
144:          * <!-- end-user-doc -->
145:          *
146:          * @generated
147:          */
148:         @Override
149:         public Object getImage(Object object) {
150:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/Course")); //$NON-NLS-1$
151:         }
152:
153:         /**
154:          * This returns the label text for the adapted class.
155:          * <!-- begin-user-doc -->
156:          * <!-- end-user-doc -->
157:          *
158:          * @generated
159:          */
160:         @Override
161:         public String getText(Object object) {
162:                 final String label = ((Course) object).getName();
163:•                return label == null || label.length() == 0 ? getString("_UI_Course_type") //$NON-NLS-1$
164:                         : getString("_UI_Course_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
165:         }
166:
167:         /**
168:          * This handles model notifications by calling {@link #updateChildren} to update any cached
169:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
170:          * <!-- begin-user-doc -->
171:          * <!-- end-user-doc -->
172:          *
173:          * @generated
174:          */
175:         @Override
176:         public void notifyChanged(Notification notification) {
177:                 updateChildren(notification);
178:
179:•                switch (notification.getFeatureID(Course.class)) {
180:                 case UniversityPackage.COURSE__ID:
181:                 case UniversityPackage.COURSE__NAME:
182:                 case UniversityPackage.COURSE__ETCS:
183:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
184:                         return;
185:                 }
186:                 super.notifyChanged(notification);
187:         }
188:
189:         /**
190:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
191:          * that can be created under this object.
192:          * <!-- begin-user-doc -->
193:          * <!-- end-user-doc -->
194:          *
195:          * @generated
196:          */
197:         @Override
198:         protected void collectNewChildDescriptors(
199:                 Collection<Object> newChildDescriptors, Object object) {
200:                 super.collectNewChildDescriptors(newChildDescriptors, object);
201:         }
202:
203:         /**
204:          * Return the resource locator for this item provider's resources.
205:          * <!-- begin-user-doc -->
206:          * <!-- end-user-doc -->
207:          *
208:          * @generated
209:          */
210:         @Override
211:         public ResourceLocator getResourceLocator() {
212:                 return UniversityEditPlugin.INSTANCE;
213:         }
214:
215: }