Skip to content

Package: DateTimeDisplayAttachmentItemProvider

DateTimeDisplayAttachmentItemProvider

nameinstructionbranchcomplexitylinemethod
DateTimeDisplayAttachmentItemProvider(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%
addDisplayTypePropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
collectNewChildDescriptors(Collection, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
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: 33 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 4 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-2015 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.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.DateTimeDisplayType;
22: import org.eclipse.emf.ecp.view.spi.model.VDateTimeDisplayAttachment;
23: import org.eclipse.emf.ecp.view.spi.model.VViewPackage;
24: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
25: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
26: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
27: import org.eclipse.emf.edit.provider.ViewerNotification;
28:
29: /**
30: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.view.spi.model.VDateTimeDisplayAttachment} object.
31: * <!-- begin-user-doc -->
32: *
33: * @since 1.8
34: * <!-- end-user-doc -->
35: * @generated
36: */
37: public class DateTimeDisplayAttachmentItemProvider extends AttachmentItemProvider {
38:         /**
39:          * This constructs an instance from a factory and a notifier.
40:          * <!-- begin-user-doc -->
41:          * <!-- end-user-doc -->
42:          *
43:          * @generated
44:          */
45:         public DateTimeDisplayAttachmentItemProvider(AdapterFactory adapterFactory) {
46:                 super(adapterFactory);
47:         }
48:
49:         /**
50:          * This returns the property descriptors for the adapted class.
51:          * <!-- begin-user-doc -->
52:          * <!-- end-user-doc -->
53:          *
54:          * @generated
55:          */
56:         @Override
57:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
58:•                if (itemPropertyDescriptors == null) {
59:                         super.getPropertyDescriptors(object);
60:
61:                         addDisplayTypePropertyDescriptor(object);
62:                 }
63:                 return itemPropertyDescriptors;
64:         }
65:
66:         /**
67:          * This adds a property descriptor for the Display Type feature.
68:          * <!-- begin-user-doc -->
69:          * <!-- end-user-doc -->
70:          *
71:          * @generated
72:          */
73:         protected void addDisplayTypePropertyDescriptor(Object object) {
74:                 itemPropertyDescriptors
75:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
76:                                 getResourceLocator(),
77:                                 getString("_UI_DateTimeDisplayAttachment_displayType_feature"), //$NON-NLS-1$
78:                                 getString("_UI_PropertyDescriptor_description", "_UI_DateTimeDisplayAttachment_displayType_feature", //$NON-NLS-1$ //$NON-NLS-2$
79:                                         "_UI_DateTimeDisplayAttachment_type"), //$NON-NLS-1$
80:                                 VViewPackage.Literals.DATE_TIME_DISPLAY_ATTACHMENT__DISPLAY_TYPE,
81:                                 true,
82:                                 false,
83:                                 false,
84:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
85:                                 null,
86:                                 null));
87:         }
88:
89:         /**
90:          * This returns DateTimeDisplayAttachment.gif.
91:          * <!-- begin-user-doc -->
92:          * <!-- end-user-doc -->
93:          *
94:          * @generated
95:          */
96:         @Override
97:         public Object getImage(Object object) {
98:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/DateTimeDisplayAttachment")); //$NON-NLS-1$
99:         }
100:
101:         /**
102:          * This returns the label text for the adapted class.
103:          * <!-- begin-user-doc -->
104:          * <!-- end-user-doc -->
105:          *
106:          * @generated
107:          */
108:         @Override
109:         public String getText(Object object) {
110:                 final DateTimeDisplayType labelValue = ((VDateTimeDisplayAttachment) object).getDisplayType();
111:•                final String label = labelValue == null ? null : labelValue.toString();
112:•                return label == null || label.length() == 0 ? getString("_UI_DateTimeDisplayAttachment_type") : //$NON-NLS-1$
113:                         getString("_UI_DateTimeDisplayAttachment_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(VDateTimeDisplayAttachment.class)) {
129:                 case VViewPackage.DATE_TIME_DISPLAY_ATTACHMENT__DISPLAY_TYPE:
130:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
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:
149: }