Skip to content

Package: ViewProxyItemProvider

ViewProxyItemProvider

nameinstructionbranchcomplexitylinemethod
ViewProxyItemProvider(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%
addIdPropertyDescriptor(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: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
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: 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: 26 C: 0
0%
M: 4 C: 0
0%
M: 3 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-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: * Johannes Faltermeier - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.viewproxy.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.provider.ContainedElementItemProvider;
22: import org.eclipse.emf.ecp.view.spi.viewproxy.model.VViewProxy;
23: import org.eclipse.emf.ecp.view.spi.viewproxy.model.VViewproxyPackage;
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.viewproxy.model.VViewProxy} object. <!--
31: * begin-user-doc --> <!-- end-user-doc -->
32: *
33: * @generated
34: */
35: public class ViewProxyItemProvider extends ContainedElementItemProvider {
36:         /**
37:          * This constructs an instance from a factory and a notifier. <!--
38:          * begin-user-doc --> <!-- end-user-doc -->
39:          *
40:          * @generated
41:          */
42:         public ViewProxyItemProvider(AdapterFactory adapterFactory) {
43:                 super(adapterFactory);
44:         }
45:
46:         /**
47:          * This returns the property descriptors for the adapted class. <!--
48:          * begin-user-doc --> <!-- end-user-doc -->
49:          *
50:          * @generated
51:          */
52:         @Override
53:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
54:•                if (itemPropertyDescriptors == null) {
55:                         super.getPropertyDescriptors(object);
56:
57:                         addIdPropertyDescriptor(object);
58:                 }
59:                 return itemPropertyDescriptors;
60:         }
61:
62:         /**
63:          * This adds a property descriptor for the Id feature.
64:          * <!-- begin-user-doc -->
65:          * <!-- end-user-doc -->
66:          *
67:          * @generated
68:          */
69:         protected void addIdPropertyDescriptor(Object object) {
70:                 itemPropertyDescriptors
71:                         .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
72:                                 getResourceLocator(),
73:                                 getString("_UI_ViewProxy_id_feature"), //$NON-NLS-1$
74:                                 getString("_UI_PropertyDescriptor_description", "_UI_ViewProxy_id_feature", "_UI_ViewProxy_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
75:                                 VViewproxyPackage.Literals.VIEW_PROXY__ID,
76:                                 true,
77:                                 false,
78:                                 false,
79:                                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
80:                                 null,
81:                                 null));
82:         }
83:
84:         /**
85:          * This returns ViewProxy.gif.
86:          * <!-- begin-user-doc --> <!-- end-user-doc -->
87:          *
88:          * @generated
89:          */
90:         @Override
91:         public Object getImage(Object object) {
92:                 return overlayImage(object, getResourceLocator().getImage("full/obj16/ViewProxy")); //$NON-NLS-1$
93:         }
94:
95:         /**
96:          * This returns the label text for the adapted class.
97:          * <!-- begin-user-doc
98:          * --> <!-- end-user-doc -->
99:          *
100:          * @generated
101:          */
102:         @Override
103:         public String getText(Object object) {
104:                 final String label = ((VViewProxy) object).getName();
105:•                return label == null || label.length() == 0 ? getString("_UI_ViewProxy_type") : //$NON-NLS-1$
106:                         getString("_UI_ViewProxy_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
107:         }
108:
109:         /**
110:          * This handles model notifications by calling {@link #updateChildren} to update any cached
111:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
112:          * <!-- begin-user-doc --> <!--
113:          * end-user-doc -->
114:          *
115:          * @generated
116:          */
117:         @Override
118:         public void notifyChanged(Notification notification) {
119:                 updateChildren(notification);
120:
121:•                switch (notification.getFeatureID(VViewProxy.class)) {
122:                 case VViewproxyPackage.VIEW_PROXY__ID:
123:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
124:                         return;
125:                 }
126:                 super.notifyChanged(notification);
127:         }
128:
129:         /**
130:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
131:          * describing the children that can be created under this object. <!--
132:          * begin-user-doc --> <!-- end-user-doc -->
133:          *
134:          * @generated
135:          */
136:         @Override
137:         protected void collectNewChildDescriptors(
138:                 Collection<Object> newChildDescriptors, Object object) {
139:                 super.collectNewChildDescriptors(newChildDescriptors, object);
140:         }
141:
142: }