Skip to content

Package: ControlItemProvider

ControlItemProvider

nameinstructionbranchcomplexitylinemethod
ControlItemProvider(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%
addDomainModelReferencePropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 14
100%
M: 0 C: 1
100%
addLabelAlignmentPropertyDescriptor(Object)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 14
100%
M: 0 C: 1
100%
collectNewChildDescriptors(Collection, Object)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
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: 0 C: 16
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
getText(Object)
M: 0 C: 23
100%
M: 1 C: 5
83%
M: 1 C: 3
75%
M: 0 C: 4
100%
M: 0 C: 1
100%
notifyChanged(Notification)
M: 0 C: 22
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2013 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 Muenchen GmbH - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.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.VControl;
22: import org.eclipse.emf.ecp.view.spi.model.VElement;
23: import org.eclipse.emf.ecp.view.spi.model.VElementUtil;
24: import org.eclipse.emf.ecp.view.spi.model.VViewPackage;
25: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
26: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
27: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
28: import org.eclipse.emf.edit.provider.ViewerNotification;
29:
30: /**
31: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.model.VControl} object.
32: * <!-- begin-user-doc -->
33: *
34: * @since 1.2
35: * <!-- end-user-doc -->
36: * @generated
37: */
38: public class ControlItemProvider extends ContainedElementItemProvider {
39:         /**
40:          * This constructs an instance from a factory and a notifier.
41:          * <!-- begin-user-doc -->
42:          * <!-- end-user-doc -->
43:          *
44:          * @generated
45:          */
46:         public ControlItemProvider(AdapterFactory adapterFactory) {
47:                 super(adapterFactory);
48:         }
49:
50:         /**
51:          * This returns the property descriptors for the adapted class.
52:          * <!-- begin-user-doc -->
53:          * <!-- end-user-doc -->
54:          *
55:          * @generated
56:          */
57:         @Override
58:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
59:•                if (itemPropertyDescriptors == null) {
60:                         super.getPropertyDescriptors(object);
61:
62:                         addLabelAlignmentPropertyDescriptor(object);
63:                         addDomainModelReferencePropertyDescriptor(object);
64:                 }
65:                 return itemPropertyDescriptors;
66:         }
67:
68:         /**
69:          * This adds a property descriptor for the Label Alignment feature.
70:          * <!-- begin-user-doc -->
71:          * <!-- end-user-doc -->
72:          *
73:          * @generated
74:          */
75:         protected void addLabelAlignmentPropertyDescriptor(Object object) {
76:                 itemPropertyDescriptors
77:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
78:                                 getResourceLocator(),
79:                                 getString("_UI_Control_labelAlignment_feature"), //$NON-NLS-1$
80:                                 getString("_UI_PropertyDescriptor_description", "_UI_Control_labelAlignment_feature", //$NON-NLS-1$ //$NON-NLS-2$
81:                                         "_UI_Control_type"), //$NON-NLS-1$
82:                                 VViewPackage.Literals.CONTROL__LABEL_ALIGNMENT,
83:                                 true,
84:                                 false,
85:                                 false,
86:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
87:                                 null,
88:                                 null));
89:         }
90:
91:         /**
92:          * This adds a property descriptor for the Domain Model Reference feature.
93:          * <!-- begin-user-doc -->
94:          *
95:          * @since 1.4
96:          * <!-- end-user-doc -->
97:          * @generated
98:          */
99:         protected void addDomainModelReferencePropertyDescriptor(Object object) {
100:                 itemPropertyDescriptors
101:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
102:                                 getResourceLocator(),
103:                                 getString("_UI_Control_domainModelReference_feature"), //$NON-NLS-1$
104:                                 getString("_UI_PropertyDescriptor_description", "_UI_Control_domainModelReference_feature", //$NON-NLS-1$ //$NON-NLS-2$
105:                                         "_UI_Control_type"), //$NON-NLS-1$
106:                                 VViewPackage.Literals.CONTROL__DOMAIN_MODEL_REFERENCE,
107:                                 true,
108:                                 false,
109:                                 false,
110:                                 null,
111:                                 null,
112:                                 null));
113:         }
114:
115:         /**
116:          * This returns Control.gif.
117:          * <!-- begin-user-doc -->
118:          * <!-- end-user-doc -->
119:          *
120:          * @generated
121:          */
122:         @Override
123:         public Object getImage(Object object) {
124:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/Control")); //$NON-NLS-1$
125:         }
126:
127:         /**
128:          * This returns the label text for the adapted class.
129:          * <!-- begin-user-doc -->
130:          * <!-- end-user-doc -->
131:          *
132:          * @generated NOT
133:          * @param object the adapted class
134:          * @return the label text
135:          */
136:         @Override
137:         public String getText(Object object) {
138:                 String label = ((VControl) object).getName();
139:•                if (label == null) {
140:                         label = VElementUtil.getCleanName(VElement.class.cast(object));
141:                 }
142:•                return label == null || label.length() == 0 ? getString("_UI_Control_type") : label; //$NON-NLS-1$
143:         }
144:
145:         /**
146:          * This handles model notifications by calling {@link #updateChildren} to update any cached
147:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
148:          * <!-- begin-user-doc -->
149:          * <!-- end-user-doc -->
150:          *
151:          * @generated
152:          */
153:         @Override
154:         public void notifyChanged(Notification notification) {
155:                 updateChildren(notification);
156:
157:•                switch (notification.getFeatureID(VControl.class)) {
158:                 case VViewPackage.CONTROL__LABEL_ALIGNMENT:
159:                 case VViewPackage.CONTROL__DOMAIN_MODEL_REFERENCE:
160:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
161:                         return;
162:                 }
163:                 super.notifyChanged(notification);
164:         }
165:
166:         /**
167:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
168:          * that can be created under this object.
169:          * <!-- begin-user-doc -->
170:          * <!-- end-user-doc -->
171:          *
172:          * @generated
173:          */
174:         @Override
175:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
176:                 super.collectNewChildDescriptors(newChildDescriptors, object);
177:         }
178:
179: }