Skip to content

Package: UserGroupItemProvider

UserGroupItemProvider

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