1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.reliability.provider; |
7 | |
8 | |
9 | import java.util.Collection; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.common.notify.AdapterFactory; |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.common.util.ResourceLocator; |
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 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
24 | import org.eclipse.emf.edit.provider.ViewerNotification; |
25 | |
26 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
27 | import de.uka.ipd.sdq.pcm.reliability.FailureOccurrenceDescription; |
28 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
29 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.reliability.FailureOccurrenceDescription} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class FailureOccurrenceDescriptionItemProvider |
37 | extends ItemProviderAdapter |
38 | implements |
39 | IEditingDomainItemProvider, |
40 | IStructuredItemContentProvider, |
41 | ITreeItemContentProvider, |
42 | IItemLabelProvider, |
43 | IItemPropertySource { |
44 | /** |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
50 | |
51 | /** |
52 | * This constructs an instance from a factory and a notifier. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | public FailureOccurrenceDescriptionItemProvider(AdapterFactory adapterFactory) { |
58 | super(adapterFactory); |
59 | } |
60 | |
61 | /** |
62 | * This returns the property descriptors for the adapted class. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
69 | if (itemPropertyDescriptors == null) { |
70 | super.getPropertyDescriptors(object); |
71 | |
72 | addFailureProbabilityPropertyDescriptor(object); |
73 | } |
74 | return itemPropertyDescriptors; |
75 | } |
76 | |
77 | /** |
78 | * This adds a property descriptor for the Failure Probability feature. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | protected void addFailureProbabilityPropertyDescriptor(Object object) { |
84 | itemPropertyDescriptors.add |
85 | (createItemPropertyDescriptor |
86 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
87 | getResourceLocator(), |
88 | getString("_UI_FailureOccurrenceDescription_failureProbability_feature"), |
89 | getString("_UI_PropertyDescriptor_description", "_UI_FailureOccurrenceDescription_failureProbability_feature", "_UI_FailureOccurrenceDescription_type"), |
90 | ReliabilityPackage.Literals.FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_PROBABILITY, |
91 | true, |
92 | false, |
93 | false, |
94 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
95 | null, |
96 | null)); |
97 | } |
98 | |
99 | /** |
100 | * This returns FailureOccurrenceDescription.gif. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | public Object getImage(Object object) { |
107 | return overlayImage(object, getResourceLocator().getImage("full/obj16/FailureOccurrenceDescription")); |
108 | } |
109 | |
110 | /** |
111 | * This returns the label text for the adapted class. |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | @Override |
117 | public String getText(Object object) { |
118 | FailureOccurrenceDescription failureOccurrenceDescription = (FailureOccurrenceDescription)object; |
119 | return getString("_UI_FailureOccurrenceDescription_type") + " " + failureOccurrenceDescription.getFailureProbability(); |
120 | } |
121 | |
122 | /** |
123 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
124 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | @Override |
130 | public void notifyChanged(Notification notification) { |
131 | updateChildren(notification); |
132 | |
133 | switch (notification.getFeatureID(FailureOccurrenceDescription.class)) { |
134 | case ReliabilityPackage.FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_PROBABILITY: |
135 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
136 | return; |
137 | } |
138 | super.notifyChanged(notification); |
139 | } |
140 | |
141 | /** |
142 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
143 | * that can be created under this object. |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
150 | super.collectNewChildDescriptors(newChildDescriptors, object); |
151 | } |
152 | |
153 | /** |
154 | * Return the resource locator for this item provider's resources. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | @Override |
160 | public ResourceLocator getResourceLocator() { |
161 | return PalladioComponentModelEditPlugin.INSTANCE; |
162 | } |
163 | |
164 | } |