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