Skip to content

Package: EnableRuleItemProvider

EnableRuleItemProvider

nameinstructionbranchcomplexitylinemethod
EnableRuleItemProvider(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%
addDisablePropertyDescriptor(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: 13
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getText(Object)
M: 0 C: 17
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
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: * 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.EnableRule;
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.EnableRule} object.
30: * <!-- begin-user-doc -->
31: *
32: * @since 1.2
33: * <!-- end-user-doc -->
34: * @generated
35: */
36: public class EnableRuleItemProvider extends RuleItemProvider {
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 EnableRuleItemProvider(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:                         addDisablePropertyDescriptor(object);
61:                 }
62:                 return itemPropertyDescriptors;
63:         }
64:
65:         /**
66:          * This adds a property descriptor for the Disable feature.
67:          * <!-- begin-user-doc -->
68:          * <!-- end-user-doc -->
69:          *
70:          * @generated
71:          */
72:         protected void addDisablePropertyDescriptor(Object object) {
73:                 itemPropertyDescriptors
74:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
75:                                 getResourceLocator(),
76:                                 getString("_UI_EnableRule_disable_feature"), //$NON-NLS-1$
77:                                 getString("_UI_PropertyDescriptor_description", "_UI_EnableRule_disable_feature", //$NON-NLS-1$ //$NON-NLS-2$
78:                                         "_UI_EnableRule_type"), //$NON-NLS-1$
79:                                 RulePackage.Literals.ENABLE_RULE__DISABLE,
80:                                 true,
81:                                 false,
82:                                 false,
83:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
84:                                 null,
85:                                 null));
86:         }
87:
88:         /**
89:          * This returns EnableRule.gif.
90:          * <!-- begin-user-doc -->
91:          * <!-- end-user-doc -->
92:          *
93:          * @generated
94:          */
95:         @Override
96:         public Object getImage(Object object) {
97:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/EnableRule")); //$NON-NLS-1$
98:         }
99:
100:         /**
101:          * This returns the label text for the adapted class.
102:          * <!-- begin-user-doc -->
103:          * <!-- end-user-doc -->
104:          *
105:          * @generated
106:          */
107:         @Override
108:         public String getText(Object object) {
109:                 EnableRule enableRule = (EnableRule) object;
110:                 return getString("_UI_EnableRule_type") + " " + enableRule.isDisable(); //$NON-NLS-1$ //$NON-NLS-2$
111:         }
112:
113:         /**
114:          * This handles model notifications by calling {@link #updateChildren} to update any cached
115:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
116:          * <!-- begin-user-doc -->
117:          * <!-- end-user-doc -->
118:          *
119:          * @generated
120:          */
121:         @Override
122:         public void notifyChanged(Notification notification) {
123:                 updateChildren(notification);
124:
125:•                switch (notification.getFeatureID(EnableRule.class)) {
126:                 case RulePackage.ENABLE_RULE__DISABLE:
127:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
128:                         return;
129:                 }
130:                 super.notifyChanged(notification);
131:         }
132:
133:         /**
134:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
135:          * that can be created under this object.
136:          * <!-- begin-user-doc -->
137:          * <!-- end-user-doc -->
138:          *
139:          * @generated
140:          */
141:         @Override
142:         protected void collectNewChildDescriptors(
143:                 Collection<Object> newChildDescriptors, Object object) {
144:                 super.collectNewChildDescriptors(newChildDescriptors, object);
145:         }
146:
147: }