| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.allocation.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 | |
| 23 | import de.uka.ipd.sdq.pcm.allocation.AllocationContext; |
| 24 | import de.uka.ipd.sdq.pcm.allocation.AllocationPackage; |
| 25 | import de.uka.ipd.sdq.pcm.core.entity.provider.EntityItemProvider; |
| 26 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
| 27 | |
| 28 | /** |
| 29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.allocation.AllocationContext} object. |
| 30 | * <!-- begin-user-doc --> |
| 31 | * <!-- end-user-doc --> |
| 32 | * @generated |
| 33 | */ |
| 34 | public class AllocationContextItemProvider |
| 35 | extends EntityItemProvider |
| 36 | implements |
| 37 | IEditingDomainItemProvider, |
| 38 | IStructuredItemContentProvider, |
| 39 | ITreeItemContentProvider, |
| 40 | IItemLabelProvider, |
| 41 | IItemPropertySource { |
| 42 | /** |
| 43 | * <!-- begin-user-doc --> |
| 44 | * <!-- end-user-doc --> |
| 45 | * @generated |
| 46 | */ |
| 47 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 48 | |
| 49 | /** |
| 50 | * This constructs an instance from a factory and a notifier. |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @generated |
| 54 | */ |
| 55 | public AllocationContextItemProvider(AdapterFactory adapterFactory) { |
| 56 | super(adapterFactory); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * This returns the property descriptors for the adapted class. |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @generated |
| 64 | */ |
| 65 | @Override |
| 66 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 67 | if (itemPropertyDescriptors == null) { |
| 68 | super.getPropertyDescriptors(object); |
| 69 | |
| 70 | addResourceContainer_AllocationContextPropertyDescriptor(object); |
| 71 | addAssemblyContext_AllocationContextPropertyDescriptor(object); |
| 72 | addEventChannel__AllocationContextPropertyDescriptor(object); |
| 73 | } |
| 74 | return itemPropertyDescriptors; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * This adds a property descriptor for the Resource Container Allocation Context feature. |
| 79 | * <!-- begin-user-doc --> |
| 80 | * <!-- end-user-doc --> |
| 81 | * @generated |
| 82 | */ |
| 83 | protected void addResourceContainer_AllocationContextPropertyDescriptor(Object object) { |
| 84 | itemPropertyDescriptors.add |
| 85 | (createItemPropertyDescriptor |
| 86 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 87 | getResourceLocator(), |
| 88 | getString("_UI_AllocationContext_resourceContainer_AllocationContext_feature"), |
| 89 | getString("_UI_PropertyDescriptor_description", "_UI_AllocationContext_resourceContainer_AllocationContext_feature", "_UI_AllocationContext_type"), |
| 90 | AllocationPackage.Literals.ALLOCATION_CONTEXT__RESOURCE_CONTAINER_ALLOCATION_CONTEXT, |
| 91 | true, |
| 92 | false, |
| 93 | true, |
| 94 | null, |
| 95 | null, |
| 96 | null)); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * This adds a property descriptor for the Assembly Context Allocation Context feature. |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @generated |
| 104 | */ |
| 105 | protected void addAssemblyContext_AllocationContextPropertyDescriptor(Object object) { |
| 106 | itemPropertyDescriptors.add |
| 107 | (createItemPropertyDescriptor |
| 108 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 109 | getResourceLocator(), |
| 110 | getString("_UI_AllocationContext_assemblyContext_AllocationContext_feature"), |
| 111 | getString("_UI_PropertyDescriptor_description", "_UI_AllocationContext_assemblyContext_AllocationContext_feature", "_UI_AllocationContext_type"), |
| 112 | AllocationPackage.Literals.ALLOCATION_CONTEXT__ASSEMBLY_CONTEXT_ALLOCATION_CONTEXT, |
| 113 | true, |
| 114 | false, |
| 115 | true, |
| 116 | null, |
| 117 | null, |
| 118 | null)); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * This adds a property descriptor for the Event Channel Allocation Context feature. |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | protected void addEventChannel__AllocationContextPropertyDescriptor(Object object) { |
| 128 | itemPropertyDescriptors.add |
| 129 | (createItemPropertyDescriptor |
| 130 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 131 | getResourceLocator(), |
| 132 | getString("_UI_AllocationContext_eventChannel__AllocationContext_feature"), |
| 133 | getString("_UI_PropertyDescriptor_description", "_UI_AllocationContext_eventChannel__AllocationContext_feature", "_UI_AllocationContext_type"), |
| 134 | AllocationPackage.Literals.ALLOCATION_CONTEXT__EVENT_CHANNEL_ALLOCATION_CONTEXT, |
| 135 | true, |
| 136 | false, |
| 137 | true, |
| 138 | null, |
| 139 | null, |
| 140 | null)); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * This returns AllocationContext.gif. |
| 145 | * <!-- begin-user-doc --> |
| 146 | * <!-- end-user-doc --> |
| 147 | * @generated |
| 148 | */ |
| 149 | @Override |
| 150 | public Object getImage(Object object) { |
| 151 | return overlayImage(object, getResourceLocator().getImage("full/obj16/AllocationContext")); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * This returns the label text for the adapted class. |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | @Override |
| 161 | public String getText(Object object) { |
| 162 | String label = ((AllocationContext)object).getId(); |
| 163 | return label == null || label.length() == 0 ? |
| 164 | getString("_UI_AllocationContext_type") : |
| 165 | getString("_UI_AllocationContext_type") + " " + label; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 170 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | @Override |
| 176 | public void notifyChanged(Notification notification) { |
| 177 | updateChildren(notification); |
| 178 | super.notifyChanged(notification); |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 183 | * that can be created under this object. |
| 184 | * <!-- begin-user-doc --> |
| 185 | * <!-- end-user-doc --> |
| 186 | * @generated |
| 187 | */ |
| 188 | @Override |
| 189 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 190 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Return the resource locator for this item provider's resources. |
| 195 | * <!-- begin-user-doc --> |
| 196 | * <!-- end-user-doc --> |
| 197 | * @generated |
| 198 | */ |
| 199 | @Override |
| 200 | public ResourceLocator getResourceLocator() { |
| 201 | return PalladioComponentModelEditPlugin.INSTANCE; |
| 202 | } |
| 203 | |
| 204 | } |