Skip to content

Package: ActionItemProvider

ActionItemProvider

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