Skip to content

Package: LeafConditionItemProvider

LeafConditionItemProvider

nameinstructionbranchcomplexitylinemethod
LeafConditionItemProvider(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%
addCompareTypePropertyDescriptor(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%
addDomainModelReferencePropertyDescriptor(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%
addExpectedValuePropertyDescriptor(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: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
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: 0 C: 33
100%
M: 1 C: 5
83%
M: 1 C: 3
75%
M: 0 C: 4
100%
M: 0 C: 1
100%
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.ecp.view.spi.rule.model.LeafCondition;
22: import org.eclipse.emf.ecp.view.spi.rule.model.RulePackage;
23: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
24: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
25: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
26: import org.eclipse.emf.edit.provider.ViewerNotification;
27:
28: /**
29: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.rule.model.LeafCondition} object.
30: * <!-- begin-user-doc -->
31: *
32: * @since 1.2
33: * <!-- end-user-doc -->
34: * @generated
35: */
36: public class LeafConditionItemProvider extends ConditionItemProvider {
37:         /**
38:          * This constructs an instance from a factory and a notifier.
39:          * <!-- begin-user-doc -->
40:          * <!-- end-user-doc -->
41:          *
42:          * @generated
43:          */
44:         public LeafConditionItemProvider(AdapterFactory adapterFactory) {
45:                 super(adapterFactory);
46:         }
47:
48:         /**
49:          * This returns the property descriptors for the adapted class.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @generated
54:          */
55:         @Override
56:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
57:•                if (itemPropertyDescriptors == null) {
58:                         super.getPropertyDescriptors(object);
59:
60:                         addExpectedValuePropertyDescriptor(object);
61:                         addDomainModelReferencePropertyDescriptor(object);
62:                         addCompareTypePropertyDescriptor(object);
63:                 }
64:                 return itemPropertyDescriptors;
65:         }
66:
67:         /**
68:          * This adds a property descriptor for the Expected Value feature.
69:          * <!-- begin-user-doc -->
70:          * <!-- end-user-doc -->
71:          *
72:          * @generated
73:          */
74:         protected void addExpectedValuePropertyDescriptor(Object object) {
75:                 itemPropertyDescriptors
76:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
77:                                 getResourceLocator(),
78:                                 getString("_UI_LeafCondition_expectedValue_feature"), //$NON-NLS-1$
79:                                 getString("_UI_PropertyDescriptor_description", "_UI_LeafCondition_expectedValue_feature", //$NON-NLS-1$ //$NON-NLS-2$
80:                                         "_UI_LeafCondition_type"), //$NON-NLS-1$
81:                                 RulePackage.Literals.LEAF_CONDITION__EXPECTED_VALUE,
82:                                 true,
83:                                 false,
84:                                 false,
85:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
86:                                 null,
87:                                 null));
88:         }
89:
90:         /**
91:          * This adds a property descriptor for the Domain Model Reference feature.
92:          * <!-- begin-user-doc -->
93:          *
94:          * @since 1.21
95:          * <!-- end-user-doc -->
96:          * @generated
97:          */
98:         protected void addDomainModelReferencePropertyDescriptor(Object object) {
99:                 itemPropertyDescriptors
100:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
101:                                 getResourceLocator(),
102:                                 getString("_UI_LeafCondition_domainModelReference_feature"), //$NON-NLS-1$
103:                                 getString("_UI_PropertyDescriptor_description", "_UI_LeafCondition_domainModelReference_feature", //$NON-NLS-1$ //$NON-NLS-2$
104:                                         "_UI_LeafCondition_type"), //$NON-NLS-1$
105:                                 RulePackage.Literals.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE,
106:                                 true,
107:                                 false,
108:                                 false,
109:                                 null,
110:                                 null,
111:                                 null));
112:         }
113:
114:         /**
115:          * This adds a property descriptor for the Compare Type feature.
116:          * <!-- begin-user-doc -->
117:          *
118:          * @since 1.11
119:          * <!-- end-user-doc -->
120:          * @generated
121:          */
122:         protected void addCompareTypePropertyDescriptor(Object object) {
123:                 itemPropertyDescriptors
124:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
125:                                 getResourceLocator(),
126:                                 getString("_UI_LeafCondition_compareType_feature"), //$NON-NLS-1$
127:                                 getString("_UI_PropertyDescriptor_description", "_UI_LeafCondition_compareType_feature", //$NON-NLS-1$ //$NON-NLS-2$
128:                                         "_UI_LeafCondition_type"), //$NON-NLS-1$
129:                                 RulePackage.Literals.LEAF_CONDITION__COMPARE_TYPE,
130:                                 true,
131:                                 false,
132:                                 false,
133:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
134:                                 null,
135:                                 null));
136:         }
137:
138:         /**
139:          * This returns LeafCondition.gif.
140:          * <!-- begin-user-doc -->
141:          * <!-- end-user-doc -->
142:          *
143:          * @generated
144:          */
145:         @Override
146:         public Object getImage(Object object) {
147:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/LeafCondition")); //$NON-NLS-1$
148:         }
149:
150:         /**
151:          * This returns the label text for the adapted class.
152:          * <!-- begin-user-doc -->
153:          * <!-- end-user-doc -->
154:          *
155:          * @generated
156:          */
157:         @Override
158:         public String getText(Object object) {
159:                 final Object labelValue = ((LeafCondition) object).getExpectedValue();
160:•                final String label = labelValue == null ? null : labelValue.toString();
161:•                return label == null || label.length() == 0 ? getString("_UI_LeafCondition_type") : //$NON-NLS-1$
162:                         getString("_UI_LeafCondition_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
163:         }
164:
165:         /**
166:          * This handles model notifications by calling {@link #updateChildren} to update any cached
167:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
168:          * <!-- begin-user-doc -->
169:          * <!-- end-user-doc -->
170:          *
171:          * @generated
172:          */
173:         @Override
174:         public void notifyChanged(Notification notification) {
175:                 updateChildren(notification);
176:
177:•                switch (notification.getFeatureID(LeafCondition.class)) {
178:                 case RulePackage.LEAF_CONDITION__EXPECTED_VALUE:
179:                 case RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE:
180:                 case RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE:
181:                 case RulePackage.LEAF_CONDITION__COMPARE_TYPE:
182:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
183:                         return;
184:                 }
185:                 super.notifyChanged(notification);
186:         }
187:
188:         /**
189:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
190:          * that can be created under this object.
191:          * <!-- begin-user-doc -->
192:          * <!-- end-user-doc -->
193:          *
194:          * @generated
195:          */
196:         @Override
197:         protected void collectNewChildDescriptors(
198:                 Collection<Object> newChildDescriptors, Object object) {
199:                 super.collectNewChildDescriptors(newChildDescriptors, object);
200:         }
201:
202: }