1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.qualityannotation.provider; |
8 | |
9 | |
10 | import de.fzi.se.quality.provider.QualityEditPlugin; |
11 | |
12 | import de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartition; |
13 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
14 | |
15 | import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider; |
16 | |
17 | import java.util.Collection; |
18 | import java.util.List; |
19 | |
20 | import org.eclipse.emf.common.notify.AdapterFactory; |
21 | import org.eclipse.emf.common.notify.Notification; |
22 | |
23 | import org.eclipse.emf.common.util.ResourceLocator; |
24 | |
25 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
26 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
27 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
28 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
29 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
30 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
31 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
32 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
33 | import org.eclipse.emf.edit.provider.ViewerNotification; |
34 | |
35 | /** |
36 | * This is the item provider adapter for a {@link de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartition} object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public class CharacterisedPCMParameterPartitionItemProvider |
42 | extends IdentifierItemProvider |
43 | implements |
44 | IEditingDomainItemProvider, |
45 | IStructuredItemContentProvider, |
46 | ITreeItemContentProvider, |
47 | IItemLabelProvider, |
48 | IItemPropertySource { |
49 | /** |
50 | * This constructs an instance from a factory and a notifier. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public CharacterisedPCMParameterPartitionItemProvider(AdapterFactory adapterFactory) { |
56 | super(adapterFactory); |
57 | } |
58 | |
59 | /** |
60 | * This returns the property descriptors for the adapted class. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | @Override |
66 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
67 | if (itemPropertyDescriptors == null) { |
68 | super.getPropertyDescriptors(object); |
69 | |
70 | addForCharacterisationPropertyDescriptor(object); |
71 | } |
72 | return itemPropertyDescriptors; |
73 | } |
74 | |
75 | /** |
76 | * This adds a property descriptor for the For Characterisation feature. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | protected void addForCharacterisationPropertyDescriptor(Object object) { |
82 | itemPropertyDescriptors.add |
83 | (createItemPropertyDescriptor |
84 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
85 | getResourceLocator(), |
86 | getString("_UI_CharacterisedPCMParameterPartition_forCharacterisation_feature"), |
87 | getString("_UI_PropertyDescriptor_description", "_UI_CharacterisedPCMParameterPartition_forCharacterisation_feature", "_UI_CharacterisedPCMParameterPartition_type"), |
88 | QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION, |
89 | true, |
90 | false, |
91 | false, |
92 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
93 | null, |
94 | null)); |
95 | } |
96 | |
97 | /** |
98 | * This returns the label text for the adapted class. |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | @Override |
104 | public String getText(Object object) { |
105 | String label = ((CharacterisedPCMParameterPartition)object).getId(); |
106 | return label == null || label.length() == 0 ? |
107 | getString("_UI_CharacterisedPCMParameterPartition_type") : |
108 | getString("_UI_CharacterisedPCMParameterPartition_type") + " " + label; |
109 | } |
110 | |
111 | /** |
112 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
113 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | public void notifyChanged(Notification notification) { |
120 | updateChildren(notification); |
121 | |
122 | switch (notification.getFeatureID(CharacterisedPCMParameterPartition.class)) { |
123 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION: |
124 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
125 | return; |
126 | } |
127 | super.notifyChanged(notification); |
128 | } |
129 | |
130 | /** |
131 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
132 | * that can be created under this object. |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
139 | super.collectNewChildDescriptors(newChildDescriptors, object); |
140 | } |
141 | |
142 | /** |
143 | * Return the resource locator for this item provider's resources. |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | public ResourceLocator getResourceLocator() { |
150 | return QualityEditPlugin.INSTANCE; |
151 | } |
152 | |
153 | } |