1 | /** |
2 | * Copyright SDQ, IPD, U Karlsruhe, 2007 |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.completions.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.completions.CompletionRepository; |
10 | import de.uka.ipd.sdq.completions.CompletionsFactory; |
11 | import de.uka.ipd.sdq.completions.CompletionsPackage; |
12 | |
13 | import java.util.Collection; |
14 | import java.util.List; |
15 | |
16 | import org.eclipse.emf.common.notify.AdapterFactory; |
17 | import org.eclipse.emf.common.notify.Notification; |
18 | |
19 | import org.eclipse.emf.common.util.ResourceLocator; |
20 | |
21 | import org.eclipse.emf.ecore.EStructuralFeature; |
22 | |
23 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
24 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
25 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
26 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
27 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
30 | import org.eclipse.emf.edit.provider.ViewerNotification; |
31 | |
32 | /** |
33 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.completions.CompletionRepository} object. |
34 | * <!-- begin-user-doc --> |
35 | * <!-- end-user-doc --> |
36 | * @generated |
37 | */ |
38 | public class CompletionRepositoryItemProvider |
39 | extends ItemProviderAdapter |
40 | implements |
41 | IEditingDomainItemProvider, |
42 | IStructuredItemContentProvider, |
43 | ITreeItemContentProvider, |
44 | IItemLabelProvider, |
45 | IItemPropertySource { |
46 | /** |
47 | * This constructs an instance from a factory and a notifier. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | public CompletionRepositoryItemProvider(AdapterFactory adapterFactory) { |
53 | super(adapterFactory); |
54 | } |
55 | |
56 | /** |
57 | * This returns the property descriptors for the adapted class. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | @Override |
63 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
64 | if (itemPropertyDescriptors == null) { |
65 | super.getPropertyDescriptors(object); |
66 | |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
73 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
74 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
81 | if (childrenFeatures == null) { |
82 | super.getChildrenFeatures(object); |
83 | childrenFeatures.add(CompletionsPackage.Literals.COMPLETION_REPOSITORY__COMPLETIONS_COMPLETION_REPOSITORY); |
84 | } |
85 | return childrenFeatures; |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | @Override |
94 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
95 | // Check the type of the specified child object and return the proper feature to use for |
96 | // adding (see {@link AddCommand}) it as a child. |
97 | |
98 | return super.getChildFeature(object, child); |
99 | } |
100 | |
101 | /** |
102 | * This returns CompletionRepository.gif. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | @Override |
108 | public Object getImage(Object object) { |
109 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CompletionRepository")); |
110 | } |
111 | |
112 | /** |
113 | * This returns the label text for the adapted class. |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | public String getText(Object object) { |
120 | return getString("_UI_CompletionRepository_type"); |
121 | } |
122 | |
123 | /** |
124 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
125 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | @Override |
131 | public void notifyChanged(Notification notification) { |
132 | updateChildren(notification); |
133 | |
134 | switch (notification.getFeatureID(CompletionRepository.class)) { |
135 | case CompletionsPackage.COMPLETION_REPOSITORY__COMPLETIONS_COMPLETION_REPOSITORY: |
136 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
137 | return; |
138 | } |
139 | super.notifyChanged(notification); |
140 | } |
141 | |
142 | /** |
143 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
144 | * that can be created under this object. |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | @Override |
150 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
151 | super.collectNewChildDescriptors(newChildDescriptors, object); |
152 | |
153 | newChildDescriptors.add |
154 | (createChildParameter |
155 | (CompletionsPackage.Literals.COMPLETION_REPOSITORY__COMPLETIONS_COMPLETION_REPOSITORY, |
156 | CompletionsFactory.eINSTANCE.createCompletion())); |
157 | } |
158 | |
159 | /** |
160 | * Return the resource locator for this item provider's resources. |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | @Override |
166 | public ResourceLocator getResourceLocator() { |
167 | return CompletionsEditPlugin.INSTANCE; |
168 | } |
169 | |
170 | } |