1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.resourcetype.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.ecore.EStructuralFeature; |
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.ItemProviderAdapter; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
26 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceRepository; |
27 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypeFactory; |
28 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage; |
29 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.resourcetype.ResourceRepository} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class ResourceRepositoryItemProvider |
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 ResourceRepositoryItemProvider(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 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
78 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
79 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | @Override |
85 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
86 | if (childrenFeatures == null) { |
87 | super.getChildrenFeatures(object); |
88 | childrenFeatures.add(ResourcetypePackage.Literals.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY); |
89 | childrenFeatures.add(ResourcetypePackage.Literals.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY); |
90 | } |
91 | return childrenFeatures; |
92 | } |
93 | |
94 | /** |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | @Override |
100 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
101 | // Check the type of the specified child object and return the proper feature to use for |
102 | // adding (see {@link AddCommand}) it as a child. |
103 | |
104 | return super.getChildFeature(object, child); |
105 | } |
106 | |
107 | /** |
108 | * This returns ResourceRepository.gif. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | @Override |
114 | public Object getImage(Object object) { |
115 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceRepository")); |
116 | } |
117 | |
118 | /** |
119 | * This returns the label text for the adapted class. |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public String getText(Object object) { |
126 | return getString("_UI_ResourceRepository_type"); |
127 | } |
128 | |
129 | /** |
130 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
131 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | @Override |
137 | public void notifyChanged(Notification notification) { |
138 | updateChildren(notification); |
139 | |
140 | switch (notification.getFeatureID(ResourceRepository.class)) { |
141 | case ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
142 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
143 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
144 | return; |
145 | } |
146 | super.notifyChanged(notification); |
147 | } |
148 | |
149 | /** |
150 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
151 | * that can be created under this object. |
152 | * <!-- begin-user-doc --> |
153 | * <!-- end-user-doc --> |
154 | * @generated |
155 | */ |
156 | @Override |
157 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
158 | super.collectNewChildDescriptors(newChildDescriptors, object); |
159 | |
160 | newChildDescriptors.add |
161 | (createChildParameter |
162 | (ResourcetypePackage.Literals.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY, |
163 | ResourcetypeFactory.eINSTANCE.createResourceInterface())); |
164 | |
165 | newChildDescriptors.add |
166 | (createChildParameter |
167 | (ResourcetypePackage.Literals.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY, |
168 | ResourcetypeFactory.eINSTANCE.createProcessingResourceType())); |
169 | |
170 | newChildDescriptors.add |
171 | (createChildParameter |
172 | (ResourcetypePackage.Literals.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY, |
173 | ResourcetypeFactory.eINSTANCE.createCommunicationLinkResourceType())); |
174 | } |
175 | |
176 | /** |
177 | * Return the resource locator for this item provider's resources. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | @Override |
183 | public ResourceLocator getResourceLocator() { |
184 | return PalladioComponentModelEditPlugin.INSTANCE; |
185 | } |
186 | |
187 | } |