1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository.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.edit.provider.ComposeableAdapterFactory; |
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.ItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
24 | import org.eclipse.emf.edit.provider.ViewerNotification; |
25 | |
26 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
27 | import de.uka.ipd.sdq.pcm.repository.ExceptionType; |
28 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
29 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.repository.ExceptionType} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class ExceptionTypeItemProvider |
37 | extends ItemProviderAdapter |
38 | implements |
39 | IEditingDomainItemProvider, |
40 | IStructuredItemContentProvider, |
41 | ITreeItemContentProvider, |
42 | IItemLabelProvider, |
43 | IItemPropertySource { |
44 | /** |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
50 | |
51 | /** |
52 | * This constructs an instance from a factory and a notifier. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | public ExceptionTypeItemProvider(AdapterFactory adapterFactory) { |
58 | super(adapterFactory); |
59 | } |
60 | |
61 | /** |
62 | * This returns the property descriptors for the adapted class. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
69 | if (itemPropertyDescriptors == null) { |
70 | super.getPropertyDescriptors(object); |
71 | |
72 | addExceptionNamePropertyDescriptor(object); |
73 | addExceptionMessagePropertyDescriptor(object); |
74 | } |
75 | return itemPropertyDescriptors; |
76 | } |
77 | |
78 | /** |
79 | * This adds a property descriptor for the Exception Name feature. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected void addExceptionNamePropertyDescriptor(Object object) { |
85 | itemPropertyDescriptors.add |
86 | (createItemPropertyDescriptor |
87 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
88 | getResourceLocator(), |
89 | getString("_UI_ExceptionType_exceptionName_feature"), |
90 | getString("_UI_PropertyDescriptor_description", "_UI_ExceptionType_exceptionName_feature", "_UI_ExceptionType_type"), |
91 | RepositoryPackage.Literals.EXCEPTION_TYPE__EXCEPTION_NAME, |
92 | true, |
93 | false, |
94 | false, |
95 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
96 | null, |
97 | null)); |
98 | } |
99 | |
100 | /** |
101 | * This adds a property descriptor for the Exception Message feature. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | protected void addExceptionMessagePropertyDescriptor(Object object) { |
107 | itemPropertyDescriptors.add |
108 | (createItemPropertyDescriptor |
109 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
110 | getResourceLocator(), |
111 | getString("_UI_ExceptionType_exceptionMessage_feature"), |
112 | getString("_UI_PropertyDescriptor_description", "_UI_ExceptionType_exceptionMessage_feature", "_UI_ExceptionType_type"), |
113 | RepositoryPackage.Literals.EXCEPTION_TYPE__EXCEPTION_MESSAGE, |
114 | true, |
115 | false, |
116 | false, |
117 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
118 | null, |
119 | null)); |
120 | } |
121 | |
122 | /** |
123 | * This returns ExceptionType.gif. |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | @Override |
129 | public Object getImage(Object object) { |
130 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ExceptionType")); |
131 | } |
132 | |
133 | /** |
134 | * This returns the label text for the adapted class. |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public String getText(Object object) { |
141 | String label = ((ExceptionType)object).getExceptionName(); |
142 | return label == null || label.length() == 0 ? |
143 | getString("_UI_ExceptionType_type") : |
144 | getString("_UI_ExceptionType_type") + " " + label; |
145 | } |
146 | |
147 | /** |
148 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
149 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public void notifyChanged(Notification notification) { |
156 | updateChildren(notification); |
157 | |
158 | switch (notification.getFeatureID(ExceptionType.class)) { |
159 | case RepositoryPackage.EXCEPTION_TYPE__EXCEPTION_NAME: |
160 | case RepositoryPackage.EXCEPTION_TYPE__EXCEPTION_MESSAGE: |
161 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
162 | return; |
163 | } |
164 | super.notifyChanged(notification); |
165 | } |
166 | |
167 | /** |
168 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
169 | * that can be created under this object. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | @Override |
175 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
176 | super.collectNewChildDescriptors(newChildDescriptors, object); |
177 | } |
178 | |
179 | /** |
180 | * Return the resource locator for this item provider's resources. |
181 | * <!-- begin-user-doc --> |
182 | * <!-- end-user-doc --> |
183 | * @generated |
184 | */ |
185 | @Override |
186 | public ResourceLocator getResourceLocator() { |
187 | return PalladioComponentModelEditPlugin.INSTANCE; |
188 | } |
189 | |
190 | } |