diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication')
11 files changed, 978 insertions, 1017 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment_1_2_0.java index c8848da86ff..228d30ae7c9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class CommunicationReconcilerForCompartment extends ReconcilerForCompartment { +public class CommunicationReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String InteractionCompartmentEditPart_VISUAL_ID = "7001"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler_1_1_0.java index 77336af6620..ab9706e9c7d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler_1_1_0.java @@ -1,58 +1,58 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST and others.
- *
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.communication.custom.migration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Communication Diagram Reconciler from 1.0.0 to 1.1.0
- */
-public class CommunicationReconciler extends DiagramReconciler {
-
- private static final String InteractionEditPart_VISUAL_ID = "8002";
- private static final String InteractionFloatingLabelEditPart_VISUAL_ID = "6013";
- private static final String LifelineEditPartCN_VISUAL_ID = "8001";
- private static final String LifelineFloatingLabelEditPartCN_VISUAL_ID = "6014";
-
- /**
- * Gets the reconcile command.
- *
- * @param diagram
- * the diagram
- * @return the reconcile command
- * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram)
- */
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap());
- }
-
- /**
- * Gets the floating label map to add.
- *
- * @return the floating label map
- */
- private Map<String, String> getFloatingLabelMap() {
- Map<String, String> map = new HashMap<String, String>();
- map.put(InteractionEditPart_VISUAL_ID, InteractionFloatingLabelEditPart_VISUAL_ID);
- map.put(LifelineEditPartCN_VISUAL_ID, LifelineFloatingLabelEditPartCN_VISUAL_ID);
-
- return map;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010, 2015 CEA LIST and others. + * + * 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.communication.custom.migration; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * Communication Diagram Reconciler from 1.0.0 to 1.1.0 + */ +public class CommunicationReconciler_1_1_0 extends DiagramReconciler { + + private static final String InteractionEditPart_VISUAL_ID = "8002"; + private static final String InteractionFloatingLabelEditPart_VISUAL_ID = "6013"; + private static final String LifelineEditPartCN_VISUAL_ID = "8001"; + private static final String LifelineFloatingLabelEditPartCN_VISUAL_ID = "6014"; + + /** + * Gets the reconcile command. + * + * @param diagram + * the diagram + * @return the reconcile command + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram) + */ + @Override + public ICommand getReconcileCommand(Diagram diagram) { + return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap()); + } + + /** + * Gets the floating label map to add. + * + * @return the floating label map + */ + private Map<String, String> getFloatingLabelMap() { + Map<String, String> map = new HashMap<String, String>(); + map.put(InteractionEditPart_VISUAL_ID, InteractionFloatingLabelEditPart_VISUAL_ID); + map.put(LifelineEditPartCN_VISUAL_ID, LifelineFloatingLabelEditPartCN_VISUAL_ID); + + return map; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java index fb68d4e0f9f..0590a9f3f88 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java @@ -1,132 +1,146 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * 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:
- * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.communication.custom.policies.itemsemantic;
-
-import java.util.Iterator;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessagesReorientCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorDurationObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorTimeObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.parts.MessageEditPart;
-import org.eclipse.papyrus.uml.diagram.communication.edit.policies.LifelineItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.communication.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.communication.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * this is a specialization to manage creation of Message,
- * CommentAnnotatedElement, ConstraintConstrainedElement,
- * DurationObservationEvent and TimeObservationEvent
- */
-public class CustomLifelineItemSemanticEditPolicyCN extends LifelineItemSemanticEditPolicyCN {
-
- @Override
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
-
- if (UMLElementTypes.Path_Edge == req.getElementType()) {
-
- return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- if (UMLElementTypes.Comment_AnnotatedElementEdge == req.getElementType()) {
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Constraint_ConstrainedElementEdge == req.getElementType()) {
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- if (UMLElementTypes.DurationObservation_EventEdge == req.getElementType()) {
- return getGEFWrapper(new ConnectorDurationObservationCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- if (UMLElementTypes.TimeObservation_EventEdge == req.getElementType()) {
- return getGEFWrapper(new ConnectorTimeObservationCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- return null;
- }
-
- @Override
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if (UMLElementTypes.Path_Edge == req.getElementType()) {
- return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- return null;
- }
-
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
-
- // System.err.println("getReorientRelationshipCommand VisualID of element to reorient :" + getVisualID(req));
- switch (getVisualID(req)) {
- case MessageEditPart.VISUAL_ID:
-
- // return getGEFWrapper(new CustomMessagesReorientCommand(req));
- View connector = (View) req.getParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE);
- Object elementToedit = UMLPackage.eINSTANCE.getMessage();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToedit);
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- ICommand reorientCommand = null;
- // 1. add the reorient messages command
- reorientCommand = CompositeCommand.compose(reorientCommand, new CustomMessagesReorientCommand(req));
-
- Iterator<?> it = connector.getChildren().iterator();
- while (it.hasNext()) {
- Object object = it.next();
-
- if (object instanceof View) {
- View child = (View) object;
-
- if ((child.getElement() != null) && (child.getElement() instanceof Message)) {
-
- Message messageToReorient = (Message) child.getElement();
- ReorientRequest reorientMessageRequest = new ReorientRelationshipRequest(messageToReorient, req.getNewRelationshipEnd(), req.getOldRelationshipEnd(), req.getDirection());
- reorientMessageRequest.setParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE, connector);
- ICommand reorientMessageCommand = provider.getEditCommand(reorientMessageRequest);
- reorientCommand = CompositeCommand.compose(reorientCommand, reorientMessageCommand);
- break;
- }
- }
-
- }
-
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * 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: + * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.communication.custom.policies.itemsemantic; + +import java.util.Iterator; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessageCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessagesReorientCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.CommentAnnotatedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorDurationObservationCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorTimeObservationCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.parts.MessageEditPart; +import org.eclipse.papyrus.uml.diagram.communication.edit.policies.LifelineItemSemanticEditPolicyCN; +import org.eclipse.papyrus.uml.diagram.communication.edit.policies.UMLBaseItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.diagram.communication.providers.UMLElementTypes; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * this is a specialization to manage creation of Message, + * CommentAnnotatedElement, ConstraintConstrainedElement, + * DurationObservationEvent and TimeObservationEvent + */ +public class CustomLifelineItemSemanticEditPolicyCN extends LifelineItemSemanticEditPolicyCN { + + @Override + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + + if (UMLElementTypes.Path_Edge == req.getElementType()) { + + return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget())); + } + + if (UMLElementTypes.Comment_AnnotatedElementEdge == req.getElementType()) { + return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.Constraint_ConstrainedElementEdge == req.getElementType()) { + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + + if (UMLElementTypes.DurationObservation_EventEdge == req.getElementType()) { + return getGEFWrapper(new ConnectorDurationObservationCreateCommand(req, req.getSource(), req.getTarget())); + } + + if (UMLElementTypes.TimeObservation_EventEdge == req.getElementType()) { + return getGEFWrapper(new ConnectorTimeObservationCreateCommand(req, req.getSource(), req.getTarget())); + } + + return null; + } + + @Override + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + if (UMLElementTypes.Path_Edge == req.getElementType()) { + return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget())); + } + + return null; + } + + @Override + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + + // System.err.println("getReorientRelationshipCommand VisualID of element to reorient :" + getVisualID(req)); + switch (getVisualID(req)) { + case MessageEditPart.VISUAL_ID: + + // return getGEFWrapper(new CustomMessagesReorientCommand(req)); + View connector = (View) req.getParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); + EClass elementToedit = UMLPackage.eINSTANCE.getMessage(); + + IClientContext context; + try { + context = TypeContext.getContext(getEditingDomain()); + } catch (ServiceException e) { + UMLDiagramEditorPlugin.getInstance().getLogHelper().error(e); + return UnexecutableCommand.INSTANCE; + } + + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToedit, context); + if (provider == null) { + return UnexecutableCommand.INSTANCE; + } + + ICommand reorientCommand = null; + // 1. add the reorient messages command + reorientCommand = CompositeCommand.compose(reorientCommand, new CustomMessagesReorientCommand(req)); + + Iterator<?> it = connector.getChildren().iterator(); + while (it.hasNext()) { + Object object = it.next(); + + if (object instanceof View) { + View child = (View) object; + + if ((child.getElement() != null) && (child.getElement() instanceof Message)) { + + Message messageToReorient = (Message) child.getElement(); + ReorientRequest reorientMessageRequest = new ReorientRelationshipRequest(messageToReorient, req.getNewRelationshipEnd(), req.getOldRelationshipEnd(), req.getDirection()); + reorientMessageRequest.setParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE, connector); + ICommand reorientMessageCommand = provider.getEditCommand(reorientMessageRequest); + reorientCommand = CompositeCommand.compose(reorientCommand, reorientMessageCommand); + break; + } + } + + } + + if (reorientCommand == null) { + return UnexecutableCommand.INSTANCE; + } + return getGEFWrapper(reorientCommand.reduce()); + } + return super.getReorientRelationshipCommand(req); + } + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.configuration deleted file mode 100644 index d40dee1b1e2..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.configuration +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_jRtroHDuEeWh-MssWmCB_A" implementationID="PapyrusUMLCommunicationDiagram">
- <modelRules xmi:id="_jRtroXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/>
- </modelRules>
- <owningRules xmi:id="_jRtronDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/>
- </owningRules>
- <owningRules xmi:id="_jRtro3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_jRtrpHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_jRtrpXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_jRtrpnDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_jRtrp3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- <newModelPath xmi:id="_jRtrqHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
- </newModelPath>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_jRtrqXDuEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml index 4a57beb83a4..1b800d7b8d1 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml @@ -16,14 +16,6 @@ --> <plugin> <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/communicationdiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - - <extension point="org.eclipse.ui.commands"> <command categoryId="org.eclipse.papyrus.editor.category" @@ -540,21 +532,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLCommunicationDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLCommunicationDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLCommunicationDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> @@ -578,14 +570,4 @@ path="model/communicationdiagram-notation.elementtypesconfigurations"> </elementTypeSet> </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/communicationdiagram-uml.elementtypesconfigurations"> - </elementTypeSet> - </extension> - - - </plugin> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java index 2f6ed62de1c..6520e077b93 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.communication.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.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CommentCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Comment newElement = UMLFactory.eINSTANCE.createComment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Element qualifiedTarget = (Element) target;
- qualifiedTarget.getOwnedComments()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Comment_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Comment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.uml.diagram.communication.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.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CommentCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Comment newElement = UMLFactory.eINSTANCE.createComment(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Element qualifiedTarget = (Element) target; + qualifiedTarget.getOwnedComments() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Comment_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Comment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java index 766d19c5178..b481bb9a180 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.communication.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.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Constraint_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Constraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.uml.diagram.communication.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.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ConstraintCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Constraint newElement = UMLFactory.eINSTANCE.createConstraint(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Constraint_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Constraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java index 24f6b455f56..ada8432ae64 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.communication.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.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationObservationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_DurationObservation_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.uml.diagram.communication.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.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.DurationObservation; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationObservationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_DurationObservation_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java index b22b3c41e45..a61802a6192 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java @@ -1,131 +1,131 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.communication.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.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Component;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class InteractionCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
- Component childHolder = (Component) getElementToEdit();
- childHolder.getPackagedElements()
- .add(newElement);
-
- ElementInitializers.getInstance().init_Interaction_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.uml.diagram.communication.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.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Component; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InteractionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Interaction newElement = UMLFactory.eINSTANCE.createInteraction(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + Component childHolder = (Component) getElementToEdit(); + childHolder.getPackagedElements() + .add(newElement); + + ElementInitializers.getInstance().init_Interaction_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java index b1e4b9835ec..6e359c9d63d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.communication.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.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class LifelineCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public LifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getLifelines()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Lifeline_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.uml.diagram.communication.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.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class LifelineCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public LifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Lifeline newElement = UMLFactory.eINSTANCE.createLifeline(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getLifelines() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Lifeline_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java index af9c4e68618..190a4e90dc1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.communication.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.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class TimeObservationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public TimeObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_TimeObservation_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.uml.diagram.communication.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.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.TimeObservation; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class TimeObservationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public TimeObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_TimeObservation_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} |