1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_usage.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsagePackage; |
10 | import de.uka.ipd.sdq.context.computed_usage.Output; |
11 | |
12 | import de.uka.ipd.sdq.pcm.parameter.ParameterFactory; |
13 | |
14 | import java.util.Collection; |
15 | import java.util.List; |
16 | |
17 | import org.eclipse.emf.common.notify.AdapterFactory; |
18 | import org.eclipse.emf.common.notify.Notification; |
19 | |
20 | import org.eclipse.emf.common.util.ResourceLocator; |
21 | |
22 | import org.eclipse.emf.ecore.EStructuralFeature; |
23 | |
24 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
25 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
26 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
28 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
30 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
31 | import org.eclipse.emf.edit.provider.ViewerNotification; |
32 | |
33 | /** |
34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.computed_usage.Output} object. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class OutputItemProvider |
40 | extends ItemProviderAdapter |
41 | implements |
42 | IEditingDomainItemProvider, |
43 | IStructuredItemContentProvider, |
44 | ITreeItemContentProvider, |
45 | IItemLabelProvider, |
46 | IItemPropertySource { |
47 | /** |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
53 | |
54 | /** |
55 | * This constructs an instance from a factory and a notifier. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | public OutputItemProvider(AdapterFactory adapterFactory) { |
61 | super(adapterFactory); |
62 | } |
63 | |
64 | /** |
65 | * This returns the property descriptors for the adapted class. |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | @Override |
71 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
72 | if (itemPropertyDescriptors == null) { |
73 | super.getPropertyDescriptors(object); |
74 | |
75 | } |
76 | return itemPropertyDescriptors; |
77 | } |
78 | |
79 | /** |
80 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
81 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
82 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | @Override |
88 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
89 | if (childrenFeatures == null) { |
90 | super.getChildrenFeatures(object); |
91 | childrenFeatures.add(ComputedUsagePackage.Literals.OUTPUT__PARAMETER_CHARACTERISATIONS_OUTPUT); |
92 | } |
93 | return childrenFeatures; |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | @Override |
102 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
103 | // Check the type of the specified child object and return the proper feature to use for |
104 | // adding (see {@link AddCommand}) it as a child. |
105 | |
106 | return super.getChildFeature(object, child); |
107 | } |
108 | |
109 | /** |
110 | * This returns Output.gif. |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | public Object getImage(Object object) { |
117 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Output")); |
118 | } |
119 | |
120 | /** |
121 | * This returns the label text for the adapted class. |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | @Override |
127 | public String getText(Object object) { |
128 | return getString("_UI_Output_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(Output.class)) { |
143 | case ComputedUsagePackage.OUTPUT__PARAMETER_CHARACTERISATIONS_OUTPUT: |
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 | (ComputedUsagePackage.Literals.OUTPUT__PARAMETER_CHARACTERISATIONS_OUTPUT, |
164 | ParameterFactory.eINSTANCE.createVariableUsage())); |
165 | } |
166 | |
167 | /** |
168 | * Return the resource locator for this item provider's resources. |
169 | * <!-- begin-user-doc --> |
170 | * <!-- end-user-doc --> |
171 | * @generated |
172 | */ |
173 | @Override |
174 | public ResourceLocator getResourceLocator() { |
175 | return ContextEditPlugin.INSTANCE; |
176 | } |
177 | |
178 | } |