Skip to content

Package: KeyBindingItemProvider

KeyBindingItemProvider

nameinstructionbranchcomplexitylinemethod
KeyBindingItemProvider(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%
addIdPropertyDescriptor(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%
addKeySequencePropertyDescriptor(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: 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: 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: 5 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: * Johannes Faltermeier - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.template.style.keybinding.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.style.keybinding.model.VTKeyBinding;
23: import org.eclipse.emf.ecp.view.template.style.keybinding.model.VTKeybindingPackage;
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.template.style.keybinding.model.VTKeyBinding}
38: * object.
39: * <!-- begin-user-doc -->
40: *
41: * @since 1.18
42: * <!-- end-user-doc -->
43: * @generated
44: */
45: public class KeyBindingItemProvider
46:         extends ItemProviderAdapter
47:         implements
48:         IEditingDomainItemProvider,
49:         IStructuredItemContentProvider,
50:         ITreeItemContentProvider,
51:         IItemLabelProvider,
52:         IItemPropertySource {
53:         /**
54:          * This constructs an instance from a factory and a notifier.
55:          * <!-- begin-user-doc -->
56:          * <!-- end-user-doc -->
57:          *
58:          * @generated
59:          */
60:         public KeyBindingItemProvider(AdapterFactory adapterFactory) {
61:                 super(adapterFactory);
62:         }
63:
64:         /**
65:          * This returns the property descriptors for the adapted class.
66:          * <!-- begin-user-doc -->
67:          * <!-- end-user-doc -->
68:          *
69:          * @generated
70:          */
71:         @Override
72:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
73:•                if (itemPropertyDescriptors == null) {
74:                         super.getPropertyDescriptors(object);
75:
76:                         addIdPropertyDescriptor(object);
77:                         addKeySequencePropertyDescriptor(object);
78:                 }
79:                 return itemPropertyDescriptors;
80:         }
81:
82:         /**
83:          * This adds a property descriptor for the Id feature.
84:          * <!-- begin-user-doc -->
85:          * <!-- end-user-doc -->
86:          *
87:          * @generated
88:          */
89:         protected void addIdPropertyDescriptor(Object object) {
90:                 itemPropertyDescriptors
91:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
92:                                 getResourceLocator(),
93:                                 getString("_UI_KeyBinding_id_feature"), //$NON-NLS-1$
94:                                 getString("_UI_PropertyDescriptor_description", "_UI_KeyBinding_id_feature", "_UI_KeyBinding_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
95:                                 VTKeybindingPackage.Literals.KEY_BINDING__ID,
96:                                 true,
97:                                 false,
98:                                 false,
99:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
100:                                 null,
101:                                 null));
102:         }
103:
104:         /**
105:          * This adds a property descriptor for the Key Sequence feature.
106:          * <!-- begin-user-doc -->
107:          * <!-- end-user-doc -->
108:          *
109:          * @generated
110:          */
111:         protected void addKeySequencePropertyDescriptor(Object object) {
112:                 itemPropertyDescriptors
113:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
114:                                 getResourceLocator(),
115:                                 getString("_UI_KeyBinding_keySequence_feature"), //$NON-NLS-1$
116:                                 getString("_UI_PropertyDescriptor_description", "_UI_KeyBinding_keySequence_feature", //$NON-NLS-1$ //$NON-NLS-2$
117:                                         "_UI_KeyBinding_type"), //$NON-NLS-1$
118:                                 VTKeybindingPackage.Literals.KEY_BINDING__KEY_SEQUENCE,
119:                                 true,
120:                                 false,
121:                                 false,
122:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
123:                                 null,
124:                                 null));
125:         }
126:
127:         /**
128:          * This returns KeyBinding.gif.
129:          * <!-- begin-user-doc -->
130:          * <!-- end-user-doc -->
131:          *
132:          * @generated NOT
133:          */
134:         @Override
135:         public Object getImage(Object object) {
136:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/KeyBinding.png")); //$NON-NLS-1$
137:         }
138:
139:         /**
140:          * This returns the label text for the adapted class.
141:          * <!-- begin-user-doc -->
142:          * <!-- end-user-doc -->
143:          *
144:          * @generated
145:          */
146:         @Override
147:         public String getText(Object object) {
148:                 final String label = ((VTKeyBinding) object).getId();
149:•                return label == null || label.length() == 0 ? getString("_UI_KeyBinding_type") : //$NON-NLS-1$
150:                         getString("_UI_KeyBinding_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
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(VTKeyBinding.class)) {
166:                 case VTKeybindingPackage.KEY_BINDING__ID:
167:                 case VTKeybindingPackage.KEY_BINDING__KEY_SEQUENCE:
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: }