1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.sensitivity.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.sensitivity.FailureTypeResultSpecification; |
11 | import de.uka.ipd.sdq.sensitivity.InternalActionReliabilityParameter; |
12 | import de.uka.ipd.sdq.sensitivity.SensitivityPackage; |
13 | |
14 | import java.util.Collection; |
15 | import java.util.List; |
16 | |
17 | import org.eclipse.emf.common.notify.AdapterFactory; |
18 | import org.eclipse.emf.common.notify.Notification; |
19 | |
20 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
21 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
22 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
23 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
24 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
25 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
26 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.sensitivity.FailureTypeResultSpecification} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class FailureTypeResultSpecificationItemProvider |
35 | extends SensitivityResultSpecificationItemProvider |
36 | implements |
37 | IEditingDomainItemProvider, |
38 | IStructuredItemContentProvider, |
39 | ITreeItemContentProvider, |
40 | IItemLabelProvider, |
41 | IItemPropertySource { |
42 | /** |
43 | * This constructs an instance from a factory and a notifier. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public FailureTypeResultSpecificationItemProvider(AdapterFactory adapterFactory) { |
49 | super(adapterFactory); |
50 | } |
51 | |
52 | /** |
53 | * This returns the property descriptors for the adapted class. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | @Override |
59 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
60 | if (itemPropertyDescriptors == null) { |
61 | super.getPropertyDescriptors(object); |
62 | |
63 | addFailureTypes__FailureTypeResultSpecificationPropertyDescriptor(object); |
64 | } |
65 | return itemPropertyDescriptors; |
66 | } |
67 | |
68 | /** |
69 | * This adds a property descriptor for the Failure Types Failure Type Result Specification feature. |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | protected void addFailureTypes__FailureTypeResultSpecificationPropertyDescriptor(Object object) { |
75 | itemPropertyDescriptors.add |
76 | (createItemPropertyDescriptor |
77 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
78 | getResourceLocator(), |
79 | getString("_UI_FailureTypeResultSpecification_failureTypes__FailureTypeResultSpecification_feature"), |
80 | getString("_UI_PropertyDescriptor_description", "_UI_FailureTypeResultSpecification_failureTypes__FailureTypeResultSpecification_feature", "_UI_FailureTypeResultSpecification_type"), |
81 | SensitivityPackage.Literals.FAILURE_TYPE_RESULT_SPECIFICATION__FAILURE_TYPES_FAILURE_TYPE_RESULT_SPECIFICATION, |
82 | true, |
83 | false, |
84 | true, |
85 | null, |
86 | null, |
87 | null)); |
88 | } |
89 | |
90 | /** |
91 | * This returns FailureTypeResultSpecification.gif. |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | @Override |
97 | public Object getImage(Object object) { |
98 | return overlayImage(object, getResourceLocator().getImage("full/obj16/FailureTypeResultSpecification")); |
99 | } |
100 | |
101 | /** |
102 | * This returns the label text for the adapted class. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated not |
106 | */ |
107 | @Override |
108 | public String getText(Object object) { |
109 | String numberOfFailureTypes = "UNSPECIFIED"; |
110 | try { |
111 | numberOfFailureTypes = ((Integer)((FailureTypeResultSpecification)object). |
112 | getFailureTypes__FailureTypeResultSpecification().size()).toString(); |
113 | } catch(Exception e) {} |
114 | return ((FailureTypeResultSpecification)object).getEntityName() |
115 | + " (" + numberOfFailureTypes + ")" |
116 | + " [ID: " + ((FailureTypeResultSpecification)object).getId() + "]" |
117 | + " <" + getString("_UI_FailureTypeResultSpecification_type") + ">"; |
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 | } |