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%
addCollapsedPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 13
100%
M: 0 C: 1
100%
addGroupTypePropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 13
100%
M: 0 C: 1
100%
addLabelAlignmentPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 13
100%
M: 0 C: 1
100%
addTooltipPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 14
100%
M: 0 C: 1
100%
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%
getImage(Object)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPropertyDescriptors(Object)
M: 0 C: 22
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
getText(Object)
M: 0 C: 34
100%
M: 2 C: 4
67%
M: 2 C: 2
50%
M: 0 C: 5
100%
M: 0 C: 1
100%
notifyChanged(Notification)
M: 11 C: 11
50%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 4
67%
M: 0 C: 1
100%

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.group.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.ecp.view.spi.group.model.VGroup;
22: import org.eclipse.emf.ecp.view.spi.group.model.VGroupFactory;
23: import org.eclipse.emf.ecp.view.spi.group.model.VGroupPackage;
24: import org.eclipse.emf.ecp.view.spi.model.VElement;
25: import org.eclipse.emf.ecp.view.spi.model.VElementUtil;
26: import org.eclipse.emf.ecp.view.spi.model.VViewPackage;
27: import org.eclipse.emf.ecp.view.spi.model.provider.ContainedContainerItemProvider;
28: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
29: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
30: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
31: import org.eclipse.emf.edit.provider.ViewerNotification;
32:
33: /**
34: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.group.model.VGroup} object.
35: * <!-- begin-user-doc -->
36: * <!-- end-user-doc -->
37: *
38: * @generated
39: */
40: public class GroupItemProvider
41:         extends ContainedContainerItemProvider {
42:         /**
43:          * This constructs an instance from a factory and a notifier.
44:          * <!-- begin-user-doc -->
45:          * <!-- end-user-doc -->
46:          *
47:          * @generated
48:          */
49:         public GroupItemProvider(AdapterFactory adapterFactory) {
50:                 super(adapterFactory);
51:         }
52:
53:         /**
54:          * This returns the property descriptors for the adapted class.
55:          * <!-- begin-user-doc -->
56:          * <!-- end-user-doc -->
57:          *
58:          * @generated
59:          */
60:         @Override
61:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
62:•                if (itemPropertyDescriptors == null) {
63:                         super.getPropertyDescriptors(object);
64:
65:                         addTooltipPropertyDescriptor(object);
66:                         addGroupTypePropertyDescriptor(object);
67:                         addLabelAlignmentPropertyDescriptor(object);
68:                         addCollapsedPropertyDescriptor(object);
69:                 }
70:                 return itemPropertyDescriptors;
71:         }
72:
73:         /**
74:          * This adds a property descriptor for the Tooltip feature.
75:          * <!-- begin-user-doc -->
76:          *
77:          * @since 1.13
78:          * <!-- end-user-doc -->
79:          *
80:          * @generated
81:          */
82:         protected void addTooltipPropertyDescriptor(Object object) {
83:                 itemPropertyDescriptors
84:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
85:                                 getResourceLocator(),
86:                                 getString("_UI_HasTooltip_tooltip_feature"), //$NON-NLS-1$
87:                                 getString("_UI_PropertyDescriptor_description", "_UI_HasTooltip_tooltip_feature", //$NON-NLS-1$ //$NON-NLS-2$
88:                                         "_UI_HasTooltip_type"), //$NON-NLS-1$
89:                                 VViewPackage.Literals.HAS_TOOLTIP__TOOLTIP,
90:                                 true,
91:                                 true,
92:                                 false,
93:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
94:                                 null,
95:                                 null));
96:         }
97:
98:         /**
99:          * This adds a property descriptor for the Group Type feature.
100:          * <!-- begin-user-doc -->
101:          *
102:          * @since 1.4
103:          * <!-- end-user-doc -->
104:          * @generated
105:          */
106:         protected void addGroupTypePropertyDescriptor(Object object) {
107:                 itemPropertyDescriptors
108:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
109:                                 getResourceLocator(),
110:                                 getString("_UI_Group_groupType_feature"), //$NON-NLS-1$
111:                                 getString("_UI_PropertyDescriptor_description", "_UI_Group_groupType_feature", "_UI_Group_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
112:                                 VGroupPackage.Literals.GROUP__GROUP_TYPE,
113:                                 true,
114:                                 false,
115:                                 false,
116:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
117:                                 null,
118:                                 null));
119:         }
120:
121:         /**
122:          * This adds a property descriptor for the Label Alignment feature.
123:          * <!-- begin-user-doc -->
124:          *
125:          * @since 1.4
126:          * <!-- end-user-doc -->
127:          * @generated
128:          */
129:         protected void addLabelAlignmentPropertyDescriptor(Object object) {
130:                 itemPropertyDescriptors
131:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
132:                                 getResourceLocator(),
133:                                 getString("_UI_Group_labelAlignment_feature"), //$NON-NLS-1$
134:                                 getString("_UI_PropertyDescriptor_description", "_UI_Group_labelAlignment_feature", "_UI_Group_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
135:                                 VGroupPackage.Literals.GROUP__LABEL_ALIGNMENT,
136:                                 true,
137:                                 false,
138:                                 false,
139:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
140:                                 null,
141:                                 null));
142:         }
143:
144:         /**
145:          * This adds a property descriptor for the Collapsed feature.
146:          * <!-- begin-user-doc -->
147:          *
148:          * @since 1.4
149:          * <!-- end-user-doc -->
150:          * @generated
151:          */
152:         protected void addCollapsedPropertyDescriptor(Object object) {
153:                 itemPropertyDescriptors
154:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
155:                                 getResourceLocator(),
156:                                 getString("_UI_Group_collapsed_feature"), //$NON-NLS-1$
157:                                 getString("_UI_PropertyDescriptor_description", "_UI_Group_collapsed_feature", "_UI_Group_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
158:                                 VGroupPackage.Literals.GROUP__COLLAPSED,
159:                                 true,
160:                                 false,
161:                                 false,
162:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
163:                                 null,
164:                                 null));
165:         }
166:
167:         /**
168:          * This returns Group.gif.
169:          * <!-- begin-user-doc -->
170:          * <!-- end-user-doc -->
171:          *
172:          * @generated
173:          */
174:         @Override
175:         public Object getImage(Object object) {
176:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/Group")); //$NON-NLS-1$
177:         }
178:
179:         /**
180:          * This returns the label text for the adapted class.
181:          * <!-- begin-user-doc -->
182:          * <!-- end-user-doc -->
183:          *
184:          * @generated NOT
185:          */
186:         @Override
187:         public String getText(Object object) {
188:                 String label = ((VGroup) object).getLabel();
189:•                if (label == null) {
190:                         label = VElementUtil.getCleanName(VElement.class.cast(object));
191:                 }
192:•                return label == null || label.length() == 0 ? getString("_UI_Group_type") : //$NON-NLS-1$
193:                         getString("_UI_Group_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
194:         }
195:
196:         /**
197:          * This handles model notifications by calling {@link #updateChildren} to update any cached
198:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
199:          * <!-- begin-user-doc -->
200:          * <!-- end-user-doc -->
201:          *
202:          * @generated
203:          */
204:         @Override
205:         public void notifyChanged(Notification notification) {
206:                 updateChildren(notification);
207:
208:•                switch (notification.getFeatureID(VGroup.class)) {
209:                 case VGroupPackage.GROUP__TOOLTIP:
210:                 case VGroupPackage.GROUP__GROUP_TYPE:
211:                 case VGroupPackage.GROUP__LABEL_ALIGNMENT:
212:                 case VGroupPackage.GROUP__COLLAPSED:
213:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
214:                         return;
215:                 }
216:                 super.notifyChanged(notification);
217:         }
218:
219:         /**
220:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
221:          * that can be created under this object.
222:          * <!-- begin-user-doc -->
223:          * <!-- end-user-doc -->
224:          *
225:          * @generated
226:          */
227:         @Override
228:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
229:                 super.collectNewChildDescriptors(newChildDescriptors, object);
230:
231:                 newChildDescriptors.add(createChildParameter(VViewPackage.Literals.CONTAINER__CHILDREN,
232:                         VGroupFactory.eINSTANCE.createGroup()));
233:         }
234:
235: }