Skip to content

Package: GroupItemProvider

GroupItemProvider

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