Skip to content

Package: CustomControlItemProvider

CustomControlItemProvider

nameinstructionbranchcomplexitylinemethod
CustomControlItemProvider(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%
addBundleNamePropertyDescriptor(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%
addClassNamePropertyDescriptor(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: 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: 16 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getText(Object)
M: 26 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: 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.spi.custom.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.custom.model.VCustomControl;
22: import org.eclipse.emf.ecp.view.spi.custom.model.VCustomPackage;
23: import org.eclipse.emf.ecp.view.spi.model.provider.ControlItemProvider;
24: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
25: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
26: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
27: import org.eclipse.emf.edit.provider.ViewerNotification;
28:
29: /**
30: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.custom.model.VCustomControl} object.
31: * <!-- begin-user-doc -->
32: *
33: * @since 1.3
34: * <!-- end-user-doc -->
35: * @generated
36: */
37: public class CustomControlItemProvider
38:         extends ControlItemProvider {
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 CustomControlItemProvider(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:                         addBundleNamePropertyDescriptor(object);
63:                         addClassNamePropertyDescriptor(object);
64:                 }
65:                 return itemPropertyDescriptors;
66:         }
67:
68:         /**
69:          * This adds a property descriptor for the Bundle Name feature.
70:          * <!-- begin-user-doc -->
71:          * <!-- end-user-doc -->
72:          *
73:          * @generated
74:          */
75:         protected void addBundleNamePropertyDescriptor(Object object) {
76:                 itemPropertyDescriptors
77:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
78:                                 getResourceLocator(),
79:                                 getString("_UI_CustomControl_bundleName_feature"), //$NON-NLS-1$
80:                                 getString("_UI_PropertyDescriptor_description", "_UI_CustomControl_bundleName_feature", //$NON-NLS-1$ //$NON-NLS-2$
81:                                         "_UI_CustomControl_type"), //$NON-NLS-1$
82:                                 VCustomPackage.Literals.CUSTOM_CONTROL__BUNDLE_NAME,
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 Class Name feature.
93:          * <!-- begin-user-doc -->
94:          * <!-- end-user-doc -->
95:          *
96:          * @generated
97:          */
98:         protected void addClassNamePropertyDescriptor(Object object) {
99:                 itemPropertyDescriptors
100:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
101:                                 getResourceLocator(),
102:                                 getString("_UI_CustomControl_className_feature"), //$NON-NLS-1$
103:                                 getString("_UI_PropertyDescriptor_description", "_UI_CustomControl_className_feature", //$NON-NLS-1$ //$NON-NLS-2$
104:                                         "_UI_CustomControl_type"), //$NON-NLS-1$
105:                                 VCustomPackage.Literals.CUSTOM_CONTROL__CLASS_NAME,
106:                                 true,
107:                                 false,
108:                                 false,
109:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
110:                                 null,
111:                                 null));
112:         }
113:
114:         /**
115:          * This returns CustomControl.gif.
116:          * <!-- begin-user-doc -->
117:          * <!-- end-user-doc -->
118:          *
119:          * @generated
120:          */
121:         @Override
122:         public Object getImage(Object object) {
123:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/CustomControl")); //$NON-NLS-1$
124:         }
125:
126:         /**
127:          * This returns the label text for the adapted class.
128:          * <!-- begin-user-doc -->
129:          * <!-- end-user-doc -->
130:          *
131:          * @generated
132:          */
133:         @Override
134:         public String getText(Object object) {
135:                 final String label = ((VCustomControl) object).getName();
136:•                return label == null || label.length() == 0 ? getString("_UI_CustomControl_type") : //$NON-NLS-1$
137:                         getString("_UI_CustomControl_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
138:         }
139:
140:         /**
141:          * This handles model notifications by calling {@link #updateChildren} to update any cached
142:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
143:          * <!-- begin-user-doc -->
144:          * <!-- end-user-doc -->
145:          *
146:          * @generated
147:          */
148:         @Override
149:         public void notifyChanged(Notification notification) {
150:                 updateChildren(notification);
151:
152:•                switch (notification.getFeatureID(VCustomControl.class)) {
153:                 case VCustomPackage.CUSTOM_CONTROL__BUNDLE_NAME:
154:                 case VCustomPackage.CUSTOM_CONTROL__CLASS_NAME:
155:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
156:                         return;
157:                 }
158:                 super.notifyChanged(notification);
159:         }
160:
161:         /**
162:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
163:          * that can be created under this object.
164:          * <!-- begin-user-doc -->
165:          * <!-- end-user-doc -->
166:          *
167:          * @generated
168:          */
169:         @Override
170:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
171:                 super.collectNewChildDescriptors(newChildDescriptors, object);
172:         }
173:
174: }