Skip to content

Package: AbstractCategorizationItemProvider

AbstractCategorizationItemProvider

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