Skip to content

Package: CompoundControlItemProvider

CompoundControlItemProvider

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