1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.seff_reliability.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
10 | |
11 | import de.uka.ipd.sdq.pcm.seff.provider.AbstractInternalControlFlowActionItemProvider; |
12 | |
13 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryAction; |
14 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityFactory; |
15 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityPackage; |
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.ecore.EStructuralFeature; |
26 | |
27 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
28 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
29 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
30 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
31 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
32 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
33 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
34 | import org.eclipse.emf.edit.provider.ViewerNotification; |
35 | |
36 | /** |
37 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryAction} object. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public class RecoveryActionItemProvider |
43 | extends AbstractInternalControlFlowActionItemProvider |
44 | implements |
45 | IEditingDomainItemProvider, |
46 | IStructuredItemContentProvider, |
47 | ITreeItemContentProvider, |
48 | IItemLabelProvider, |
49 | IItemPropertySource { |
50 | /** |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
56 | |
57 | /** |
58 | * This constructs an instance from a factory and a notifier. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | public RecoveryActionItemProvider(AdapterFactory adapterFactory) { |
64 | super(adapterFactory); |
65 | } |
66 | |
67 | /** |
68 | * This returns the property descriptors for the adapted class. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | @Override |
74 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
75 | if (itemPropertyDescriptors == null) { |
76 | super.getPropertyDescriptors(object); |
77 | |
78 | addPrimaryBehaviour__RecoveryActionPropertyDescriptor(object); |
79 | } |
80 | return itemPropertyDescriptors; |
81 | } |
82 | |
83 | /** |
84 | * This adds a property descriptor for the Primary Behaviour Recovery Action feature. |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | protected void addPrimaryBehaviour__RecoveryActionPropertyDescriptor(Object object) { |
90 | itemPropertyDescriptors.add |
91 | (createItemPropertyDescriptor |
92 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
93 | getResourceLocator(), |
94 | getString("_UI_RecoveryAction_primaryBehaviour__RecoveryAction_feature"), |
95 | getString("_UI_PropertyDescriptor_description", "_UI_RecoveryAction_primaryBehaviour__RecoveryAction_feature", "_UI_RecoveryAction_type"), |
96 | Seff_reliabilityPackage.Literals.RECOVERY_ACTION__PRIMARY_BEHAVIOUR_RECOVERY_ACTION, |
97 | true, |
98 | false, |
99 | true, |
100 | null, |
101 | null, |
102 | null)); |
103 | } |
104 | |
105 | /** |
106 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
107 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
108 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | @Override |
114 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
115 | if (childrenFeatures == null) { |
116 | super.getChildrenFeatures(object); |
117 | childrenFeatures.add(Seff_reliabilityPackage.Literals.RECOVERY_ACTION__RECOVERY_ACTION_BEHAVIOURS_RECOVERY_ACTION); |
118 | } |
119 | return childrenFeatures; |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | @Override |
128 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
129 | // Check the type of the specified child object and return the proper feature to use for |
130 | // adding (see {@link AddCommand}) it as a child. |
131 | |
132 | return super.getChildFeature(object, child); |
133 | } |
134 | |
135 | /** |
136 | * This returns RecoveryAction.gif. |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | @Override |
142 | public Object getImage(Object object) { |
143 | return overlayImage(object, getResourceLocator().getImage("full/obj16/RecoveryAction")); |
144 | } |
145 | |
146 | /** |
147 | * This returns the label text for the adapted class. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | @Override |
153 | public String getText(Object object) { |
154 | String label = ((RecoveryAction)object).getId(); |
155 | return label == null || label.length() == 0 ? |
156 | getString("_UI_RecoveryAction_type") : |
157 | getString("_UI_RecoveryAction_type") + " " + label; |
158 | } |
159 | |
160 | /** |
161 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
162 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public void notifyChanged(Notification notification) { |
169 | updateChildren(notification); |
170 | |
171 | switch (notification.getFeatureID(RecoveryAction.class)) { |
172 | case Seff_reliabilityPackage.RECOVERY_ACTION__RECOVERY_ACTION_BEHAVIOURS_RECOVERY_ACTION: |
173 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
174 | return; |
175 | } |
176 | super.notifyChanged(notification); |
177 | } |
178 | |
179 | /** |
180 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
181 | * that can be created under this object. |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | @Override |
187 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
188 | super.collectNewChildDescriptors(newChildDescriptors, object); |
189 | |
190 | newChildDescriptors.add |
191 | (createChildParameter |
192 | (Seff_reliabilityPackage.Literals.RECOVERY_ACTION__RECOVERY_ACTION_BEHAVIOURS_RECOVERY_ACTION, |
193 | Seff_reliabilityFactory.eINSTANCE.createRecoveryActionBehaviour())); |
194 | } |
195 | |
196 | /** |
197 | * Return the resource locator for this item provider's resources. |
198 | * <!-- begin-user-doc --> |
199 | * <!-- end-user-doc --> |
200 | * @generated |
201 | */ |
202 | @Override |
203 | public ResourceLocator getResourceLocator() { |
204 | return PalladioComponentModelEditPlugin.INSTANCE; |
205 | } |
206 | |
207 | } |