| 1 | /* |
| 2 | *Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH) |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.composite.edit.helpers; |
| 5 | |
| 6 | import org.eclipse.gmf.runtime.common.core.command.ICommand; |
| 7 | import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; |
| 8 | import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; |
| 9 | import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; |
| 10 | |
| 11 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyConnector; |
| 12 | import de.uka.ipd.sdq.pcm.core.entity.EntityPackage; |
| 13 | |
| 14 | /** |
| 15 | * Edit helper to create the initial naming of the new Assembly Connector. |
| 16 | * @author Benjamin Klatt |
| 17 | * |
| 18 | * @generated |
| 19 | */ |
| 20 | public class AssemblyConnectorEditHelper extends |
| 21 | PalladioComponentModelBaseEditHelper { |
| 22 | |
| 23 | /** |
| 24 | * Get the configuration command for an AssemblyConnector. |
| 25 | * |
| 26 | * This is modified manually to create the assumed name for the new connector. |
| 27 | * |
| 28 | * @generated not |
| 29 | */ |
| 30 | @Override |
| 31 | protected ICommand getConfigureCommand(ConfigureRequest req) { |
| 32 | AssemblyConnector con = (AssemblyConnector) req.getElementToConfigure(); |
| 33 | String name = "Connector "; |
| 34 | name += con.getRequiringAssemblyContext_AssemblyConnector() == null ? "" |
| 35 | : con.getRequiringAssemblyContext_AssemblyConnector() |
| 36 | .getEntityName(); |
| 37 | name += " -> "; |
| 38 | name += con.getProvidingAssemblyContext_AssemblyConnector() == null ? "" |
| 39 | : con.getProvidingAssemblyContext_AssemblyConnector() |
| 40 | .getEntityName(); |
| 41 | |
| 42 | ICommand cmd2 = new SetValueCommand(new SetRequest(req |
| 43 | .getElementToConfigure(), EntityPackage.eINSTANCE |
| 44 | .getNamedElement_EntityName(), name)); |
| 45 | return cmd2; |
| 46 | } |
| 47 | |
| 48 | } |