Skip to content

Package: AnnotationSelectorItemProvider

AnnotationSelectorItemProvider

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