1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.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.ecore.EStructuralFeature; |
15 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
16 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
17 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
18 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
19 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
20 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ViewerNotification; |
22 | |
23 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityFactory; |
24 | import de.uka.ipd.sdq.pcm.seff.InternalAction; |
25 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
26 | |
27 | /** |
28 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.InternalAction} object. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public class InternalActionItemProvider |
34 | extends AbstractInternalControlFlowActionItemProvider |
35 | implements |
36 | IEditingDomainItemProvider, |
37 | IStructuredItemContentProvider, |
38 | ITreeItemContentProvider, |
39 | IItemLabelProvider, |
40 | IItemPropertySource { |
41 | /** |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
47 | |
48 | /** |
49 | * This constructs an instance from a factory and a notifier. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public InternalActionItemProvider(AdapterFactory adapterFactory) { |
55 | super(adapterFactory); |
56 | } |
57 | |
58 | /** |
59 | * This returns the property descriptors for the adapted class. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | @Override |
65 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
66 | if (itemPropertyDescriptors == null) { |
67 | super.getPropertyDescriptors(object); |
68 | |
69 | } |
70 | return itemPropertyDescriptors; |
71 | } |
72 | |
73 | /** |
74 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
75 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
76 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | @Override |
82 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
83 | if (childrenFeatures == null) { |
84 | super.getChildrenFeatures(object); |
85 | childrenFeatures.add(SeffPackage.Literals.INTERNAL_ACTION__INTERNAL_FAILURE_OCCURRENCE_DESCRIPTIONS_INTERNAL_ACTION); |
86 | } |
87 | return childrenFeatures; |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | @Override |
96 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
97 | // Check the type of the specified child object and return the proper feature to use for |
98 | // adding (see {@link AddCommand}) it as a child. |
99 | |
100 | return super.getChildFeature(object, child); |
101 | } |
102 | |
103 | /** |
104 | * This returns InternalAction.gif. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | @Override |
110 | public Object getImage(Object object) { |
111 | return overlayImage(object, getResourceLocator().getImage("full/obj16/InternalAction")); |
112 | } |
113 | |
114 | /** |
115 | * This returns the label text for the adapted class. |
116 | * <!-- begin-user-doc --> |
117 | * FB: Adapted method to produce a more informative label for display in non-PCM editors. |
118 | * In PCM editors, display is not controlled by this method but through a more general |
119 | * mechanism (I'n not sure where it's actually controlled, maybe the |
120 | * de.uka.ipd.sdq.pcmbench.tabs.PropertyLabelProvider.getText() method?) |
121 | * <!-- end-user-doc --> |
122 | * @generated not |
123 | */ |
124 | @Override |
125 | public String getText(Object object) { |
126 | return ((InternalAction)object).getEntityName() |
127 | + " [ID: " + ((InternalAction)object).getId() + "]" |
128 | + " <" + getString("_UI_InternalAction_type") + ">"; |
129 | } |
130 | |
131 | /** |
132 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
133 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public void notifyChanged(Notification notification) { |
140 | updateChildren(notification); |
141 | |
142 | switch (notification.getFeatureID(InternalAction.class)) { |
143 | case SeffPackage.INTERNAL_ACTION__INTERNAL_FAILURE_OCCURRENCE_DESCRIPTIONS_INTERNAL_ACTION: |
144 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
145 | return; |
146 | } |
147 | super.notifyChanged(notification); |
148 | } |
149 | |
150 | /** |
151 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
152 | * that can be created under this object. |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | @Override |
158 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
159 | super.collectNewChildDescriptors(newChildDescriptors, object); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (SeffPackage.Literals.INTERNAL_ACTION__INTERNAL_FAILURE_OCCURRENCE_DESCRIPTIONS_INTERNAL_ACTION, |
164 | ReliabilityFactory.eINSTANCE.createInternalFailureOccurrenceDescription())); |
165 | } |
166 | |
167 | } |