Skip to content

Package: ReferenceStylePropertyItemProvider

ReferenceStylePropertyItemProvider

nameinstructionbranchcomplexitylinemethod
ReferenceStylePropertyItemProvider(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%
addShowCreateAndLinkButtonForCrossReferencesPropertyDescriptor(Object)
M: 28 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 15 C: 0
0%
M: 1 C: 0
0%
addShowLinkButtonForContainmentReferencesPropertyDescriptor(Object)
M: 26 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: 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: 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: 16 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getResourceLocator()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getText(Object)
M: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 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-2018 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.template.style.reference.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.template.style.reference.model.VTReferencePackage;
23: import org.eclipse.emf.ecp.view.template.style.reference.model.VTReferenceStyleProperty;
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
38: * {@link org.eclipse.emf.ecp.view.template.style.reference.model.VTReferenceStyleProperty} object.
39: * <!-- begin-user-doc -->
40: * <!-- end-user-doc -->
41: *
42: * @generated
43: */
44: public class ReferenceStylePropertyItemProvider
45:         extends ItemProviderAdapter
46:         implements
47:         IEditingDomainItemProvider,
48:         IStructuredItemContentProvider,
49:         ITreeItemContentProvider,
50:         IItemLabelProvider,
51:         IItemPropertySource {
52:         /**
53:          * This constructs an instance from a factory and a notifier.
54:          * <!-- begin-user-doc -->
55:          * <!-- end-user-doc -->
56:          *
57:          * @generated
58:          */
59:         public ReferenceStylePropertyItemProvider(AdapterFactory adapterFactory) {
60:                 super(adapterFactory);
61:         }
62:
63:         /**
64:          * This returns the property descriptors for the adapted class.
65:          * <!-- begin-user-doc -->
66:          * <!-- end-user-doc -->
67:          *
68:          * @generated
69:          */
70:         @Override
71:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
72:•                if (itemPropertyDescriptors == null) {
73:                         super.getPropertyDescriptors(object);
74:
75:                         addShowCreateAndLinkButtonForCrossReferencesPropertyDescriptor(object);
76:                         addShowLinkButtonForContainmentReferencesPropertyDescriptor(object);
77:                 }
78:                 return itemPropertyDescriptors;
79:         }
80:
81:         /**
82:          * This adds a property descriptor for the Show Create And Link Button For Cross References feature.
83:          * <!-- begin-user-doc -->
84:          * <!-- end-user-doc -->
85:          *
86:          * @generated
87:          */
88:         protected void addShowCreateAndLinkButtonForCrossReferencesPropertyDescriptor(Object object) {
89:                 itemPropertyDescriptors
90:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
91:                                 getResourceLocator(),
92:                                 getString("_UI_ReferenceStyleProperty_showCreateAndLinkButtonForCrossReferences_feature"), //$NON-NLS-1$
93:                                 getString("_UI_PropertyDescriptor_description", //$NON-NLS-1$
94:                                         "_UI_ReferenceStyleProperty_showCreateAndLinkButtonForCrossReferences_feature", //$NON-NLS-1$
95:                                         "_UI_ReferenceStyleProperty_type"), //$NON-NLS-1$
96:                                 VTReferencePackage.Literals.REFERENCE_STYLE_PROPERTY__SHOW_CREATE_AND_LINK_BUTTON_FOR_CROSS_REFERENCES,
97:                                 true,
98:                                 false,
99:                                 false,
100:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
101:                                 null,
102:                                 null));
103:         }
104:
105:         /**
106:          * This adds a property descriptor for the Show Link Button For Containment References feature.
107:          * <!-- begin-user-doc -->
108:          * <!-- end-user-doc -->
109:          *
110:          * @generated
111:          */
112:         protected void addShowLinkButtonForContainmentReferencesPropertyDescriptor(Object object) {
113:                 itemPropertyDescriptors
114:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
115:                                 getResourceLocator(),
116:                                 getString("_UI_ReferenceStyleProperty_showLinkButtonForContainmentReferences_feature"), //$NON-NLS-1$
117:                                 getString("_UI_ReferenceStyleProperty_showLinkButtonForContainmentReferences_description"), //$NON-NLS-1$
118:                                 VTReferencePackage.Literals.REFERENCE_STYLE_PROPERTY__SHOW_LINK_BUTTON_FOR_CONTAINMENT_REFERENCES,
119:                                 true,
120:                                 false,
121:                                 false,
122:                                 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
123:                                 null,
124:                                 null));
125:         }
126:
127:         /**
128:          * This returns ReferenceStyleProperty.gif.
129:          * <!-- begin-user-doc -->
130:          * <!-- end-user-doc -->
131:          *
132:          * @generated
133:          */
134:         @Override
135:         public Object getImage(Object object) {
136:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/ReferenceStyleProperty")); //$NON-NLS-1$
137:         }
138:
139:         /**
140:          * This returns the label text for the adapted class.
141:          * <!-- begin-user-doc -->
142:          * <!-- end-user-doc -->
143:          *
144:          * @generated
145:          */
146:         @Override
147:         public String getText(Object object) {
148:                 final VTReferenceStyleProperty referenceStyleProperty = (VTReferenceStyleProperty) object;
149:                 return getString("_UI_ReferenceStyleProperty_type") + " " //$NON-NLS-1$ //$NON-NLS-2$
150:                         + referenceStyleProperty.isShowCreateAndLinkButtonForCrossReferences();
151:         }
152:
153:         /**
154:          * This handles model notifications by calling {@link #updateChildren} to update any cached
155:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
156:          * <!-- begin-user-doc -->
157:          * <!-- end-user-doc -->
158:          *
159:          * @generated
160:          */
161:         @Override
162:         public void notifyChanged(Notification notification) {
163:                 updateChildren(notification);
164:
165:•                switch (notification.getFeatureID(VTReferenceStyleProperty.class)) {
166:                 case VTReferencePackage.REFERENCE_STYLE_PROPERTY__SHOW_CREATE_AND_LINK_BUTTON_FOR_CROSS_REFERENCES:
167:                 case VTReferencePackage.REFERENCE_STYLE_PROPERTY__SHOW_LINK_BUTTON_FOR_CONTAINMENT_REFERENCES:
168:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
169:                         return;
170:                 }
171:                 super.notifyChanged(notification);
172:         }
173:
174:         /**
175:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
176:          * that can be created under this object.
177:          * <!-- begin-user-doc -->
178:          * <!-- end-user-doc -->
179:          *
180:          * @generated
181:          */
182:         @Override
183:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
184:                 super.collectNewChildDescriptors(newChildDescriptors, object);
185:         }
186:
187:         /**
188:          * Return the resource locator for this item provider's resources.
189:          * <!-- begin-user-doc -->
190:          * <!-- end-user-doc -->
191:          *
192:          * @generated
193:          */
194:         @Override
195:         public ResourceLocator getResourceLocator() {
196:                 return ((IChildCreationExtender) adapterFactory).getResourceLocator();
197:         }
198:
199: }