Skip to content

Package: StackItemItemProvider

StackItemItemProvider

nameinstructionbranchcomplexitylinemethod
StackItemItemProvider(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%
addValuePropertyDescriptor(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: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
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: 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: 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: 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-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.stack.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.ecp.view.spi.model.VElement;
22: import org.eclipse.emf.ecp.view.spi.model.VElementUtil;
23: import org.eclipse.emf.ecp.view.spi.model.VViewPackage;
24: import org.eclipse.emf.ecp.view.spi.model.provider.ContainerItemProvider;
25: import org.eclipse.emf.ecp.view.spi.stack.model.VStackFactory;
26: import org.eclipse.emf.ecp.view.spi.stack.model.VStackItem;
27: import org.eclipse.emf.ecp.view.spi.stack.model.VStackPackage;
28: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
29: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
30: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
31: import org.eclipse.emf.edit.provider.ViewerNotification;
32:
33: /**
34: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.stack.model.VStackItem} object.
35: * <!-- begin-user-doc -->
36: * <!-- end-user-doc -->
37: *
38: * @generated
39: */
40: public class StackItemItemProvider
41:         extends ContainerItemProvider {
42:         /**
43:          * This constructs an instance from a factory and a notifier.
44:          * <!-- begin-user-doc -->
45:          * <!-- end-user-doc -->
46:          *
47:          * @generated
48:          */
49:         public StackItemItemProvider(AdapterFactory adapterFactory) {
50:                 super(adapterFactory);
51:         }
52:
53:         /**
54:          * This returns the property descriptors for the adapted class.
55:          * <!-- begin-user-doc -->
56:          * <!-- end-user-doc -->
57:          *
58:          * @generated
59:          */
60:         @Override
61:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
62:•                if (itemPropertyDescriptors == null) {
63:                         super.getPropertyDescriptors(object);
64:
65:                         addValuePropertyDescriptor(object);
66:                 }
67:                 return itemPropertyDescriptors;
68:         }
69:
70:         /**
71:          * This adds a property descriptor for the Value feature.
72:          * <!-- begin-user-doc -->
73:          * <!-- end-user-doc -->
74:          *
75:          * @generated
76:          */
77:         protected void addValuePropertyDescriptor(Object object) {
78:                 itemPropertyDescriptors
79:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
80:                                 getResourceLocator(),
81:                                 getString("_UI_StackItem_value_feature"), //$NON-NLS-1$
82:                                 getString("_UI_PropertyDescriptor_description", "_UI_StackItem_value_feature", "_UI_StackItem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
83:                                 VStackPackage.Literals.STACK_ITEM__VALUE,
84:                                 true,
85:                                 false,
86:                                 false,
87:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
88:                                 null,
89:                                 null));
90:         }
91:
92:         /**
93:          * This returns StackItem.gif.
94:          * <!-- begin-user-doc -->
95:          * <!-- end-user-doc -->
96:          *
97:          * @generated
98:          */
99:         @Override
100:         public Object getImage(Object object) {
101:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/StackItem")); //$NON-NLS-1$
102:         }
103:
104:         /**
105:          * This returns the label text for the adapted class.
106:          * <!-- begin-user-doc -->
107:          * <!-- end-user-doc -->
108:          *
109:          * @generated NOT
110:          */
111:         @Override
112:         public String getText(Object object) {
113:                 String label = ((VStackItem) object).getName();
114:•                if (label == null) {
115:                         label = VElementUtil.getCleanName(VElement.class.cast(object));
116:                 }
117:•                return label == null || label.length() == 0 ? getString("_UI_StackItem_type") : //$NON-NLS-1$
118:                         getString("_UI_StackItem_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
119:         }
120:
121:         /**
122:          * This handles model notifications by calling {@link #updateChildren} to update any cached
123:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
124:          * <!-- begin-user-doc -->
125:          * <!-- end-user-doc -->
126:          *
127:          * @generated
128:          */
129:         @Override
130:         public void notifyChanged(Notification notification) {
131:                 updateChildren(notification);
132:
133:•                switch (notification.getFeatureID(VStackItem.class)) {
134:                 case VStackPackage.STACK_ITEM__VALUE:
135:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
136:                         return;
137:                 }
138:                 super.notifyChanged(notification);
139:         }
140:
141:         /**
142:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
143:          * that can be created under this object.
144:          * <!-- begin-user-doc -->
145:          * <!-- end-user-doc -->
146:          *
147:          * @generated
148:          */
149:         @Override
150:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
151:                 super.collectNewChildDescriptors(newChildDescriptors, object);
152:
153:                 newChildDescriptors.add(createChildParameter(VViewPackage.Literals.CONTAINER__CHILDREN,
154:                         VStackFactory.eINSTANCE.createStackLayout()));
155:         }
156:
157: }