1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.core.entity.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.ItemProviderAdapter; |
23 | |
24 | import de.uka.ipd.sdq.pcm.core.entity.EntityPackage; |
25 | import de.uka.ipd.sdq.pcm.core.entity.ResourceProvidedRole; |
26 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
27 | import de.uka.ipd.sdq.pcm.repository.provider.RoleItemProvider; |
28 | |
29 | /** |
30 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.core.entity.ResourceProvidedRole} object. |
31 | * <!-- begin-user-doc --> |
32 | * <!-- end-user-doc --> |
33 | * @generated |
34 | */ |
35 | public class ResourceProvidedRoleItemProvider |
36 | extends RoleItemProvider |
37 | implements |
38 | IEditingDomainItemProvider, |
39 | IStructuredItemContentProvider, |
40 | ITreeItemContentProvider, |
41 | IItemLabelProvider, |
42 | IItemPropertySource { |
43 | /** |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
49 | |
50 | /** |
51 | * This constructs an instance from a factory and a notifier. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | public ResourceProvidedRoleItemProvider(AdapterFactory adapterFactory) { |
57 | super(adapterFactory); |
58 | } |
59 | |
60 | /** |
61 | * This returns the property descriptors for the adapted class. |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | @Override |
67 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
68 | if (itemPropertyDescriptors == null) { |
69 | super.getPropertyDescriptors(object); |
70 | |
71 | addProvidedResourceInterface__ResourceProvidedRolePropertyDescriptor(object); |
72 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This adds a property descriptor for the Provided Resource Interface Resource Provided Role feature. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | protected void addProvidedResourceInterface__ResourceProvidedRolePropertyDescriptor(Object object) { |
83 | itemPropertyDescriptors.add |
84 | (createItemPropertyDescriptor |
85 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
86 | getResourceLocator(), |
87 | getString("_UI_ResourceProvidedRole_providedResourceInterface__ResourceProvidedRole_feature"), |
88 | getString("_UI_PropertyDescriptor_description", "_UI_ResourceProvidedRole_providedResourceInterface__ResourceProvidedRole_feature", "_UI_ResourceProvidedRole_type"), |
89 | EntityPackage.Literals.RESOURCE_PROVIDED_ROLE__PROVIDED_RESOURCE_INTERFACE_RESOURCE_PROVIDED_ROLE, |
90 | true, |
91 | false, |
92 | true, |
93 | null, |
94 | null, |
95 | null)); |
96 | } |
97 | |
98 | /** |
99 | * This returns ResourceProvidedRole.gif. |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | @Override |
105 | public Object getImage(Object object) { |
106 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceProvidedRole")); |
107 | } |
108 | |
109 | /** |
110 | * This returns the label text for the adapted class. |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | public String getText(Object object) { |
117 | String label = ((ResourceProvidedRole)object).getId(); |
118 | return label == null || label.length() == 0 ? |
119 | getString("_UI_ResourceProvidedRole_type") : |
120 | getString("_UI_ResourceProvidedRole_type") + " " + label; |
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 | super.notifyChanged(notification); |
134 | } |
135 | |
136 | /** |
137 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
138 | * that can be created under this object. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
145 | super.collectNewChildDescriptors(newChildDescriptors, object); |
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 PalladioComponentModelEditPlugin.INSTANCE; |
157 | } |
158 | |
159 | } |