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.seff.AbstractInternalControlFlowAction; |
24 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
25 | import de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performanceFactory; |
26 | |
27 | /** |
28 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.AbstractInternalControlFlowAction} object. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public class AbstractInternalControlFlowActionItemProvider |
34 | extends AbstractActionItemProvider |
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 AbstractInternalControlFlowActionItemProvider(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.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_DEMAND_ACTION); |
86 | childrenFeatures.add(SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__INFRASTRUCTURE_CALL_ACTION); |
87 | childrenFeatures.add(SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_CALL_ACTION); |
88 | } |
89 | return childrenFeatures; |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | @Override |
98 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
99 | // Check the type of the specified child object and return the proper feature to use for |
100 | // adding (see {@link AddCommand}) it as a child. |
101 | |
102 | return super.getChildFeature(object, child); |
103 | } |
104 | |
105 | /** |
106 | * This returns the label text for the adapted class. |
107 | * <!-- begin-user-doc --> |
108 | * <!-- end-user-doc --> |
109 | * @generated |
110 | */ |
111 | @Override |
112 | public String getText(Object object) { |
113 | String label = ((AbstractInternalControlFlowAction)object).getId(); |
114 | return label == null || label.length() == 0 ? |
115 | getString("_UI_AbstractInternalControlFlowAction_type") : |
116 | getString("_UI_AbstractInternalControlFlowAction_type") + " " + label; |
117 | } |
118 | |
119 | /** |
120 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
121 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | @Override |
127 | public void notifyChanged(Notification notification) { |
128 | updateChildren(notification); |
129 | |
130 | switch (notification.getFeatureID(AbstractInternalControlFlowAction.class)) { |
131 | case SeffPackage.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_DEMAND_ACTION: |
132 | case SeffPackage.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__INFRASTRUCTURE_CALL_ACTION: |
133 | case SeffPackage.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_CALL_ACTION: |
134 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
135 | return; |
136 | } |
137 | super.notifyChanged(notification); |
138 | } |
139 | |
140 | /** |
141 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
142 | * that can be created under this object. |
143 | * <!-- begin-user-doc --> |
144 | * <!-- end-user-doc --> |
145 | * @generated |
146 | */ |
147 | @Override |
148 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
149 | super.collectNewChildDescriptors(newChildDescriptors, object); |
150 | |
151 | newChildDescriptors.add |
152 | (createChildParameter |
153 | (SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_DEMAND_ACTION, |
154 | Seff_performanceFactory.eINSTANCE.createParametricResourceDemand())); |
155 | |
156 | newChildDescriptors.add |
157 | (createChildParameter |
158 | (SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__INFRASTRUCTURE_CALL_ACTION, |
159 | Seff_performanceFactory.eINSTANCE.createInfrastructureCall())); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_CALL_ACTION, |
164 | Seff_performanceFactory.eINSTANCE.createResourceCall())); |
165 | } |
166 | |
167 | } |