| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.system.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.ecore.EStructuralFeature; |
| 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.ViewerNotification; |
| 23 | |
| 24 | import de.uka.ipd.sdq.pcm.core.composition.CompositionFactory; |
| 25 | import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage; |
| 26 | import de.uka.ipd.sdq.pcm.core.entity.EntityFactory; |
| 27 | import de.uka.ipd.sdq.pcm.core.entity.EntityPackage; |
| 28 | import de.uka.ipd.sdq.pcm.core.entity.provider.EntityItemProvider; |
| 29 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
| 30 | import de.uka.ipd.sdq.pcm.qosannotations.QosannotationsFactory; |
| 31 | import de.uka.ipd.sdq.pcm.repository.RepositoryFactory; |
| 32 | import de.uka.ipd.sdq.pcm.system.SystemPackage; |
| 33 | |
| 34 | /** |
| 35 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.system.System} object. |
| 36 | * <!-- begin-user-doc --> |
| 37 | * <!-- end-user-doc --> |
| 38 | * @generated |
| 39 | */ |
| 40 | public class SystemItemProvider |
| 41 | extends EntityItemProvider |
| 42 | implements |
| 43 | IEditingDomainItemProvider, |
| 44 | IStructuredItemContentProvider, |
| 45 | ITreeItemContentProvider, |
| 46 | IItemLabelProvider, |
| 47 | IItemPropertySource { |
| 48 | /** |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @generated |
| 52 | */ |
| 53 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 54 | |
| 55 | /** |
| 56 | * This constructs an instance from a factory and a notifier. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @generated |
| 60 | */ |
| 61 | public SystemItemProvider(AdapterFactory adapterFactory) { |
| 62 | super(adapterFactory); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * This returns the property descriptors for the adapted class. |
| 67 | * <!-- begin-user-doc --> |
| 68 | * <!-- end-user-doc --> |
| 69 | * @generated |
| 70 | */ |
| 71 | @Override |
| 72 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 73 | if (itemPropertyDescriptors == null) { |
| 74 | super.getPropertyDescriptors(object); |
| 75 | |
| 76 | } |
| 77 | return itemPropertyDescriptors; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 82 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 83 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 84 | * <!-- begin-user-doc --> |
| 85 | * <!-- end-user-doc --> |
| 86 | * @generated |
| 87 | */ |
| 88 | @Override |
| 89 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 90 | if (childrenFeatures == null) { |
| 91 | super.getChildrenFeatures(object); |
| 92 | childrenFeatures.add(CompositionPackage.Literals.COMPOSED_STRUCTURE__ASSEMBLY_CONTEXTS_COMPOSED_STRUCTURE); |
| 93 | childrenFeatures.add(CompositionPackage.Literals.COMPOSED_STRUCTURE__RESOURCE_REQUIRED_DELEGATION_CONNECTORS_COMPOSED_STRUCTURE); |
| 94 | childrenFeatures.add(CompositionPackage.Literals.COMPOSED_STRUCTURE__EVENT_CHANNEL_COMPOSED_STRUCTURE); |
| 95 | childrenFeatures.add(CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE); |
| 96 | childrenFeatures.add(EntityPackage.Literals.INTERFACE_PROVIDING_ENTITY__PROVIDED_ROLES_INTERFACE_PROVIDING_ENTITY); |
| 97 | childrenFeatures.add(EntityPackage.Literals.RESOURCE_INTERFACE_REQUIRING_ENTITY__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY); |
| 98 | childrenFeatures.add(EntityPackage.Literals.INTERFACE_REQUIRING_ENTITY__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY); |
| 99 | childrenFeatures.add(SystemPackage.Literals.SYSTEM__QOS_ANNOTATIONS_SYSTEM); |
| 100 | } |
| 101 | return childrenFeatures; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @generated |
| 108 | */ |
| 109 | @Override |
| 110 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 111 | // Check the type of the specified child object and return the proper feature to use for |
| 112 | // adding (see {@link AddCommand}) it as a child. |
| 113 | |
| 114 | return super.getChildFeature(object, child); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * This returns System.gif. |
| 119 | * <!-- begin-user-doc --> |
| 120 | * <!-- end-user-doc --> |
| 121 | * @generated |
| 122 | */ |
| 123 | @Override |
| 124 | public Object getImage(Object object) { |
| 125 | return overlayImage(object, getResourceLocator().getImage("full/obj16/System")); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * This returns the label text for the adapted class. |
| 130 | * <!-- begin-user-doc --> |
| 131 | * <!-- end-user-doc --> |
| 132 | * @generated |
| 133 | */ |
| 134 | @Override |
| 135 | public String getText(Object object) { |
| 136 | String label = ((de.uka.ipd.sdq.pcm.system.System)object).getId(); |
| 137 | return label == null || label.length() == 0 ? |
| 138 | getString("_UI_System_type") : |
| 139 | getString("_UI_System_type") + " " + label; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 144 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 145 | * <!-- begin-user-doc --> |
| 146 | * <!-- end-user-doc --> |
| 147 | * @generated |
| 148 | */ |
| 149 | @Override |
| 150 | public void notifyChanged(Notification notification) { |
| 151 | updateChildren(notification); |
| 152 | |
| 153 | switch (notification.getFeatureID(de.uka.ipd.sdq.pcm.system.System.class)) { |
| 154 | case SystemPackage.SYSTEM__ASSEMBLY_CONTEXTS_COMPOSED_STRUCTURE: |
| 155 | case SystemPackage.SYSTEM__RESOURCE_REQUIRED_DELEGATION_CONNECTORS_COMPOSED_STRUCTURE: |
| 156 | case SystemPackage.SYSTEM__EVENT_CHANNEL_COMPOSED_STRUCTURE: |
| 157 | case SystemPackage.SYSTEM__CONNECTORS_COMPOSED_STRUCTURE: |
| 158 | case SystemPackage.SYSTEM__PROVIDED_ROLES_INTERFACE_PROVIDING_ENTITY: |
| 159 | case SystemPackage.SYSTEM__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY: |
| 160 | case SystemPackage.SYSTEM__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY: |
| 161 | case SystemPackage.SYSTEM__QOS_ANNOTATIONS_SYSTEM: |
| 162 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 163 | return; |
| 164 | } |
| 165 | super.notifyChanged(notification); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 170 | * that can be created under this object. |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | @Override |
| 176 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 177 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 178 | |
| 179 | newChildDescriptors.add |
| 180 | (createChildParameter |
| 181 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__ASSEMBLY_CONTEXTS_COMPOSED_STRUCTURE, |
| 182 | CompositionFactory.eINSTANCE.createAssemblyContext())); |
| 183 | |
| 184 | newChildDescriptors.add |
| 185 | (createChildParameter |
| 186 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__RESOURCE_REQUIRED_DELEGATION_CONNECTORS_COMPOSED_STRUCTURE, |
| 187 | CompositionFactory.eINSTANCE.createResourceRequiredDelegationConnector())); |
| 188 | |
| 189 | newChildDescriptors.add |
| 190 | (createChildParameter |
| 191 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__EVENT_CHANNEL_COMPOSED_STRUCTURE, |
| 192 | CompositionFactory.eINSTANCE.createEventChannel())); |
| 193 | |
| 194 | newChildDescriptors.add |
| 195 | (createChildParameter |
| 196 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 197 | CompositionFactory.eINSTANCE.createEventChannelSourceConnector())); |
| 198 | |
| 199 | newChildDescriptors.add |
| 200 | (createChildParameter |
| 201 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 202 | CompositionFactory.eINSTANCE.createEventChannelSinkConnector())); |
| 203 | |
| 204 | newChildDescriptors.add |
| 205 | (createChildParameter |
| 206 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 207 | CompositionFactory.eINSTANCE.createProvidedDelegationConnector())); |
| 208 | |
| 209 | newChildDescriptors.add |
| 210 | (createChildParameter |
| 211 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 212 | CompositionFactory.eINSTANCE.createRequiredDelegationConnector())); |
| 213 | |
| 214 | newChildDescriptors.add |
| 215 | (createChildParameter |
| 216 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 217 | CompositionFactory.eINSTANCE.createAssemblyConnector())); |
| 218 | |
| 219 | newChildDescriptors.add |
| 220 | (createChildParameter |
| 221 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 222 | CompositionFactory.eINSTANCE.createAssemblyEventConnector())); |
| 223 | |
| 224 | newChildDescriptors.add |
| 225 | (createChildParameter |
| 226 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 227 | CompositionFactory.eINSTANCE.createSourceDelegationConnector())); |
| 228 | |
| 229 | newChildDescriptors.add |
| 230 | (createChildParameter |
| 231 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 232 | CompositionFactory.eINSTANCE.createSinkDelegationConnector())); |
| 233 | |
| 234 | newChildDescriptors.add |
| 235 | (createChildParameter |
| 236 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 237 | CompositionFactory.eINSTANCE.createAssemblyInfrastructureConnector())); |
| 238 | |
| 239 | newChildDescriptors.add |
| 240 | (createChildParameter |
| 241 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 242 | CompositionFactory.eINSTANCE.createProvidedInfrastructureDelegationConnector())); |
| 243 | |
| 244 | newChildDescriptors.add |
| 245 | (createChildParameter |
| 246 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 247 | CompositionFactory.eINSTANCE.createRequiredInfrastructureDelegationConnector())); |
| 248 | |
| 249 | newChildDescriptors.add |
| 250 | (createChildParameter |
| 251 | (CompositionPackage.Literals.COMPOSED_STRUCTURE__CONNECTORS_COMPOSED_STRUCTURE, |
| 252 | CompositionFactory.eINSTANCE.createRequiredResourceDelegationConnector())); |
| 253 | |
| 254 | newChildDescriptors.add |
| 255 | (createChildParameter |
| 256 | (EntityPackage.Literals.INTERFACE_PROVIDING_ENTITY__PROVIDED_ROLES_INTERFACE_PROVIDING_ENTITY, |
| 257 | RepositoryFactory.eINSTANCE.createSinkRole())); |
| 258 | |
| 259 | newChildDescriptors.add |
| 260 | (createChildParameter |
| 261 | (EntityPackage.Literals.INTERFACE_PROVIDING_ENTITY__PROVIDED_ROLES_INTERFACE_PROVIDING_ENTITY, |
| 262 | RepositoryFactory.eINSTANCE.createOperationProvidedRole())); |
| 263 | |
| 264 | newChildDescriptors.add |
| 265 | (createChildParameter |
| 266 | (EntityPackage.Literals.INTERFACE_PROVIDING_ENTITY__PROVIDED_ROLES_INTERFACE_PROVIDING_ENTITY, |
| 267 | RepositoryFactory.eINSTANCE.createInfrastructureProvidedRole())); |
| 268 | |
| 269 | newChildDescriptors.add |
| 270 | (createChildParameter |
| 271 | (EntityPackage.Literals.RESOURCE_INTERFACE_REQUIRING_ENTITY__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY, |
| 272 | EntityFactory.eINSTANCE.createResourceRequiredRole())); |
| 273 | |
| 274 | newChildDescriptors.add |
| 275 | (createChildParameter |
| 276 | (EntityPackage.Literals.INTERFACE_REQUIRING_ENTITY__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY, |
| 277 | RepositoryFactory.eINSTANCE.createInfrastructureRequiredRole())); |
| 278 | |
| 279 | newChildDescriptors.add |
| 280 | (createChildParameter |
| 281 | (EntityPackage.Literals.INTERFACE_REQUIRING_ENTITY__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY, |
| 282 | RepositoryFactory.eINSTANCE.createOperationRequiredRole())); |
| 283 | |
| 284 | newChildDescriptors.add |
| 285 | (createChildParameter |
| 286 | (EntityPackage.Literals.INTERFACE_REQUIRING_ENTITY__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY, |
| 287 | RepositoryFactory.eINSTANCE.createSourceRole())); |
| 288 | |
| 289 | newChildDescriptors.add |
| 290 | (createChildParameter |
| 291 | (SystemPackage.Literals.SYSTEM__QOS_ANNOTATIONS_SYSTEM, |
| 292 | QosannotationsFactory.eINSTANCE.createQoSAnnotations())); |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Return the resource locator for this item provider's resources. |
| 297 | * <!-- begin-user-doc --> |
| 298 | * <!-- end-user-doc --> |
| 299 | * @generated |
| 300 | */ |
| 301 | @Override |
| 302 | public ResourceLocator getResourceLocator() { |
| 303 | return PalladioComponentModelEditPlugin.INSTANCE; |
| 304 | } |
| 305 | |
| 306 | } |