Skip to content

Package: DiffAttachmentItemProvider

DiffAttachmentItemProvider

nameinstructionbranchcomplexitylinemethod
DiffAttachmentItemProvider(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%
addMergedDiffsPropertyDescriptor(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%
addTotalNumberOfDiffsPropertyDescriptor(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: 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: 2 C: 0
0%
M: 1 C: 0
0%
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%
getText(Object)
M: 21 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
notifyChanged(Notification)
M: 37 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.spi.diffmerge.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.ecore.EObject;
22: import org.eclipse.emf.ecp.spi.diffmerge.model.VDiffAttachment;
23: import org.eclipse.emf.ecp.spi.diffmerge.model.VDiffmergePackage;
24: import org.eclipse.emf.ecp.view.spi.model.provider.AttachmentItemProvider;
25: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
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.ViewerNotification;
34:
35: /**
36: * This is the item provider adapter for a {@link org.eclipse.emf.ecp.spi.diffmerge.model.VDiffAttachment} object. <!--
37: * begin-user-doc --> <!-- end-user-doc -->
38: *
39: * @generated
40: */
41: public class DiffAttachmentItemProvider extends AttachmentItemProvider
42:         implements IEditingDomainItemProvider, IStructuredItemContentProvider,
43:         ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
44:         /**
45:          * This constructs an instance from a factory and a notifier. <!--
46:          * begin-user-doc --> <!-- end-user-doc -->
47:          *
48:          * @generated
49:          */
50:         public DiffAttachmentItemProvider(AdapterFactory adapterFactory) {
51:                 super(adapterFactory);
52:         }
53:
54:         /**
55:          * This returns the property descriptors for the adapted class. <!--
56:          * begin-user-doc --> <!-- 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:                         addTotalNumberOfDiffsPropertyDescriptor(object);
66:                         addMergedDiffsPropertyDescriptor(object);
67:                 }
68:                 return itemPropertyDescriptors;
69:         }
70:
71:         /**
72:          * This adds a property descriptor for the Total Number Of Diffs feature.
73:          * <!-- begin-user-doc --> <!-- end-user-doc -->
74:          *
75:          * @generated
76:          */
77:         protected void addTotalNumberOfDiffsPropertyDescriptor(Object object) {
78:                 itemPropertyDescriptors
79:                         .add(createItemPropertyDescriptor(
80:                                 ((ComposeableAdapterFactory) adapterFactory)
81:                                         .getRootAdapterFactory(),
82:                                 getResourceLocator(),
83:                                 getString("_UI_DiffAttachment_totalNumberOfDiffs_feature"), //$NON-NLS-1$
84:                                 getString(
85:                                         "_UI_PropertyDescriptor_description", "_UI_DiffAttachment_totalNumberOfDiffs_feature", //$NON-NLS-1$ //$NON-NLS-2$
86:                                         "_UI_DiffAttachment_type"), //$NON-NLS-1$
87:                                 VDiffmergePackage.Literals.DIFF_ATTACHMENT__TOTAL_NUMBER_OF_DIFFS,
88:                                 true, false, false,
89:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null));
90:         }
91:
92:         /**
93:          * This adds a property descriptor for the Merged Diffs feature. <!--
94:          * begin-user-doc --> <!-- end-user-doc -->
95:          *
96:          * @generated
97:          */
98:         protected void addMergedDiffsPropertyDescriptor(Object object) {
99:                 itemPropertyDescriptors
100:                         .add(createItemPropertyDescriptor(
101:                                 ((ComposeableAdapterFactory) adapterFactory)
102:                                         .getRootAdapterFactory(),
103:                                 getResourceLocator(),
104:                                 getString("_UI_DiffAttachment_mergedDiffs_feature"), //$NON-NLS-1$
105:                                 getString(
106:                                         "_UI_PropertyDescriptor_description", "_UI_DiffAttachment_mergedDiffs_feature", //$NON-NLS-1$ //$NON-NLS-2$
107:                                         "_UI_DiffAttachment_type"), //$NON-NLS-1$
108:                                 VDiffmergePackage.Literals.DIFF_ATTACHMENT__MERGED_DIFFS,
109:                                 true, false, false,
110:                                 ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null));
111:         }
112:
113:         /**
114:          * This returns DiffAttachment.gif. <!-- begin-user-doc --> <!--
115:          * end-user-doc -->
116:          *
117:          * @generated
118:          */
119:         @Override
120:         public Object getImage(Object object) {
121:                 return overlayImage(object,
122:                         getResourceLocator().getImage("full/obj16/DiffAttachment")); //$NON-NLS-1$
123:         }
124:
125:         /**
126:          * This returns the label text for the adapted class. <!-- begin-user-doc
127:          * --> <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public String getText(Object object) {
133:                 final VDiffAttachment diffAttachment = (VDiffAttachment) object;
134:                 // return getString("_UI_DiffAttachment_type") + " " + diffAttachment.getTotalNumberOfDiffs(); //$NON-NLS-1$
135:                 // //$NON-NLS-2$
136:                 return getString(
137:                         "_UI_DiffAttachment_text", //$NON-NLS-1$
138:                         new Object[] { diffAttachment.getMergedDiffs(), diffAttachment.getTotalNumberOfDiffs() });
139:         }
140:
141:         /**
142:          * This handles model notifications by calling {@link #updateChildren} to
143:          * update any cached children and by creating a viewer notification, which
144:          * it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!--
145:          * end-user-doc -->
146:          *
147:          * @generated NOT
148:          * @param notification the {@link Notification} to propagate
149:          */
150:         @Override
151:         public void notifyChanged(Notification notification) {
152:                 updateChildren(notification);
153:
154:•                switch (notification.getFeatureID(VDiffAttachment.class)) {
155:                 case VDiffmergePackage.DIFF_ATTACHMENT__TOTAL_NUMBER_OF_DIFFS:
156:                 case VDiffmergePackage.DIFF_ATTACHMENT__MERGED_DIFFS:
157:                         fireNotifyChanged(new ViewerNotification(notification,
158:                                 notification.getNotifier(), false, true));
159:                         fireNotifyChanged(new ViewerNotification(notification,
160:                                 ((EObject) notification.getNotifier()).eContainer(), false, true));
161:                         return;
162:                 default:
163:                         super.notifyChanged(notification);
164:                 }
165:                 super.notifyChanged(notification);
166:         }
167:
168:         /**
169:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
170:          * describing the children that can be created under this object. <!--
171:          * begin-user-doc --> <!-- end-user-doc -->
172:          *
173:          * @generated
174:          */
175:         @Override
176:         protected void collectNewChildDescriptors(
177:                 Collection<Object> newChildDescriptors, Object object) {
178:                 super.collectNewChildDescriptors(newChildDescriptors, object);
179:         }
180:
181: }