diff options
Diffstat (limited to 'deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4CreateCommand.java')
-rw-r--r-- | deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4CreateCommand.java | 201 |
1 files changed, 0 insertions, 201 deletions
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4CreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4CreateCommand.java deleted file mode 100644 index 849ff02dcbc..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4CreateCommand.java +++ /dev/null @@ -1,201 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2007 Conselleria de Infraestructuras y Transporte, - * Generalitat de la Comunitat Valenciana . All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Gabriel Merin Cubero (Prodevelop) – Sequence Diagram implementation - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.edit.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.UMLFactory; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.ElementInitializers; - -/** - * @generated NOT - */ -public class Message4CreateCommand extends MessageTypeLinkCreateCommandCommon { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - private Interaction container; - - /** - * @generated - */ - public Message4CreateCommand(CreateRelationshipRequest request, - EObject source, EObject target) { - super(request); - this.source = source; - this.target = target; - if (request.getContainmentFeature() == null) { - setContainmentFeature(UMLPackage.eINSTANCE.getInteraction_Message()); - } - - // Find container element for the new link. - // Climb up by containment hierarchy starting from the source - // and return the first element that is instance of the container class. - for (EObject element = source; element != null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - super.setElementToEdit(container); - break; - } - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (source == null && target == null) { - return false; - } - if (source != null && !(source instanceof Element)) { - return false; - } - if (target != null && !(target instanceof Element)) { - return false; - } - if (getSource() == null) { - return true; // link creation is in progress; source is not defined - // yet - } - // target may be null here but it's possible to check constraint - if (getContainer() == null) { - return false; - } - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canCreateMessage_3004(getContainer(), getSource(), getTarget()); - } - - /** - * @generated NOT - */ - @Override - protected EObject doDefaultElementCreation() { - // org.eclipse.uml2.uml.Message newElement = - // (org.eclipse.uml2.uml.Message) super.doDefaultElementCreation(); - Message newMessage = UMLFactory.eINSTANCE.createMessage(); - getContainer().getMessages().add(newMessage); - - // newElement.setOwner(getSource()); - // newElement.getOwnedElements().add(getTarget()); - - ElementInitializers.init_Message_3004(newMessage); - - // Initialization of the message. This requires the creation of: - // 1. One CallEvent - // 2. Two MessageOccurrenceSpecifications - // 3. Initialization of all the elements (the above elements and the new - // message) - if ((source instanceof Element) && (target instanceof Element)) { - this.doDefaultMessageInitialize(container, (Element) source, - (Element) target, newMessage); - } - - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newMessage); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newMessage); - } - - return newMessage; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - return UMLPackage.eINSTANCE.getInteraction(); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in create link command"); //$NON-NLS-1$ - } - return super.doExecuteWithResult(monitor, info); - } - - /** - * @generated - */ - @Override - protected ConfigureRequest createConfigureRequest() { - ConfigureRequest request = super.createConfigureRequest(); - request.setParameter(CreateRelationshipRequest.SOURCE, getSource()); - request.setParameter(CreateRelationshipRequest.TARGET, getTarget()); - return request; - } - - /** - * @generated - */ - @Override - protected void setElementToEdit(EObject element) { - throw new UnsupportedOperationException(); - } - - /** - * @generated - */ - protected Element getSource() { - return (Element) source; - } - - /** - * @generated - */ - protected Element getTarget() { - return (Element) target; - } - - /** - * @generated - */ - public Interaction getContainer() { - return container; - } -} |