1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.QMLProfilePackage; |
11 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.Requirement; |
12 | |
13 | import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider; |
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.ComposeableAdapterFactory; |
24 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
25 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
26 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
28 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.Requirement} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class RequirementItemProvider |
38 | extends IdentifierItemProvider |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
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 RequirementItemProvider(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 | addRequireContractPropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Require Contract feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addRequireContractPropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_Requirement_requireContract_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_Requirement_requireContract_feature", "_UI_Requirement_type"), |
84 | QMLProfilePackage.Literals.REQUIREMENT__REQUIRE_CONTRACT, |
85 | true, |
86 | false, |
87 | true, |
88 | null, |
89 | null, |
90 | null)); |
91 | } |
92 | |
93 | /** |
94 | * This returns the label text for the adapted class. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | @Override |
100 | public String getText(Object object) { |
101 | String label = ((Requirement)object).getId(); |
102 | return label == null || label.length() == 0 ? |
103 | getString("_UI_Requirement_type") : |
104 | getString("_UI_Requirement_type") + " " + label; |
105 | } |
106 | |
107 | /** |
108 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
109 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public void notifyChanged(Notification notification) { |
116 | updateChildren(notification); |
117 | super.notifyChanged(notification); |
118 | } |
119 | |
120 | /** |
121 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
122 | * that can be created under this object. |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | @Override |
128 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
129 | super.collectNewChildDescriptors(newChildDescriptors, object); |
130 | } |
131 | |
132 | /** |
133 | * Return the resource locator for this item provider's resources. |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public ResourceLocator getResourceLocator() { |
140 | return QMLProfileEditPlugin.INSTANCE; |
141 | } |
142 | |
143 | } |