Skip to content

Package: MandatoryStylePropertyItemProvider

MandatoryStylePropertyItemProvider

nameinstructionbranchcomplexitylinemethod
MandatoryStylePropertyItemProvider(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%
addHighliteMandatoryFieldsPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 15 C: 0
0%
M: 1 C: 0
0%
addMandatoryMarkerPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 15 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: 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: 16 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getResourceLocator()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
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-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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.template.style.mandatory.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.common.util.ResourceLocator;
22: import org.eclipse.emf.ecp.view.template.style.mandatory.model.VTMandatoryPackage;
23: import org.eclipse.emf.ecp.view.template.style.mandatory.model.VTMandatoryStyleProperty;
24: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
25: import org.eclipse.emf.edit.provider.IChildCreationExtender;
26: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
27: import org.eclipse.emf.edit.provider.IItemLabelProvider;
28: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
29: import org.eclipse.emf.edit.provider.IItemPropertySource;
30: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
31: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
32: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
33: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
34: import org.eclipse.emf.edit.provider.ViewerNotification;
35:
36: /**
37: * This is the item provider adapter for a
38: * {@link org.eclipse.emf.ecp.view.template.style.mandatory.model.VTMandatoryStyleProperty} object.
39: * <!-- begin-user-doc -->
40: * <!-- end-user-doc -->
41: *
42: * @generated
43: */
44: public class MandatoryStylePropertyItemProvider
45:         extends ItemProviderAdapter
46:         implements
47:         IEditingDomainItemProvider,
48:         IStructuredItemContentProvider,
49:         ITreeItemContentProvider,
50:         IItemLabelProvider,
51:         IItemPropertySource {
52:         /**
53:          * This constructs an instance from a factory and a notifier.
54:          * <!-- begin-user-doc -->
55:          * <!-- end-user-doc -->
56:          *
57:          * @generated
58:          */
59:         public MandatoryStylePropertyItemProvider(AdapterFactory adapterFactory) {
60:                 super(adapterFactory);
61:         }
62:
63:         /**
64:          * This returns the property descriptors for the adapted class.
65:          * <!-- begin-user-doc -->
66:          * <!-- end-user-doc -->
67:          *
68:          * @generated
69:          */
70:         @Override
71:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
72:•                if (itemPropertyDescriptors == null) {
73:                         super.getPropertyDescriptors(object);
74:
75:                         addHighliteMandatoryFieldsPropertyDescriptor(object);
76:                         addMandatoryMarkerPropertyDescriptor(object);
77:                 }
78:                 return itemPropertyDescriptors;
79:         }
80:
81:         /**
82:          * This adds a property descriptor for the Highlite Mandatory Fields feature.
83:          * <!-- begin-user-doc -->
84:          * <!-- end-user-doc -->
85:          *
86:          * @generated
87:          */
88:         protected void addHighliteMandatoryFieldsPropertyDescriptor(Object object) {
89:                 itemPropertyDescriptors
90:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
91:                                 getResourceLocator(),
92:                                 getString("_UI_MandatoryStyleProperty_highliteMandatoryFields_feature"), //$NON-NLS-1$
93:                                 getString(
94:                                         "_UI_PropertyDescriptor_description", "_UI_MandatoryStyleProperty_highliteMandatoryFields_feature", //$NON-NLS-1$ //$NON-NLS-2$
95:                                         "_UI_MandatoryStyleProperty_type"), //$NON-NLS-1$
96:                                 VTMandatoryPackage.Literals.MANDATORY_STYLE_PROPERTY__HIGHLITE_MANDATORY_FIELDS,
97:                                 true,
98:                                 false,
99:                                 false,
100:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
101:                                 null,
102:                                 null));
103:         }
104:
105:         /**
106:          * This adds a property descriptor for the Mandatory Marker feature.
107:          * <!-- begin-user-doc -->
108:          * <!-- end-user-doc -->
109:          *
110:          * @generated
111:          */
112:         protected void addMandatoryMarkerPropertyDescriptor(Object object) {
113:                 itemPropertyDescriptors
114:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
115:                                 getResourceLocator(),
116:                                 getString("_UI_MandatoryStyleProperty_mandatoryMarker_feature"), //$NON-NLS-1$
117:                                 getString(
118:                                         "_UI_PropertyDescriptor_description", "_UI_MandatoryStyleProperty_mandatoryMarker_feature", //$NON-NLS-1$ //$NON-NLS-2$
119:                                         "_UI_MandatoryStyleProperty_type"), //$NON-NLS-1$
120:                                 VTMandatoryPackage.Literals.MANDATORY_STYLE_PROPERTY__MANDATORY_MARKER,
121:                                 true,
122:                                 false,
123:                                 false,
124:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
125:                                 null,
126:                                 null));
127:         }
128:
129:         /**
130:          * This returns MandatoryStyleProperty.gif.
131:          * <!-- begin-user-doc -->
132:          * <!-- end-user-doc -->
133:          *
134:          * @generated
135:          */
136:         @Override
137:         public Object getImage(Object object) {
138:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/MandatoryStyleProperty")); //$NON-NLS-1$
139:         }
140:
141:         /**
142:          * This returns the label text for the adapted class.
143:          * <!-- begin-user-doc -->
144:          * <!-- end-user-doc -->
145:          *
146:          * @generated
147:          */
148:         @Override
149:         public String getText(Object object) {
150:                 final VTMandatoryStyleProperty mandatoryStyleProperty = (VTMandatoryStyleProperty) object;
151:                 return getString("_UI_MandatoryStyleProperty_type") + " " + mandatoryStyleProperty.isHighliteMandatoryFields(); //$NON-NLS-1$ //$NON-NLS-2$
152:         }
153:
154:         /**
155:          * This handles model notifications by calling {@link #updateChildren} to update any cached
156:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
157:          * <!-- begin-user-doc -->
158:          * <!-- end-user-doc -->
159:          *
160:          * @generated
161:          */
162:         @Override
163:         public void notifyChanged(Notification notification) {
164:                 updateChildren(notification);
165:
166:•                switch (notification.getFeatureID(VTMandatoryStyleProperty.class)) {
167:                 case VTMandatoryPackage.MANDATORY_STYLE_PROPERTY__HIGHLITE_MANDATORY_FIELDS:
168:                 case VTMandatoryPackage.MANDATORY_STYLE_PROPERTY__MANDATORY_MARKER:
169:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
170:                         return;
171:                 }
172:                 super.notifyChanged(notification);
173:         }
174:
175:         /**
176:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
177:          * that can be created under this object.
178:          * <!-- begin-user-doc -->
179:          * <!-- end-user-doc -->
180:          *
181:          * @generated
182:          */
183:         @Override
184:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
185:                 super.collectNewChildDescriptors(newChildDescriptors, object);
186:         }
187:
188:         /**
189:          * Return the resource locator for this item provider's resources.
190:          * <!-- begin-user-doc -->
191:          * <!-- end-user-doc -->
192:          *
193:          * @generated
194:          */
195:         @Override
196:         public ResourceLocator getResourceLocator() {
197:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
198:         }
199:
200: }