Skip to content

Package: IterateConditionItemProvider

IterateConditionItemProvider

nameinstructionbranchcomplexitylinemethod
IterateConditionItemProvider(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%
addIfEmptyPropertyDescriptor(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%
addItemReferencePropertyDescriptor(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%
addQuantifierPropertyDescriptor(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: 69
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 18
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: 0 C: 15
100%
M: 0 C: 2
100%
M: 0 C: 2
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: 19
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
getText(Object)
M: 6 C: 27
82%
M: 3 C: 3
50%
M: 3 C: 1
25%
M: 0 C: 4
100%
M: 0 C: 1
100%
notifyChanged(Notification)
M: 0 C: 33
100%
M: 0 C: 3
100%
M: 0 C: 3
100%
M: 0 C: 8
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2017 Christian W. Damus 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: * Christian W. Damus - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.rule.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.rule.model.IterateCondition;
23: import org.eclipse.emf.ecp.view.spi.rule.model.Quantifier;
24: import org.eclipse.emf.ecp.view.spi.rule.model.RuleFactory;
25: import org.eclipse.emf.ecp.view.spi.rule.model.RulePackage;
26: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
27: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
28: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
29: import org.eclipse.emf.edit.provider.ViewerNotification;
30:
31: /**
32: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.rule.model.IterateCondition} object.
33: * <!-- begin-user-doc -->
34: * <!-- end-user-doc -->
35: *
36: * @generated
37: */
38: public class IterateConditionItemProvider extends ConditionItemProvider {
39:         /**
40:          * This constructs an instance from a factory and a notifier.
41:          * <!-- begin-user-doc -->
42:          * <!-- end-user-doc -->
43:          *
44:          * @generated
45:          */
46:         public IterateConditionItemProvider(AdapterFactory adapterFactory) {
47:                 super(adapterFactory);
48:         }
49:
50:         /**
51:          * This returns the property descriptors for the adapted class.
52:          * <!-- begin-user-doc -->
53:          * <!-- end-user-doc -->
54:          *
55:          * @generated
56:          */
57:         @Override
58:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
59:•                if (itemPropertyDescriptors == null) {
60:                         super.getPropertyDescriptors(object);
61:
62:                         addQuantifierPropertyDescriptor(object);
63:                         addIfEmptyPropertyDescriptor(object);
64:                         addItemReferencePropertyDescriptor(object);
65:                 }
66:                 return itemPropertyDescriptors;
67:         }
68:
69:         /**
70:          * This adds a property descriptor for the Quantifier feature.
71:          * <!-- begin-user-doc -->
72:          * <!-- end-user-doc -->
73:          *
74:          * @generated
75:          */
76:         protected void addQuantifierPropertyDescriptor(Object object) {
77:                 itemPropertyDescriptors
78:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
79:                                 getResourceLocator(),
80:                                 getString("_UI_IterateCondition_quantifier_feature"), //$NON-NLS-1$
81:                                 getString("_UI_PropertyDescriptor_description", "_UI_IterateCondition_quantifier_feature", //$NON-NLS-1$ //$NON-NLS-2$
82:                                         "_UI_IterateCondition_type"), //$NON-NLS-1$
83:                                 RulePackage.Literals.ITERATE_CONDITION__QUANTIFIER,
84:                                 true,
85:                                 false,
86:                                 false,
87:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
88:                                 null,
89:                                 null));
90:         }
91:
92:         /**
93:          * This adds a property descriptor for the If Empty feature.
94:          * <!-- begin-user-doc -->
95:          * <!-- end-user-doc -->
96:          *
97:          * @generated
98:          */
99:         protected void addIfEmptyPropertyDescriptor(Object object) {
100:                 itemPropertyDescriptors
101:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
102:                                 getResourceLocator(),
103:                                 getString("_UI_IterateCondition_ifEmpty_feature"), //$NON-NLS-1$
104:                                 getString("_UI_PropertyDescriptor_description", "_UI_IterateCondition_ifEmpty_feature", //$NON-NLS-1$ //$NON-NLS-2$
105:                                         "_UI_IterateCondition_type"), //$NON-NLS-1$
106:                                 RulePackage.Literals.ITERATE_CONDITION__IF_EMPTY,
107:                                 true,
108:                                 false,
109:                                 false,
110:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
111:                                 null,
112:                                 null));
113:         }
114:
115:         /**
116:          * This adds a property descriptor for the Item Reference feature.
117:          * <!-- begin-user-doc -->
118:          *
119:          * @since 1.21
120:          * <!-- end-user-doc -->
121:          *
122:          * @generated
123:          */
124:         protected void addItemReferencePropertyDescriptor(Object object) {
125:                 itemPropertyDescriptors
126:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
127:                                 getResourceLocator(),
128:                                 getString("_UI_IterateCondition_itemReference_feature"), //$NON-NLS-1$
129:                                 getString("_UI_PropertyDescriptor_description", "_UI_IterateCondition_itemReference_feature", //$NON-NLS-1$ //$NON-NLS-2$
130:                                         "_UI_IterateCondition_type"), //$NON-NLS-1$
131:                                 RulePackage.Literals.ITERATE_CONDITION__ITEM_REFERENCE,
132:                                 true,
133:                                 false,
134:                                 false,
135:                                 null,
136:                                 null,
137:                                 null));
138:         }
139:
140:         /**
141:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
142:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
143:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
144:          * <!-- begin-user-doc -->
145:          * <!-- end-user-doc -->
146:          *
147:          * @generated
148:          */
149:         @Override
150:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
151:•                if (childrenFeatures == null) {
152:                         super.getChildrenFeatures(object);
153:                         childrenFeatures.add(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION);
154:                 }
155:                 return childrenFeatures;
156:         }
157:
158:         /**
159:          * <!-- begin-user-doc -->
160:          * <!-- end-user-doc -->
161:          *
162:          * @generated
163:          */
164:         @Override
165:         protected EStructuralFeature getChildFeature(Object object, Object child) {
166:                 // Check the type of the specified child object and return the proper feature to use for
167:                 // adding (see {@link AddCommand}) it as a child.
168:
169:                 return super.getChildFeature(object, child);
170:         }
171:
172:         /**
173:          * This returns IterateCondition.gif.
174:          * <!-- begin-user-doc -->
175:          * <!-- end-user-doc -->
176:          *
177:          * @generated
178:          */
179:         @Override
180:         public Object getImage(Object object) {
181:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/IterateCondition")); //$NON-NLS-1$
182:         }
183:
184:         /**
185:          * This returns the label text for the adapted class.
186:          * <!-- begin-user-doc -->
187:          * <!-- end-user-doc -->
188:          *
189:          * @generated
190:          */
191:         @Override
192:         public String getText(Object object) {
193:                 final Quantifier labelValue = ((IterateCondition) object).getQuantifier();
194:•                final String label = labelValue == null ? null : labelValue.toString();
195:•                return label == null || label.length() == 0 ? getString("_UI_IterateCondition_type") : //$NON-NLS-1$
196:                         getString("_UI_IterateCondition_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
197:         }
198:
199:         /**
200:          * This handles model notifications by calling {@link #updateChildren} to update any cached
201:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
202:          * <!-- begin-user-doc -->
203:          * <!-- end-user-doc -->
204:          *
205:          * @generated
206:          */
207:         @Override
208:         public void notifyChanged(Notification notification) {
209:                 updateChildren(notification);
210:
211:•                switch (notification.getFeatureID(IterateCondition.class)) {
212:                 case RulePackage.ITERATE_CONDITION__QUANTIFIER:
213:                 case RulePackage.ITERATE_CONDITION__IF_EMPTY:
214:                 case RulePackage.ITERATE_CONDITION__ITEM_REFERENCE:
215:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
216:                         return;
217:                 case RulePackage.ITERATE_CONDITION__ITEM_CONDITION:
218:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
219:                         return;
220:                 }
221:                 super.notifyChanged(notification);
222:         }
223:
224:         /**
225:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
226:          * that can be created under this object.
227:          * <!-- begin-user-doc -->
228:          * <!-- end-user-doc -->
229:          *
230:          * @generated
231:          */
232:         @Override
233:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
234:                 super.collectNewChildDescriptors(newChildDescriptors, object);
235:
236:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
237:                         RuleFactory.eINSTANCE.createLeafCondition()));
238:
239:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
240:                         RuleFactory.eINSTANCE.createOrCondition()));
241:
242:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
243:                         RuleFactory.eINSTANCE.createAndCondition()));
244:
245:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
246:                         RuleFactory.eINSTANCE.createIterateCondition()));
247:
248:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
249:                         RuleFactory.eINSTANCE.createTrue()));
250:
251:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
252:                         RuleFactory.eINSTANCE.createFalse()));
253:
254:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
255:                         RuleFactory.eINSTANCE.createNotCondition()));
256:
257:                 newChildDescriptors.add(createChildParameter(RulePackage.Literals.ITERATE_CONDITION__ITEM_CONDITION,
258:                         RuleFactory.eINSTANCE.createIsProxyCondition()));
259:         }
260:
261: }