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.QMLContractTypePackage; |
11 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.UnitRepository; |
12 | |
13 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.provider.QMLProfileEditPlugin; |
14 | |
15 | import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider; |
16 | |
17 | import java.util.Collection; |
18 | import java.util.List; |
19 | |
20 | import org.eclipse.emf.common.notify.AdapterFactory; |
21 | import org.eclipse.emf.common.notify.Notification; |
22 | |
23 | import org.eclipse.emf.common.util.ResourceLocator; |
24 | |
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 | |
33 | /** |
34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.UnitRepository} object. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class UnitRepositoryItemProvider |
40 | extends IdentifierItemProvider |
41 | implements |
42 | IEditingDomainItemProvider, |
43 | IStructuredItemContentProvider, |
44 | ITreeItemContentProvider, |
45 | IItemLabelProvider, |
46 | IItemPropertySource { |
47 | /** |
48 | * This constructs an instance from a factory and a notifier. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | public UnitRepositoryItemProvider(AdapterFactory adapterFactory) { |
54 | super(adapterFactory); |
55 | } |
56 | |
57 | /** |
58 | * This returns the property descriptors for the adapted class. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | @Override |
64 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
65 | if (itemPropertyDescriptors == null) { |
66 | super.getPropertyDescriptors(object); |
67 | |
68 | addUnitsPropertyDescriptor(object); |
69 | } |
70 | return itemPropertyDescriptors; |
71 | } |
72 | |
73 | /** |
74 | * This adds a property descriptor for the Units feature. |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | protected void addUnitsPropertyDescriptor(Object object) { |
80 | itemPropertyDescriptors.add |
81 | (createItemPropertyDescriptor |
82 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
83 | getResourceLocator(), |
84 | getString("_UI_UnitRepository_units_feature"), |
85 | getString("_UI_PropertyDescriptor_description", "_UI_UnitRepository_units_feature", "_UI_UnitRepository_type"), |
86 | QMLContractTypePackage.Literals.UNIT_REPOSITORY__UNITS, |
87 | true, |
88 | false, |
89 | true, |
90 | null, |
91 | null, |
92 | null)); |
93 | } |
94 | |
95 | /** |
96 | * This returns UnitRepository.gif. |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | @Override |
102 | public Object getImage(Object object) { |
103 | return overlayImage(object, getResourceLocator().getImage("full/obj16/UnitRepository")); |
104 | } |
105 | |
106 | /** |
107 | * This returns the label text for the adapted class. |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | @Override |
113 | public String getText(Object object) { |
114 | String label = ((UnitRepository)object).getId(); |
115 | return label == null || label.length() == 0 ? |
116 | getString("_UI_UnitRepository_type") : |
117 | getString("_UI_UnitRepository_type") + " " + label; |
118 | } |
119 | |
120 | /** |
121 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
122 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | @Override |
128 | public void notifyChanged(Notification notification) { |
129 | updateChildren(notification); |
130 | super.notifyChanged(notification); |
131 | } |
132 | |
133 | /** |
134 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
135 | * that can be created under this object. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
142 | super.collectNewChildDescriptors(newChildDescriptors, object); |
143 | } |
144 | |
145 | /** |
146 | * Return the resource locator for this item provider's resources. |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public ResourceLocator getResourceLocator() { |
153 | return QMLProfileEditPlugin.INSTANCE; |
154 | } |
155 | |
156 | } |