Skip to content

Package: MultiDomainModelReferenceSegmentItemProvider

MultiDomainModelReferenceSegmentItemProvider

nameinstructionbranchcomplexitylinemethod
MultiDomainModelReferenceSegmentItemProvider(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%
collectNewChildDescriptors(Collection, Object)
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getChildFeature(Object, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getChildrenFeatures(Object)
M: 15 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 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: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getText(Object)
M: 22 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 3 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-2019 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.view.spi.multisegment.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.ecore.EStructuralFeature;
22: import org.eclipse.emf.ecp.view.spi.model.VViewFactory;
23: import org.eclipse.emf.ecp.view.spi.model.provider.FeatureDomainModelReferenceSegmentItemProvider;
24: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
25: import org.eclipse.emf.edit.provider.ViewerNotification;
26: import org.eclipse.emfforms.view.spi.multisegment.model.VMultiDomainModelReferenceSegment;
27: import org.eclipse.emfforms.view.spi.multisegment.model.VMultisegmentPackage;
28:
29: /**
30: * This is the item provider adapter for a
31: * {@link org.eclipse.emfforms.view.spi.multisegment.model.VMultiDomainModelReferenceSegment} object.
32: * <!-- begin-user-doc -->
33: * <!-- end-user-doc -->
34: *
35: * @generated
36: */
37: public class MultiDomainModelReferenceSegmentItemProvider extends FeatureDomainModelReferenceSegmentItemProvider {
38:         /**
39:          * This constructs an instance from a factory and a notifier.
40:          * <!-- begin-user-doc -->
41:          * <!-- end-user-doc -->
42:          *
43:          * @generated
44:          */
45:         public MultiDomainModelReferenceSegmentItemProvider(AdapterFactory adapterFactory) {
46:                 super(adapterFactory);
47:         }
48:
49:         /**
50:          * This returns the property descriptors for the adapted class.
51:          * <!-- begin-user-doc -->
52:          * <!-- end-user-doc -->
53:          *
54:          * @generated
55:          */
56:         @Override
57:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
58:•                if (itemPropertyDescriptors == null) {
59:                         super.getPropertyDescriptors(object);
60:
61:                 }
62:                 return itemPropertyDescriptors;
63:         }
64:
65:         /**
66:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
67:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
68:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
69:          * <!-- begin-user-doc -->
70:          * <!-- end-user-doc -->
71:          *
72:          * @generated
73:          */
74:         @Override
75:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
76:•                if (childrenFeatures == null) {
77:                         super.getChildrenFeatures(object);
78:                         childrenFeatures
79:                                 .add(VMultisegmentPackage.Literals.MULTI_DOMAIN_MODEL_REFERENCE_SEGMENT__CHILD_DOMAIN_MODEL_REFERENCES);
80:                 }
81:                 return childrenFeatures;
82:         }
83:
84:         /**
85:          * <!-- begin-user-doc -->
86:          * <!-- end-user-doc -->
87:          *
88:          * @generated
89:          */
90:         @Override
91:         protected EStructuralFeature getChildFeature(Object object, Object child) {
92:                 // Check the type of the specified child object and return the proper feature to use for
93:                 // adding (see {@link AddCommand}) it as a child.
94:
95:                 return super.getChildFeature(object, child);
96:         }
97:
98:         /**
99:          * This returns MultiDomainModelReferenceSegment.gif.
100:          * <!-- begin-user-doc -->
101:          * <!-- end-user-doc -->
102:          *
103:          * @generated
104:          */
105:         @Override
106:         public Object getImage(Object object) {
107:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/MultiDomainModelReferenceSegment")); //$NON-NLS-1$
108:         }
109:
110:         /**
111:          * This returns the label text for the adapted class.
112:          * <!-- begin-user-doc -->
113:          * <!-- end-user-doc -->
114:          *
115:          * @generated NOT
116:          */
117:         @Override
118:         public String getText(Object object) {
119:                 final String label = ((VMultiDomainModelReferenceSegment) object).getDomainModelFeature();
120:•                return label == null || label.length() == 0 ? getString("_UI_MultiDomainModelReferenceSegment_type") : //$NON-NLS-1$
121:                         label + "[]"; //$NON-NLS-1$
122:         }
123:
124:         /**
125:          * This handles model notifications by calling {@link #updateChildren} to update any cached
126:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
127:          * <!-- begin-user-doc -->
128:          * <!-- end-user-doc -->
129:          *
130:          * @generated
131:          */
132:         @Override
133:         public void notifyChanged(Notification notification) {
134:                 updateChildren(notification);
135:
136:•                switch (notification.getFeatureID(VMultiDomainModelReferenceSegment.class)) {
137:                 case VMultisegmentPackage.MULTI_DOMAIN_MODEL_REFERENCE_SEGMENT__CHILD_DOMAIN_MODEL_REFERENCES:
138:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
139:                         return;
140:                 }
141:                 super.notifyChanged(notification);
142:         }
143:
144:         /**
145:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
146:          * that can be created under this object.
147:          * <!-- begin-user-doc -->
148:          * <!-- end-user-doc -->
149:          *
150:          * @generated
151:          */
152:         @Override
153:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
154:                 super.collectNewChildDescriptors(newChildDescriptors, object);
155:
156:                 newChildDescriptors.add(createChildParameter(
157:                         VMultisegmentPackage.Literals.MULTI_DOMAIN_MODEL_REFERENCE_SEGMENT__CHILD_DOMAIN_MODEL_REFERENCES,
158:                         VViewFactory.eINSTANCE.createFeaturePathDomainModelReference()));
159:         }
160:
161: }