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.common.util.ResourceLocator; |
15 | import org.eclipse.emf.ecore.EStructuralFeature; |
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 | import org.eclipse.emf.edit.provider.ViewerNotification; |
23 | |
24 | import de.uka.ipd.sdq.pcm.core.entity.provider.EntityItemProvider; |
25 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
26 | import de.uka.ipd.sdq.pcm.seff.AbstractBranchTransition; |
27 | import de.uka.ipd.sdq.pcm.seff.SeffFactory; |
28 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
29 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityFactory; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.AbstractBranchTransition} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class AbstractBranchTransitionItemProvider |
38 | extends EntityItemProvider |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
51 | |
52 | /** |
53 | * This constructs an instance from a factory and a notifier. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | public AbstractBranchTransitionItemProvider(AdapterFactory adapterFactory) { |
59 | super(adapterFactory); |
60 | } |
61 | |
62 | /** |
63 | * This returns the property descriptors for the adapted class. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | @Override |
69 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
70 | if (itemPropertyDescriptors == null) { |
71 | super.getPropertyDescriptors(object); |
72 | |
73 | } |
74 | return itemPropertyDescriptors; |
75 | } |
76 | |
77 | /** |
78 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
79 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
80 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | @Override |
86 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
87 | if (childrenFeatures == null) { |
88 | super.getChildrenFeatures(object); |
89 | childrenFeatures.add(SeffPackage.Literals.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION); |
90 | } |
91 | return childrenFeatures; |
92 | } |
93 | |
94 | /** |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | @Override |
100 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
101 | // Check the type of the specified child object and return the proper feature to use for |
102 | // adding (see {@link AddCommand}) it as a child. |
103 | |
104 | return super.getChildFeature(object, child); |
105 | } |
106 | |
107 | /** |
108 | * This returns the label text for the adapted class. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | @Override |
114 | public String getText(Object object) { |
115 | String label = ((AbstractBranchTransition)object).getId(); |
116 | return label == null || label.length() == 0 ? |
117 | getString("_UI_AbstractBranchTransition_type") : |
118 | getString("_UI_AbstractBranchTransition_type") + " " + label; |
119 | } |
120 | |
121 | /** |
122 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
123 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | @Override |
129 | public void notifyChanged(Notification notification) { |
130 | updateChildren(notification); |
131 | |
132 | switch (notification.getFeatureID(AbstractBranchTransition.class)) { |
133 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
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_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, |
154 | SeffFactory.eINSTANCE.createResourceDemandingBehaviour())); |
155 | |
156 | newChildDescriptors.add |
157 | (createChildParameter |
158 | (SeffPackage.Literals.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, |
159 | SeffFactory.eINSTANCE.createResourceDemandingSEFF())); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (SeffPackage.Literals.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, |
164 | SeffFactory.eINSTANCE.createResourceDemandingInternalBehaviour())); |
165 | |
166 | newChildDescriptors.add |
167 | (createChildParameter |
168 | (SeffPackage.Literals.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, |
169 | SeffFactory.eINSTANCE.createForkedBehaviour())); |
170 | |
171 | newChildDescriptors.add |
172 | (createChildParameter |
173 | (SeffPackage.Literals.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, |
174 | Seff_reliabilityFactory.eINSTANCE.createRecoveryActionBehaviour())); |
175 | } |
176 | |
177 | /** |
178 | * Return the resource locator for this item provider's resources. |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | @Override |
184 | public ResourceLocator getResourceLocator() { |
185 | return PalladioComponentModelEditPlugin.INSTANCE; |
186 | } |
187 | |
188 | } |