Skip to content

Package: ControlLabelAlignmentStylePropertyItemProvider

ControlLabelAlignmentStylePropertyItemProvider

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