1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.sensitivity.provider; |
8 | |
9 | |
10 | import java.util.Collection; |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.common.notify.AdapterFactory; |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | |
23 | import de.uka.ipd.sdq.sensitivity.ResourceMTTFParameter; |
24 | import de.uka.ipd.sdq.sensitivity.SensitivityPackage; |
25 | |
26 | /** |
27 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.sensitivity.ResourceMTTFParameter} object. |
28 | * <!-- begin-user-doc --> |
29 | * <!-- end-user-doc --> |
30 | * @generated |
31 | */ |
32 | public class ResourceMTTFParameterItemProvider |
33 | extends SingleSensitivityParameterItemProvider |
34 | implements |
35 | IEditingDomainItemProvider, |
36 | IStructuredItemContentProvider, |
37 | ITreeItemContentProvider, |
38 | IItemLabelProvider, |
39 | IItemPropertySource { |
40 | /** |
41 | * This constructs an instance from a factory and a notifier. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | public ResourceMTTFParameterItemProvider(AdapterFactory adapterFactory) { |
47 | super(adapterFactory); |
48 | } |
49 | |
50 | /** |
51 | * This returns the property descriptors for the adapted class. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | @Override |
57 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
58 | if (itemPropertyDescriptors == null) { |
59 | super.getPropertyDescriptors(object); |
60 | |
61 | addProcessingResourceType__ResourceMTTFParameterPropertyDescriptor(object); |
62 | addResourceContainer__ResourceMTTFParameterPropertyDescriptor(object); |
63 | } |
64 | return itemPropertyDescriptors; |
65 | } |
66 | |
67 | /** |
68 | * This adds a property descriptor for the Processing Resource Type Resource MTTF Parameter feature. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | protected void addProcessingResourceType__ResourceMTTFParameterPropertyDescriptor(Object object) { |
74 | itemPropertyDescriptors.add |
75 | (createItemPropertyDescriptor |
76 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
77 | getResourceLocator(), |
78 | getString("_UI_ResourceMTTFParameter_processingResourceType__ResourceMTTFParameter_feature"), |
79 | getString("_UI_PropertyDescriptor_description", "_UI_ResourceMTTFParameter_processingResourceType__ResourceMTTFParameter_feature", "_UI_ResourceMTTFParameter_type"), |
80 | SensitivityPackage.Literals.RESOURCE_MTTF_PARAMETER__PROCESSING_RESOURCE_TYPE_RESOURCE_MTTF_PARAMETER, |
81 | true, |
82 | false, |
83 | true, |
84 | null, |
85 | null, |
86 | null)); |
87 | } |
88 | |
89 | /** |
90 | * This adds a property descriptor for the Resource Container Resource MTTF Parameter feature. |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | protected void addResourceContainer__ResourceMTTFParameterPropertyDescriptor(Object object) { |
96 | itemPropertyDescriptors.add |
97 | (createItemPropertyDescriptor |
98 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
99 | getResourceLocator(), |
100 | getString("_UI_ResourceMTTFParameter_resourceContainer__ResourceMTTFParameter_feature"), |
101 | getString("_UI_PropertyDescriptor_description", "_UI_ResourceMTTFParameter_resourceContainer__ResourceMTTFParameter_feature", "_UI_ResourceMTTFParameter_type"), |
102 | SensitivityPackage.Literals.RESOURCE_MTTF_PARAMETER__RESOURCE_CONTAINER_RESOURCE_MTTF_PARAMETER, |
103 | true, |
104 | false, |
105 | true, |
106 | null, |
107 | null, |
108 | null)); |
109 | } |
110 | |
111 | /** |
112 | * This returns ResourceMTTFParameter.gif. |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | @Override |
118 | public Object getImage(Object object) { |
119 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceMTTFParameter")); |
120 | } |
121 | |
122 | /** |
123 | * This returns the label text for the adapted class. |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated not |
127 | */ |
128 | @Override |
129 | public String getText(Object object) { |
130 | String resourceContainerName = "UNSPECIFIED"; |
131 | try { |
132 | resourceContainerName = ((ResourceMTTFParameter)object). |
133 | getResourceContainer__ResourceMTTFParameter().getEntityName(); |
134 | } catch(Exception e) {} |
135 | String resourceTypeName = "UNSPECIFIED"; |
136 | try { |
137 | resourceTypeName = ((ResourceMTTFParameter)object). |
138 | getProcessingResourceType__ResourceMTTFParameter().getEntityName(); |
139 | } catch(Exception e) {} |
140 | return ((ResourceMTTFParameter)object).getEntityName() |
141 | + " (" + resourceContainerName + "/" + resourceTypeName + ")" |
142 | + " [ID: " + ((ResourceMTTFParameter)object).getId() + "]" |
143 | + " <" + getString("_UI_ResourceMTTFParameter_type") + ">"; |
144 | } |
145 | |
146 | /** |
147 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
148 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public void notifyChanged(Notification notification) { |
155 | updateChildren(notification); |
156 | super.notifyChanged(notification); |
157 | } |
158 | |
159 | /** |
160 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
161 | * that can be created under this object. |
162 | * <!-- begin-user-doc --> |
163 | * <!-- end-user-doc --> |
164 | * @generated |
165 | */ |
166 | @Override |
167 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
168 | super.collectNewChildDescriptors(newChildDescriptors, object); |
169 | } |
170 | |
171 | } |