Skip to content

Package: RuleItemProvider

RuleItemProvider

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