Skip to content

Package: StyleItemProvider

StyleItemProvider

nameinstructionbranchcomplexitylinemethod
StyleItemProvider(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%
addPropertiesPropertyDescriptor(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: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
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: 0 C: 15
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
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: 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: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
notifyChanged(Notification)
M: 0 C: 22
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

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