Skip to content

Package: DiagnosticItemProvider

DiagnosticItemProvider

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