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