Skip to content

Package: ShowRuleItemProvider

ShowRuleItemProvider

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