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.DelegatingExternalCallAction; |
10 | |
11 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
12 | |
13 | import de.uka.ipd.sdq.pcm.seff.provider.ExternalCallActionItemProvider; |
14 | |
15 | import java.util.Collection; |
16 | import java.util.List; |
17 | |
18 | import org.eclipse.emf.common.notify.AdapterFactory; |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | |
21 | import org.eclipse.emf.common.util.ResourceLocator; |
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 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.completions.DelegatingExternalCallAction} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class DelegatingExternalCallActionItemProvider |
37 | extends ExternalCallActionItemProvider |
38 | implements |
39 | IEditingDomainItemProvider, |
40 | IStructuredItemContentProvider, |
41 | ITreeItemContentProvider, |
42 | IItemLabelProvider, |
43 | IItemPropertySource { |
44 | /** |
45 | * This constructs an instance from a factory and a notifier. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public DelegatingExternalCallActionItemProvider(AdapterFactory adapterFactory) { |
51 | super(adapterFactory); |
52 | } |
53 | |
54 | /** |
55 | * This returns the property descriptors for the adapted class. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | @Override |
61 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
62 | if (itemPropertyDescriptors == null) { |
63 | super.getPropertyDescriptors(object); |
64 | |
65 | } |
66 | return itemPropertyDescriptors; |
67 | } |
68 | |
69 | /** |
70 | * This returns DelegatingExternalCallAction.gif. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | @Override |
76 | public Object getImage(Object object) { |
77 | return overlayImage(object, getResourceLocator().getImage("full/obj16/DelegatingExternalCallAction")); |
78 | } |
79 | |
80 | /** |
81 | * This returns the label text for the adapted class. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | @Override |
87 | public String getText(Object object) { |
88 | String label = ((DelegatingExternalCallAction)object).getId(); |
89 | return label == null || label.length() == 0 ? |
90 | getString("_UI_DelegatingExternalCallAction_type") : |
91 | getString("_UI_DelegatingExternalCallAction_type") + " " + label; |
92 | } |
93 | |
94 | /** |
95 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
96 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | @Override |
102 | public void notifyChanged(Notification notification) { |
103 | updateChildren(notification); |
104 | super.notifyChanged(notification); |
105 | } |
106 | |
107 | /** |
108 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
109 | * that can be created under this object. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
116 | super.collectNewChildDescriptors(newChildDescriptors, object); |
117 | } |
118 | |
119 | /** |
120 | * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { |
127 | Object childFeature = feature; |
128 | Object childObject = child; |
129 | |
130 | boolean qualify = |
131 | childFeature == SeffPackage.Literals.CALL_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION || |
132 | childFeature == SeffPackage.Literals.CALL_RETURN_ACTION__RETURN_VARIABLE_USAGE_CALL_RETURN_ACTION; |
133 | |
134 | if (qualify) { |
135 | return getString |
136 | ("_UI_CreateChild_text2", |
137 | new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
138 | } |
139 | return super.getCreateChildText(owner, feature, child, selection); |
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 CompletionsEditPlugin.INSTANCE; |
151 | } |
152 | |
153 | } |