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.SensitivityPackage; |
24 | import de.uka.ipd.sdq.sensitivity.UsageBranchParameter; |
25 | |
26 | /** |
27 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.sensitivity.UsageBranchParameter} object. |
28 | * <!-- begin-user-doc --> |
29 | * <!-- end-user-doc --> |
30 | * @generated |
31 | */ |
32 | public class UsageBranchParameterItemProvider |
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 UsageBranchParameterItemProvider(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 | addBranch__UsageBranchParameterPropertyDescriptor(object); |
62 | addScenarioBehaviour__UsageBranchParameterPropertyDescriptor(object); |
63 | } |
64 | return itemPropertyDescriptors; |
65 | } |
66 | |
67 | /** |
68 | * This adds a property descriptor for the Branch Usage Branch Parameter feature. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | protected void addBranch__UsageBranchParameterPropertyDescriptor(Object object) { |
74 | itemPropertyDescriptors.add |
75 | (createItemPropertyDescriptor |
76 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
77 | getResourceLocator(), |
78 | getString("_UI_UsageBranchParameter_branch__UsageBranchParameter_feature"), |
79 | getString("_UI_PropertyDescriptor_description", "_UI_UsageBranchParameter_branch__UsageBranchParameter_feature", "_UI_UsageBranchParameter_type"), |
80 | SensitivityPackage.Literals.USAGE_BRANCH_PARAMETER__BRANCH_USAGE_BRANCH_PARAMETER, |
81 | true, |
82 | false, |
83 | true, |
84 | null, |
85 | null, |
86 | null)); |
87 | } |
88 | |
89 | /** |
90 | * This adds a property descriptor for the Scenario Behaviour Usage Branch Parameter feature. |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | protected void addScenarioBehaviour__UsageBranchParameterPropertyDescriptor(Object object) { |
96 | itemPropertyDescriptors.add |
97 | (createItemPropertyDescriptor |
98 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
99 | getResourceLocator(), |
100 | getString("_UI_UsageBranchParameter_scenarioBehaviour__UsageBranchParameter_feature"), |
101 | getString("_UI_PropertyDescriptor_description", "_UI_UsageBranchParameter_scenarioBehaviour__UsageBranchParameter_feature", "_UI_UsageBranchParameter_type"), |
102 | SensitivityPackage.Literals.USAGE_BRANCH_PARAMETER__SCENARIO_BEHAVIOUR_USAGE_BRANCH_PARAMETER, |
103 | true, |
104 | false, |
105 | true, |
106 | null, |
107 | null, |
108 | null)); |
109 | } |
110 | |
111 | /** |
112 | * This returns UsageBranchParameter.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/UsageBranchParameter")); |
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 branchName = "UNSPECIFIED"; |
131 | try { |
132 | branchName = ((UsageBranchParameter)object). |
133 | getBranch__UsageBranchParameter().getEntityName(); |
134 | } catch(Exception e) {} |
135 | String behaviourName = "UNSPECIFIED"; |
136 | try { |
137 | behaviourName = ((UsageBranchParameter)object). |
138 | getScenarioBehaviour__UsageBranchParameter().getEntityName(); |
139 | } catch(Exception e) {} |
140 | return ((UsageBranchParameter)object).getEntityName() |
141 | + " (" + branchName + "/" + behaviourName + ")" |
142 | + " [ID: " + ((UsageBranchParameter)object).getId() + "]" |
143 | + " <" + getString("_UI_UsageBranchParameter_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 | } |