Skip to content

Package: AssistantItemProvider

AssistantItemProvider

nameinstructionbranchcomplexitylinemethod
AssistantItemProvider(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%
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: 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: 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.Assistant;
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.Assistant} object.
37: * <!-- begin-user-doc -->
38: * <!-- end-user-doc -->
39: *
40: * @generated
41: */
42: public class AssistantItemProvider
43:         extends ItemProviderAdapter
44:         implements
45:         IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider,
46:         IItemPropertySource {
47:         /**
48:          * This constructs an instance from a factory and a notifier.
49:          * <!-- begin-user-doc -->
50:          * <!-- end-user-doc -->
51:          *
52:          * @generated
53:          */
54:         public AssistantItemProvider(AdapterFactory adapterFactory) {
55:                 super(adapterFactory);
56:         }
57:
58:         /**
59:          * This returns the property descriptors for the adapted class.
60:          * <!-- begin-user-doc -->
61:          * <!-- end-user-doc -->
62:          *
63:          * @generated
64:          */
65:         @Override
66:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
67:•                if (itemPropertyDescriptors == null) {
68:                         super.getPropertyDescriptors(object);
69:
70:                         addNamePropertyDescriptor(object);
71:                 }
72:                 return itemPropertyDescriptors;
73:         }
74:
75:         /**
76:          * This adds a property descriptor for the Name feature.
77:          * <!-- begin-user-doc -->
78:          * <!-- end-user-doc -->
79:          *
80:          * @generated
81:          */
82:         protected void addNamePropertyDescriptor(Object object) {
83:                 itemPropertyDescriptors
84:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
85:                                 getResourceLocator(),
86:                                 getString("_UI_Person_name_feature"), //$NON-NLS-1$
87:                                 getString("_UI_PropertyDescriptor_description", "_UI_Person_name_feature", "_UI_Person_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
88:                                 UniversityPackage.Literals.PERSON__NAME,
89:                                 true,
90:                                 false,
91:                                 false,
92:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
93:                                 null,
94:                                 null));
95:         }
96:
97:         /**
98:          * This returns Assistant.gif.
99:          * <!-- begin-user-doc -->
100:          * <!-- end-user-doc -->
101:          *
102:          * @generated
103:          */
104:         @Override
105:         public Object getImage(Object object) {
106:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/Assistant")); //$NON-NLS-1$
107:         }
108:
109:         /**
110:          * This returns the label text for the adapted class.
111:          * <!-- begin-user-doc -->
112:          * <!-- end-user-doc -->
113:          *
114:          * @generated
115:          */
116:         @Override
117:         public String getText(Object object) {
118:                 final String label = ((Assistant) object).getName();
119:•                return label == null || label.length() == 0 ? getString("_UI_Assistant_type") //$NON-NLS-1$
120:                         : getString("_UI_Assistant_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
121:         }
122:
123:         /**
124:          * This handles model notifications by calling {@link #updateChildren} to update any cached
125:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
126:          * <!-- begin-user-doc -->
127:          * <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public void notifyChanged(Notification notification) {
133:                 updateChildren(notification);
134:
135:•                switch (notification.getFeatureID(Assistant.class)) {
136:                 case UniversityPackage.ASSISTANT__NAME:
137:                 case UniversityPackage.ASSISTANT__ADDRESSES:
138:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
139:                         return;
140:                 }
141:                 super.notifyChanged(notification);
142:         }
143:
144:         /**
145:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
146:          * that can be created under this object.
147:          * <!-- begin-user-doc -->
148:          * <!-- end-user-doc -->
149:          *
150:          * @generated
151:          */
152:         @Override
153:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
154:                 super.collectNewChildDescriptors(newChildDescriptors, object);
155:         }
156:
157:         /**
158:          * Return the resource locator for this item provider's resources.
159:          * <!-- begin-user-doc -->
160:          * <!-- end-user-doc -->
161:          *
162:          * @generated
163:          */
164:         @Override
165:         public ResourceLocator getResourceLocator() {
166:                 return UniversityEditPlugin.INSTANCE;
167:         }
168:
169: }