1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.Element; |
11 | |
12 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.provider.QMLProfileEditPlugin; |
13 | |
14 | import de.uka.ipd.sdq.pcm.core.entity.provider.EntityItemProvider; |
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 | |
22 | import org.eclipse.emf.common.util.ResourceLocator; |
23 | |
24 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
25 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
26 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
28 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.Element} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class ElementItemProvider |
38 | extends EntityItemProvider |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * This constructs an instance from a factory and a notifier. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | public ElementItemProvider(AdapterFactory adapterFactory) { |
52 | super(adapterFactory); |
53 | } |
54 | |
55 | /** |
56 | * This returns the property descriptors for the adapted class. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
63 | if (itemPropertyDescriptors == null) { |
64 | super.getPropertyDescriptors(object); |
65 | |
66 | } |
67 | return itemPropertyDescriptors; |
68 | } |
69 | |
70 | /** |
71 | * This returns Element.gif. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | @Override |
77 | public Object getImage(Object object) { |
78 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Element")); |
79 | } |
80 | |
81 | /** |
82 | * This returns the label text for the adapted class. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | @Override |
88 | public String getText(Object object) { |
89 | String label = ((Element)object).getId(); |
90 | return label == null || label.length() == 0 ? |
91 | getString("_UI_Element_type") : |
92 | getString("_UI_Element_type") + " " + label; |
93 | } |
94 | |
95 | /** |
96 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
97 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | @Override |
103 | public void notifyChanged(Notification notification) { |
104 | updateChildren(notification); |
105 | super.notifyChanged(notification); |
106 | } |
107 | |
108 | /** |
109 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
110 | * that can be created under this object. |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
117 | super.collectNewChildDescriptors(newChildDescriptors, object); |
118 | } |
119 | |
120 | /** |
121 | * Return the resource locator for this item provider's resources. |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | @Override |
127 | public ResourceLocator getResourceLocator() { |
128 | return QMLProfileEditPlugin.INSTANCE; |
129 | } |
130 | |
131 | } |