Skip to content

Package: MachineItemProvider

MachineItemProvider

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