Skip to content

Package: HorizontalLayoutItemProvider

HorizontalLayoutItemProvider

nameinstructionbranchcomplexitylinemethod
HorizontalLayoutItemProvider(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%
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: 0 C: 10
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
getText(Object)
M: 15 C: 19
56%
M: 4 C: 2
33%
M: 3 C: 1
25%
M: 1 C: 4
80%
M: 0 C: 1
100%
notifyChanged(Notification)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
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: * Eugen Neufeld - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.horizontal.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.horizontal.model.VHorizontalFactory;
22: import org.eclipse.emf.ecp.view.spi.horizontal.model.VHorizontalLayout;
23: import org.eclipse.emf.ecp.view.spi.model.VElement;
24: import org.eclipse.emf.ecp.view.spi.model.VElementUtil;
25: import org.eclipse.emf.ecp.view.spi.model.VViewPackage;
26: import org.eclipse.emf.ecp.view.spi.model.provider.ContainedContainerItemProvider;
27: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
28:
29: /**
30: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.horizontal.model.VHorizontalLayout}
31: * object.
32: * <!-- begin-user-doc -->
33: *
34: * @since 1.2
35: * <!-- end-user-doc -->
36: *
37: * @generated
38: */
39: public class HorizontalLayoutItemProvider
40:         extends ContainedContainerItemProvider
41:
42: {
43:         /**
44:          * This constructs an instance from a factory and a notifier.
45:          * <!-- begin-user-doc -->
46:          * <!-- end-user-doc -->
47:          *
48:          * @generated
49:          */
50:         public HorizontalLayoutItemProvider(AdapterFactory adapterFactory) {
51:                 super(adapterFactory);
52:         }
53:
54:         /**
55:          * This returns the property descriptors for the adapted class.
56:          * <!-- begin-user-doc -->
57:          * <!-- end-user-doc -->
58:          *
59:          * @generated
60:          */
61:         @Override
62:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
63:•                if (itemPropertyDescriptors == null) {
64:                         super.getPropertyDescriptors(object);
65:
66:                 }
67:                 return itemPropertyDescriptors;
68:         }
69:
70:         /**
71:          * This returns HorizontalLayout.gif.
72:          * <!-- begin-user-doc -->
73:          * <!-- end-user-doc -->
74:          *
75:          * @generated
76:          */
77:         @Override
78:         public Object getImage(Object object) {
79:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/HorizontalLayout")); //$NON-NLS-1$
80:         }
81:
82:         /**
83:          * This returns the label text for the adapted class.
84:          * <!-- begin-user-doc -->
85:          * <!-- end-user-doc -->
86:          *
87:          * @generated NOT
88:          */
89:         @Override
90:         public String getText(Object object) {
91:                 String label = ((VHorizontalLayout) object).getName();
92:•                if (label == null) {
93:                         label = VElementUtil.getCleanName(VElement.class.cast(object));
94:                 }
95:•                return label == null || label.length() == 0 ? getString("_UI_HorizontalLayout_type") : //$NON-NLS-1$
96:                         getString("_UI_HorizontalLayout_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
97:         }
98:
99:         /**
100:          * This handles model notifications by calling {@link #updateChildren} to update any cached
101:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
102:          * <!-- begin-user-doc -->
103:          * <!-- end-user-doc -->
104:          *
105:          * @generated
106:          */
107:         @Override
108:         public void notifyChanged(Notification notification) {
109:                 updateChildren(notification);
110:                 super.notifyChanged(notification);
111:         }
112:
113:         /**
114:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
115:          * that can be created under this object.
116:          * <!-- begin-user-doc -->
117:          * <!-- end-user-doc -->
118:          *
119:          * @generated
120:          */
121:         @Override
122:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
123:                 super.collectNewChildDescriptors(newChildDescriptors, object);
124:
125:                 newChildDescriptors.add(createChildParameter(VViewPackage.Literals.CONTAINER__CHILDREN,
126:                         VHorizontalFactory.eINSTANCE.createHorizontalLayout()));
127:         }
128:
129: }