| 1 | /* |
| 2 | *Copyright 2007, SDQ, IPD, University of Karlsruhe |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.usage.edit.helpers; |
| 5 | |
| 6 | import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; |
| 7 | import org.eclipse.gmf.runtime.common.core.command.ICommand; |
| 8 | import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; |
| 9 | import org.eclipse.gmf.runtime.emf.type.core.IElementType; |
| 10 | import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper; |
| 11 | import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice; |
| 12 | import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; |
| 13 | import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; |
| 14 | import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; |
| 15 | import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; |
| 16 | import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; |
| 17 | |
| 18 | /** |
| 19 | * @generated |
| 20 | */ |
| 21 | public class PalladioComponentModelBaseEditHelper extends AbstractEditHelper { |
| 22 | |
| 23 | /** |
| 24 | * @generated |
| 25 | */ |
| 26 | public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$ |
| 27 | |
| 28 | /** |
| 29 | * @generated |
| 30 | */ |
| 31 | public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$ |
| 32 | |
| 33 | /** |
| 34 | * @generated |
| 35 | */ |
| 36 | protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) { |
| 37 | if (req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) { |
| 38 | return ElementTypeRegistry.getInstance().getEditHelperAdvice( |
| 39 | (IElementType) req.getParameter(CONTEXT_ELEMENT_TYPE)); |
| 40 | } |
| 41 | return super.getEditHelperAdvice(req); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @generated |
| 46 | */ |
| 47 | protected ICommand getInsteadCommand(IEditCommandRequest req) { |
| 48 | ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND); |
| 49 | req.setParameter(EDIT_POLICY_COMMAND, null); |
| 50 | ICommand ehCommand = super.getInsteadCommand(req); |
| 51 | if (epCommand == null) { |
| 52 | return ehCommand; |
| 53 | } |
| 54 | if (ehCommand == null) { |
| 55 | return epCommand; |
| 56 | } |
| 57 | CompositeCommand command = new CompositeCommand(null); |
| 58 | command.add(epCommand); |
| 59 | command.add(ehCommand); |
| 60 | return command; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @generated |
| 65 | */ |
| 66 | protected ICommand getCreateCommand(CreateElementRequest req) { |
| 67 | return null; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @generated |
| 72 | */ |
| 73 | protected ICommand getCreateRelationshipCommand( |
| 74 | CreateRelationshipRequest req) { |
| 75 | return null; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @generated |
| 80 | */ |
| 81 | protected ICommand getDestroyElementCommand(DestroyElementRequest req) { |
| 82 | return null; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @generated |
| 87 | */ |
| 88 | protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) { |
| 89 | return null; |
| 90 | } |
| 91 | } |