Skip to content

Package: ControlGridItemProvider

ControlGridItemProvider

nameinstructionbranchcomplexitylinemethod
ControlGridItemProvider(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%
collectNewChildDescriptors(Collection, Object)
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getChildFeature(Object, Object)
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%
getChildrenFeatures(Object)
M: 15 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 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: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 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-2015 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.emfforms.spi.view.controlgrid.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.ecore.EStructuralFeature;
22: import org.eclipse.emf.ecp.view.spi.model.provider.ContainedElementItemProvider;
23: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
24: import org.eclipse.emf.edit.provider.ViewerNotification;
25: import org.eclipse.emf.emfforms.spi.view.controlgrid.model.VControlGrid;
26: import org.eclipse.emf.emfforms.spi.view.controlgrid.model.VControlgridFactory;
27: import org.eclipse.emf.emfforms.spi.view.controlgrid.model.VControlgridPackage;
28:
29: /**
30: * This is the item provider adapter for a {@link org.eclipse.emf.emfforms.spi.view.controlgrid.model.VControlGrid}
31: * object.
32: * <!-- begin-user-doc -->
33: * <!-- end-user-doc -->
34: *
35: * @generated
36: */
37: public class ControlGridItemProvider extends ContainedElementItemProvider {
38:         /**
39:          * This constructs an instance from a factory and a notifier.
40:          * <!-- begin-user-doc -->
41:          * <!-- end-user-doc -->
42:          *
43:          * @generated
44:          */
45:         public ControlGridItemProvider(AdapterFactory adapterFactory) {
46:                 super(adapterFactory);
47:         }
48:
49:         /**
50:          * This returns the property descriptors for the adapted class.
51:          * <!-- begin-user-doc -->
52:          * <!-- end-user-doc -->
53:          *
54:          * @generated
55:          */
56:         @Override
57:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
58:•                if (itemPropertyDescriptors == null) {
59:                         super.getPropertyDescriptors(object);
60:
61:                 }
62:                 return itemPropertyDescriptors;
63:         }
64:
65:         /**
66:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
67:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
68:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
69:          * <!-- begin-user-doc -->
70:          * <!-- end-user-doc -->
71:          *
72:          * @generated
73:          */
74:         @Override
75:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
76:•                if (childrenFeatures == null) {
77:                         super.getChildrenFeatures(object);
78:                         childrenFeatures.add(VControlgridPackage.Literals.CONTROL_GRID__ROWS);
79:                 }
80:                 return childrenFeatures;
81:         }
82:
83:         /**
84:          * <!-- begin-user-doc -->
85:          * <!-- end-user-doc -->
86:          *
87:          * @generated
88:          */
89:         @Override
90:         protected EStructuralFeature getChildFeature(Object object, Object child) {
91:                 // Check the type of the specified child object and return the proper feature to use for
92:                 // adding (see {@link AddCommand}) it as a child.
93:
94:                 return super.getChildFeature(object, child);
95:         }
96:
97:         /**
98:          * This returns ControlGrid.gif.
99:          * <!-- begin-user-doc -->
100:          * <!-- end-user-doc -->
101:          *
102:          * @generated
103:          */
104:         @Override
105:         public Object getImage(Object object) {
106:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/ControlGrid")); //$NON-NLS-1$
107:         }
108:
109:         /**
110:          * This returns the label text for the adapted class.
111:          * <!-- begin-user-doc -->
112:          * <!-- end-user-doc -->
113:          *
114:          * @generated
115:          */
116:         @Override
117:         public String getText(Object object) {
118:                 final String label = ((VControlGrid) object).getName();
119:•                return label == null || label.length() == 0 ? getString("_UI_ControlGrid_type") //$NON-NLS-1$
120:                         : getString("_UI_ControlGrid_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
121:         }
122:
123:         /**
124:          * This handles model notifications by calling {@link #updateChildren} to update any cached
125:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
126:          * <!-- begin-user-doc -->
127:          * <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public void notifyChanged(Notification notification) {
133:                 updateChildren(notification);
134:
135:•                switch (notification.getFeatureID(VControlGrid.class)) {
136:                 case VControlgridPackage.CONTROL_GRID__ROWS:
137:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
138:                         return;
139:                 }
140:                 super.notifyChanged(notification);
141:         }
142:
143:         /**
144:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
145:          * that can be created under this object.
146:          * <!-- begin-user-doc -->
147:          * <!-- end-user-doc -->
148:          *
149:          * @generated
150:          */
151:         @Override
152:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
153:                 super.collectNewChildDescriptors(newChildDescriptors, object);
154:
155:                 newChildDescriptors.add(createChildParameter(VControlgridPackage.Literals.CONTROL_GRID__ROWS,
156:                         VControlgridFactory.eINSTANCE.createControlGridRow()));
157:         }
158:
159: }