Skip to content

Package: KeyAttributeDomainModelReferenceItemProvider

KeyAttributeDomainModelReferenceItemProvider

nameinstructionbranchcomplexitylinemethod
KeyAttributeDomainModelReferenceItemProvider(AdapterFactory)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
addKeyDMRPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addKeyValuePropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
addValueDMRPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
collectNewChildDescriptors(Collection, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getImage(Object)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPropertyDescriptors(Object)
M: 19 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getText(Object)
M: 33 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
notifyChanged(Notification)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (c) 2011-2014 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: * Eugen Neufeld - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.keyattributedmr.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.keyattributedmr.model.VKeyAttributeDomainModelReference;
22: import org.eclipse.emf.ecp.view.spi.keyattributedmr.model.VKeyattributedmrPackage;
23: import org.eclipse.emf.ecp.view.spi.model.provider.FeaturePathDomainModelReferenceItemProvider;
24: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
25: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
26: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
27: import org.eclipse.emf.edit.provider.ViewerNotification;
28:
29: /**
30: * This is the item provider adapter for a
31: * {@link org.eclipse.emf.ecp.view.spi.keyattributedmr.model.VKeyAttributeDomainModelReference} object.
32: * <!-- begin-user-doc --> <!-- end-user-doc -->
33: *
34: * @generated
35: */
36: public class KeyAttributeDomainModelReferenceItemProvider extends
37:         FeaturePathDomainModelReferenceItemProvider {
38:         /**
39:          * This constructs an instance from a factory and a notifier. <!--
40:          * begin-user-doc --> <!-- end-user-doc -->
41:          *
42:          * @generated
43:          */
44:         public KeyAttributeDomainModelReferenceItemProvider(
45:                 AdapterFactory adapterFactory) {
46:                 super(adapterFactory);
47:         }
48:
49:         /**
50:          * This returns the property descriptors for the adapted class. <!--
51:          * begin-user-doc --> <!-- 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:                         addKeyDMRPropertyDescriptor(object);
61:                         addKeyValuePropertyDescriptor(object);
62:                         addValueDMRPropertyDescriptor(object);
63:                 }
64:                 return itemPropertyDescriptors;
65:         }
66:
67:         /**
68:          * This adds a property descriptor for the Key DMR feature.
69:          * <!-- begin-user-doc -->
70:          * <!-- end-user-doc -->
71:          *
72:          * @generated
73:          */
74:         protected void addKeyDMRPropertyDescriptor(Object object) {
75:                 itemPropertyDescriptors
76:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
77:                                 getResourceLocator(),
78:                                 getString("_UI_KeyAttributeDomainModelReference_keyDMR_feature"), //$NON-NLS-1$
79:                                 getString("_UI_PropertyDescriptor_description", "_UI_KeyAttributeDomainModelReference_keyDMR_feature", //$NON-NLS-1$ //$NON-NLS-2$
80:                                         "_UI_KeyAttributeDomainModelReference_type"), //$NON-NLS-1$
81:                                 VKeyattributedmrPackage.Literals.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR,
82:                                 true,
83:                                 false,
84:                                 false,
85:                                 null,
86:                                 null,
87:                                 null));
88:         }
89:
90:         /**
91:          * This adds a property descriptor for the Key Value feature.
92:          * <!-- begin-user-doc -->
93:          * <!-- end-user-doc -->
94:          *
95:          * @generated
96:          */
97:         protected void addKeyValuePropertyDescriptor(Object object) {
98:                 itemPropertyDescriptors
99:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
100:                                 getResourceLocator(),
101:                                 getString("_UI_KeyAttributeDomainModelReference_keyValue_feature"), //$NON-NLS-1$
102:                                 getString("_UI_PropertyDescriptor_description", "_UI_KeyAttributeDomainModelReference_keyValue_feature", //$NON-NLS-1$ //$NON-NLS-2$
103:                                         "_UI_KeyAttributeDomainModelReference_type"), //$NON-NLS-1$
104:                                 VKeyattributedmrPackage.Literals.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE,
105:                                 true,
106:                                 false,
107:                                 false,
108:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
109:                                 null,
110:                                 null));
111:         }
112:
113:         /**
114:          * This adds a property descriptor for the Value DMR feature.
115:          * <!-- begin-user-doc -->
116:          * <!-- end-user-doc -->
117:          *
118:          * @generated
119:          */
120:         protected void addValueDMRPropertyDescriptor(Object object) {
121:                 itemPropertyDescriptors
122:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
123:                                 getResourceLocator(),
124:                                 getString("_UI_KeyAttributeDomainModelReference_valueDMR_feature"), //$NON-NLS-1$
125:                                 getString("_UI_PropertyDescriptor_description", "_UI_KeyAttributeDomainModelReference_valueDMR_feature", //$NON-NLS-1$ //$NON-NLS-2$
126:                                         "_UI_KeyAttributeDomainModelReference_type"), //$NON-NLS-1$
127:                                 VKeyattributedmrPackage.Literals.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR,
128:                                 true,
129:                                 false,
130:                                 false,
131:                                 null,
132:                                 null,
133:                                 null));
134:         }
135:
136:         /**
137:          * This returns KeyAttributeDomainModelReference.gif.
138:          * <!-- begin-user-doc
139:          * --> <!-- end-user-doc -->
140:          *
141:          * @generated
142:          */
143:         @Override
144:         public Object getImage(Object object) {
145:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/KeyAttributeDomainModelReference")); //$NON-NLS-1$
146:         }
147:
148:         /**
149:          * This returns the label text for the adapted class.
150:          * <!-- begin-user-doc
151:          * --> <!-- end-user-doc -->
152:          *
153:          * @generated
154:          */
155:         @Override
156:         public String getText(Object object) {
157:                 final Object labelValue = ((VKeyAttributeDomainModelReference) object).getKeyValue();
158:•                final String label = labelValue == null ? null : labelValue.toString();
159:•                return label == null || label.length() == 0 ? getString("_UI_KeyAttributeDomainModelReference_type") : //$NON-NLS-1$
160:                         getString("_UI_KeyAttributeDomainModelReference_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
161:         }
162:
163:         /**
164:          * This handles model notifications by calling {@link #updateChildren} to update any cached
165:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
166:          * <!-- begin-user-doc --> <!--
167:          * end-user-doc -->
168:          *
169:          * @generated
170:          */
171:         @Override
172:         public void notifyChanged(Notification notification) {
173:                 updateChildren(notification);
174:
175:•                switch (notification.getFeatureID(VKeyAttributeDomainModelReference.class)) {
176:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR:
177:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE:
178:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR:
179:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
180:                         return;
181:                 }
182:                 super.notifyChanged(notification);
183:         }
184:
185:         /**
186:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
187:          * describing the children that can be created under this object. <!--
188:          * begin-user-doc --> <!-- end-user-doc -->
189:          *
190:          * @generated
191:          */
192:         @Override
193:         protected void collectNewChildDescriptors(
194:                 Collection<Object> newChildDescriptors, Object object) {
195:                 super.collectNewChildDescriptors(newChildDescriptors, object);
196:         }
197:
198: }