Skip to content

Package: GroupedGridItemProvider

GroupedGridItemProvider

nameinstructionbranchcomplexitylinemethod
GroupedGridItemProvider(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: 0 C: 21
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
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: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getText(Object)
M: 34 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 5 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-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.ecore.EStructuralFeature;
22: import org.eclipse.emf.ecp.view.spi.groupedgrid.model.VGroupedGrid;
23: import org.eclipse.emf.ecp.view.spi.groupedgrid.model.VGroupedGridFactory;
24: import org.eclipse.emf.ecp.view.spi.groupedgrid.model.VGroupedGridPackage;
25: import org.eclipse.emf.ecp.view.spi.model.VElement;
26: import org.eclipse.emf.ecp.view.spi.model.VElementUtil;
27: import org.eclipse.emf.ecp.view.spi.model.VViewPackage;
28: import org.eclipse.emf.ecp.view.spi.model.provider.ContainedElementItemProvider;
29: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
30: import org.eclipse.emf.edit.provider.IItemLabelProvider;
31: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
32: import org.eclipse.emf.edit.provider.IItemPropertySource;
33: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
34: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
35: import org.eclipse.emf.edit.provider.ViewerNotification;
36:
37: /**
38: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.groupedgrid.model.VGroupedGrid} object.
39: * <!-- begin-user-doc -->
40: * <!-- end-user-doc -->
41: *
42: * @generated
43: * @since 1.2
44: */
45: public class GroupedGridItemProvider
46:         extends ContainedElementItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider,
47:         ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
48:         /**
49:          * This constructs an instance from a factory and a notifier.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @generated
54:          */
55:         public GroupedGridItemProvider(AdapterFactory adapterFactory) {
56:                 super(adapterFactory);
57:         }
58:
59:         /**
60:          * This returns the property descriptors for the adapted class.
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @generated
65:          */
66:         @Override
67:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
68:•                if (itemPropertyDescriptors == null) {
69:                         super.getPropertyDescriptors(object);
70:
71:                 }
72:                 return itemPropertyDescriptors;
73:         }
74:
75:         /**
76:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
77:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
78:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
79:          * <!-- begin-user-doc -->
80:          * <!-- end-user-doc -->
81:          *
82:          * @generated
83:          */
84:         @Override
85:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
86:•                if (childrenFeatures == null) {
87:                         super.getChildrenFeatures(object);
88:                         childrenFeatures.add(VGroupedGridPackage.Literals.GROUPED_GRID__GROUPS);
89:                 }
90:                 return childrenFeatures;
91:         }
92:
93:         /**
94:          * <!-- begin-user-doc -->
95:          * <!-- end-user-doc -->
96:          *
97:          * @generated
98:          */
99:         @Override
100:         protected EStructuralFeature getChildFeature(Object object, Object child) {
101:                 // Check the type of the specified child object and return the proper feature to use for
102:                 // adding (see {@link AddCommand}) it as a child.
103:
104:                 return super.getChildFeature(object, child);
105:         }
106:
107:         /**
108:          * This returns GroupedGrid.gif.
109:          * <!-- begin-user-doc -->
110:          * <!-- end-user-doc -->
111:          *
112:          * @generated
113:          */
114:         @Override
115:         public Object getImage(Object object) {
116:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/GroupedGrid")); //$NON-NLS-1$
117:         }
118:
119:         /**
120:          * This returns the label text for the adapted class.
121:          * <!-- begin-user-doc -->
122:          * <!-- end-user-doc -->
123:          *
124:          * @generated NOT
125:          */
126:         @Override
127:         public String getText(Object object) {
128:                 String label = ((VGroupedGrid) object).getLabel();
129:•                if (label == null) {
130:                         label = VElementUtil.getCleanName(VElement.class.cast(object));
131:                 }
132:•                return label == null || label.length() == 0 ? getString("_UI_GroupedGrid_type") : //$NON-NLS-1$
133:                         getString("_UI_GroupedGrid_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
134:         }
135:
136:         /**
137:          * This handles model notifications by calling {@link #updateChildren} to update any cached
138:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
139:          * <!-- begin-user-doc -->
140:          * <!-- end-user-doc -->
141:          *
142:          * @generated
143:          */
144:         @Override
145:         public void notifyChanged(Notification notification) {
146:                 updateChildren(notification);
147:
148:•                switch (notification.getFeatureID(VGroupedGrid.class)) {
149:                 case VGroupedGridPackage.GROUPED_GRID__GROUPS:
150:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
151:                         return;
152:                 }
153:                 super.notifyChanged(notification);
154:         }
155:
156:         /**
157:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
158:          * that can be created under this object.
159:          * <!-- begin-user-doc -->
160:          * <!-- end-user-doc -->
161:          *
162:          * @generated
163:          */
164:         @Override
165:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
166:                 super.collectNewChildDescriptors(newChildDescriptors, object);
167:
168:                 newChildDescriptors.add(createChildParameter(VViewPackage.Literals.ELEMENT__ATTACHMENTS,
169:                         VGroupedGridFactory.eINSTANCE.createSpan()));
170:
171:                 newChildDescriptors.add(createChildParameter(VGroupedGridPackage.Literals.GROUPED_GRID__GROUPS,
172:                         VGroupedGridFactory.eINSTANCE.createGroup()));
173:         }
174:
175: }