Skip to content

Package: IndexDomainModelReferenceSegmentItemProvider

IndexDomainModelReferenceSegmentItemProvider

nameinstructionbranchcomplexitylinemethod
IndexDomainModelReferenceSegmentItemProvider(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%
addIndexPropertyDescriptor(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: 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: 31 C: 0
0%
M: 4 C: 0
0%
M: 3 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-2018 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: * Lucas Koehler - initial API and implementation
13: */
14: package org.eclipse.emfforms.spi.view.indexsegment.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.model.provider.FeatureDomainModelReferenceSegmentItemProvider;
22: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
23: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
24: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
25: import org.eclipse.emf.edit.provider.ViewerNotification;
26: import org.eclipse.emfforms.spi.view.indexsegment.model.VIndexDomainModelReferenceSegment;
27: import org.eclipse.emfforms.spi.view.indexsegment.model.VIndexsegmentPackage;
28:
29: /**
30: * This is the item provider adapter for a
31: * {@link org.eclipse.emfforms.spi.view.indexsegment.model.VIndexDomainModelReferenceSegment} object.
32: * <!-- begin-user-doc --> <!-- end-user-doc -->
33: *
34: * @generated
35: */
36: public class IndexDomainModelReferenceSegmentItemProvider extends FeatureDomainModelReferenceSegmentItemProvider {
37:         /**
38:          * This constructs an instance from a factory and a notifier. <!--
39:          * begin-user-doc --> <!-- end-user-doc -->
40:          *
41:          * @generated
42:          */
43:         public IndexDomainModelReferenceSegmentItemProvider(AdapterFactory adapterFactory) {
44:                 super(adapterFactory);
45:         }
46:
47:         /**
48:          * This returns the property descriptors for the adapted class. <!--
49:          * begin-user-doc --> <!-- end-user-doc -->
50:          *
51:          * @generated
52:          */
53:         @Override
54:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
55:•                if (itemPropertyDescriptors == null) {
56:                         super.getPropertyDescriptors(object);
57:
58:                         addIndexPropertyDescriptor(object);
59:                 }
60:                 return itemPropertyDescriptors;
61:         }
62:
63:         /**
64:          * This adds a property descriptor for the Index feature.
65:          * <!-- begin-user-doc
66:          * --> <!-- end-user-doc -->
67:          *
68:          * @generated
69:          */
70:         protected void addIndexPropertyDescriptor(Object object) {
71:                 itemPropertyDescriptors
72:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
73:                                 getResourceLocator(),
74:                                 getString("_UI_IndexDomainModelReferenceSegment_index_feature"), //$NON-NLS-1$
75:                                 getString("_UI_PropertyDescriptor_description", "_UI_IndexDomainModelReferenceSegment_index_feature", //$NON-NLS-1$ //$NON-NLS-2$
76:                                         "_UI_IndexDomainModelReferenceSegment_type"), //$NON-NLS-1$
77:                                 VIndexsegmentPackage.Literals.INDEX_DOMAIN_MODEL_REFERENCE_SEGMENT__INDEX,
78:                                 true,
79:                                 false,
80:                                 false,
81:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
82:                                 null,
83:                                 null));
84:         }
85:
86:         /**
87:          * This returns IndexDomainModelReferenceSegment.gif.
88:          * <!-- begin-user-doc -->
89:          * <!-- end-user-doc -->
90:          *
91:          * @generated
92:          */
93:         @Override
94:         public Object getImage(Object object) {
95:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/IndexDomainModelReferenceSegment")); //$NON-NLS-1$
96:         }
97:
98:         /**
99:          * This returns the label text for the adapted class.
100:          * <!-- begin-user-doc -->
101:          * <!-- end-user-doc -->
102:          *
103:          * @generated NOT
104:          */
105:         @Override
106:         public String getText(Object object) {
107:                 final String label = ((VIndexDomainModelReferenceSegment) object).getDomainModelFeature();
108:                 final int index = ((VIndexDomainModelReferenceSegment) object).getIndex();
109:•                return label == null || label.length() == 0 ? getString("_UI_IndexDomainModelReferenceSegment_type") : //$NON-NLS-1$
110:                         String.format("%s[%d]", label, index); //$NON-NLS-1$
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 --> <!-- end-user-doc -->
117:          *
118:          * @generated
119:          */
120:         @Override
121:         public void notifyChanged(Notification notification) {
122:                 updateChildren(notification);
123:
124:•                switch (notification.getFeatureID(VIndexDomainModelReferenceSegment.class)) {
125:                 case VIndexsegmentPackage.INDEX_DOMAIN_MODEL_REFERENCE_SEGMENT__INDEX:
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(Collection<Object> newChildDescriptors, Object object) {
142:                 super.collectNewChildDescriptors(newChildDescriptors, object);
143:         }
144:
145: }