Skip to content

Package: ActivityItemProvider

ActivityItemProvider

nameinstructionbranchcomplexitylinemethod
ActivityItemProvider(AdapterFactory)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
addNamePropertyDescriptor(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: 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: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
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: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 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: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

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