diff options
Diffstat (limited to 'deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus')
180 files changed, 0 insertions, 41362 deletions
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/Activator.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/Activator.java deleted file mode 100644 index aa266705618..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/Activator.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -// TODO: Auto-generated Javadoc -/** - * The activator class controls the plug-in life cycle. - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - /** The Constant PLUGIN_ID. */ - public static final String PLUGIN_ID = "org.eclipse.papyrus.diagram.sequence.papyrus"; - - // The shared instance - /** The plugin. */ - private static Activator plugin; - - /** - * The constructor. - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - /** - * {@inheritDoc} - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - /** - * {@inheritDoc} - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance. - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/CreateSequenceDiagramCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/CreateSequenceDiagramCommand.java deleted file mode 100644 index de777cc3326..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/CreateSequenceDiagramCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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: - * Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * Obeo - *******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence; - -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.papyrus.core.adaptor.gmf.AbstractPapyrusGmfCreateDiagramCommandHandler; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * Define a command to create a new Sequence Diagram. This command is used by all UI (toolbar, outline, creation wizards) to create a new Sequence Diagram. - * - * @author <a href="mailto:fjcano@prodevelop.es">Francisco Javier Cano Muñoz</a> - * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> - */ -public class CreateSequenceDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { - - /** - * {@inheritDoc} - */ - @Override - protected String getDiagramNotationID() { - return PackageEditPart.MODEL_ID; - } - - /** - * {@inheritDoc} - */ - @Override - protected PreferencesHint getPreferenceHint() { - return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT; - } - - @Override - protected String getDiagramName() { - return super.openDiagramNameDialog("SequenceDiagram"); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java deleted file mode 100644 index 9df13cb9862..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java +++ /dev/null @@ -1,144 +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.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -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.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class BehaviorExecutionSpecificationCreateCommand extends - CreateElementCommand { - - /** - * @generated - */ - private EClass eClass = null; - /** - * @generated - */ - private EObject eObject = null; - - /** - * @generated - */ - public BehaviorExecutionSpecificationCreateCommand( - CreateElementRequest req, EObject eObject) { - super(req); - this.eObject = eObject; - this.eClass = eObject != null ? eObject.eClass() : null; - } - - /** - * @generated - */ - public static BehaviorExecutionSpecificationCreateCommand create( - CreateElementRequest req, EObject eObject) { - return new BehaviorExecutionSpecificationCreateCommand(req, eObject); - } - - /** - * @generated - */ - public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req) { - super(req); - } - - /** - * @generated NOT - */ - @Override - protected EObject getElementToEdit() { - EObject container = ((CreateElementRequest) getRequest()) - .getContainer(); - if (container instanceof View) { - container = ((View) container).getElement(); - } - - // Added to contain the BehaviourExecutionSpecification inside the - // Interaction, not in the Lifeline (where it is shown) - if (container instanceof Lifeline) - return ((Lifeline) container).getInteraction(); - - return container; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - - EObject eObject = getElementToEdit(); - if (eObject != null) { - return eObject.eClass(); - } - if (eClass != null) { - return eClass; - } - return UMLPackage.eINSTANCE.getInteraction(); - } - - /** - * @generated - */ - protected Diagram getDiagramFromRequest() { - - if (getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource) != null) { - Object parameter = getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource); - if (parameter instanceof Diagram) { - return (Diagram) parameter; - } - } - return null; - } - - /** - * @generated - */ - @Override - protected EObject doDefaultElementCreation() { - BehaviorExecutionSpecification newElement = (BehaviorExecutionSpecification) super - .doDefaultElementCreation(); - if (newElement != null) { - Interaction owner = (Interaction) getElementToEdit(); - owner.getFragments().add(newElement); - - UMLElementTypes - .init_BehaviorExecutionSpecification_2003(newElement); - - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newElement); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newElement); - } - } - return newElement; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java deleted file mode 100644 index 37eb557002d..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java +++ /dev/null @@ -1,139 +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.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -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.uml2.uml.CombinedFragment; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class CombinedFragmentCreateCommand extends CreateElementCommand { - - /** - * @generated - */ - private EClass eClass = null; - /** - * @generated - */ - private EObject eObject = null; - - /** - * @generated - */ - public CombinedFragmentCreateCommand(CreateElementRequest req, - EObject eObject) { - super(req); - this.eObject = eObject; - this.eClass = eObject != null ? eObject.eClass() : null; - } - - /** - * @generated - */ - public static CombinedFragmentCreateCommand create( - CreateElementRequest req, EObject eObject) { - return new CombinedFragmentCreateCommand(req, eObject); - } - - /** - * @generated - */ - public CombinedFragmentCreateCommand(CreateElementRequest req) { - super(req); - } - - /** - * @generated - */ - @Override - protected EObject getElementToEdit() { - - EObject container = ((CreateElementRequest) getRequest()) - .getContainer(); - if (container instanceof View) { - container = ((View) container).getElement(); - } - if (container != null) { - return container; - } - return eObject; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - - EObject eObject = getElementToEdit(); - if (eObject != null) { - return eObject.eClass(); - } - if (eClass != null) { - return eClass; - } - return UMLPackage.eINSTANCE.getInteraction(); - } - - /** - * @generated - */ - protected Diagram getDiagramFromRequest() { - - if (getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource) != null) { - Object parameter = getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource); - if (parameter instanceof Diagram) { - return (Diagram) parameter; - } - } - return null; - } - - /** - * @generated - */ - @Override - protected EObject doDefaultElementCreation() { - CombinedFragment newElement = (CombinedFragment) super - .doDefaultElementCreation(); - if (newElement != null) { - Interaction owner = (Interaction) getElementToEdit(); - owner.getFragments().add(newElement); - - UMLElementTypes.init_CombinedFragment_2004(newElement); - - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newElement); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newElement); - } - } - return newElement; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentAnnotatedElementCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentAnnotatedElementCreateCommand.java deleted file mode 100644 index c9a9223b8cc..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentAnnotatedElementCreateCommand.java +++ /dev/null @@ -1,103 +0,0 @@ -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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Model; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; - -/** - * @generated - */ -public class CommentAnnotatedElementCreateCommand extends EditElementCommand { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - public CommentAnnotatedElementCreateCommand( - CreateRelationshipRequest request, EObject source, EObject target) { - super(request.getLabel(), null, request); - this.source = source; - this.target = target; - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (source == null && target == null) { - return false; - } - if (source != null && false == source instanceof Comment) { - return false; - } - if (target != null && false == 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 - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canCreateCommentAnnotatedElement_3008(getSource(), getTarget()); - } - - /** - * @generated not - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in create link command"); //$NON-NLS-1$ - } - if (getSource() != null && getTarget() != null) { - getSource().getAnnotatedElements().add(getTarget()); - - // check the parent of the comment. If has not elements in - // annotatedElement relation, the parent will be this Element; if - // has more than one element, the parent will be the model - if (getSource().getAnnotatedElements().size() == 1) { - getTarget().getOwnedComments().add(getSource()); - } else if (getSource().getAnnotatedElements().size() > 1) { - Model root = (Model) getTarget().eResource().getContents().get( - 0); - root.getOwnedComments().add(getSource()); - } - } - return CommandResult.newOKCommandResult(); - } - - /** - * @generated - */ - protected Comment getSource() { - return (Comment) source; - } - - /** - * @generated - */ - protected Element getTarget() { - return (Element) target; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentAnnotatedElementReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentAnnotatedElementReorientCommand.java deleted file mode 100644 index d1916c57120..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentAnnotatedElementReorientCommand.java +++ /dev/null @@ -1,191 +0,0 @@ -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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Model; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; - -/** - * @generated - */ -public class CommentAnnotatedElementReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject referenceOwner; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - public CommentAnnotatedElementReorientCommand( - ReorientReferenceRelationshipRequest request) { - super(request.getLabel(), null, request); - reorientDirection = request.getDirection(); - referenceOwner = request.getReferenceOwner(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == referenceOwner instanceof Comment) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Comment)) { - return false; - } - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistCommentAnnotatedElement_3008(getNewSource(), - getOldTarget()); - } - - /** - * @generated - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistCommentAnnotatedElement_3008(getOldSource(), - getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated not - */ - protected CommandResult reorientSource() throws ExecutionException { - getOldSource().getAnnotatedElements().remove(getOldTarget()); - getNewSource().getAnnotatedElements().add(getOldTarget()); - - // modify the parent of the old Comment? - // if now it has only one annotated Element - if (getOldSource().getAnnotatedElements().size() == 1) { - getOldSource().getAnnotatedElements().get(0).getOwnedComments() - .add(getOldSource()); - } - // if now it has no annotated Elements - if (getOldSource().getAnnotatedElements().size() == 0) { - ((Model) getOldSource().eResource().getContents().get(0)) - .getOwnedComments().add(getOldSource()); - } - - // modify the parent of the new Comment? - // if now it has only one annotated Element - if (getNewSource().getAnnotatedElements().size() == 1) { - getNewSource().getAnnotatedElements().get(0).getOwnedComments() - .add(getNewSource()); - } - // if now it has more than one annotated Element - if (getNewSource().getAnnotatedElements().size() > 1) { - ((Model) getNewSource().eResource().getContents().get(0)) - .getOwnedComments().add(getNewSource()); - } - - return CommandResult.newOKCommandResult(referenceOwner); - } - - /** - * @generated not - */ - protected CommandResult reorientTarget() throws ExecutionException { - getOldSource().getAnnotatedElements().remove(getOldTarget()); - getOldSource().getAnnotatedElements().add(getNewTarget()); - - // if the number of annotatedElements of the Comment is 1, change the - // container of the Comment - if (getOldSource().getAnnotatedElements().size() == 1) { - getNewTarget().getOwnedComments().add(getOldSource()); - } - - return CommandResult.newOKCommandResult(referenceOwner); - } - - /** - * @generated - */ - protected Comment getOldSource() { - return (Comment) referenceOwner; - } - - /** - * @generated - */ - protected Comment getNewSource() { - return (Comment) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentCreateCommand.java deleted file mode 100644 index 910d6e685c9..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/CommentCreateCommand.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.commands; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -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.uml2.uml.Comment; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class CommentCreateCommand extends CreateElementCommand { - - /** - * @generated - */ - private EClass eClass = null; - /** - * @generated - */ - private EObject eObject = null; - - /** - * @generated - */ - public CommentCreateCommand(CreateElementRequest req, EObject eObject) { - super(req); - this.eObject = eObject; - this.eClass = eObject != null ? eObject.eClass() : null; - } - - /** - * @generated - */ - public static CommentCreateCommand create(CreateElementRequest req, - EObject eObject) { - return new CommentCreateCommand(req, eObject); - } - - /** - * @generated - */ - public CommentCreateCommand(CreateElementRequest req) { - super(req); - } - - /** - * @generated - */ - @Override - protected EObject getElementToEdit() { - - EObject container = ((CreateElementRequest) getRequest()) - .getContainer(); - if (container instanceof View) { - container = ((View) container).getElement(); - } - if (container != null) { - return container; - } - return eObject; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - - EObject eObject = getElementToEdit(); - if (eObject != null) { - return eObject.eClass(); - } - if (eClass != null) { - return eClass; - } - return UMLPackage.eINSTANCE.getElement(); - } - - /** - * @generated - */ - protected Diagram getDiagramFromRequest() { - - if (getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource) != null) { - Object parameter = getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource); - if (parameter instanceof Diagram) { - return (Diagram) parameter; - } - } - return null; - } - - /** - * @generated NOT - */ - @Override - protected EObject doDefaultElementCreation() { - Comment newElement = (Comment) super.doDefaultElementCreation(); - if (newElement != null) { - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newElement); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newElement); - } - } - return newElement; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/ElementOwnedCommentCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/ElementOwnedCommentCreateCommand.java deleted file mode 100644 index 9d7273d1795..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/ElementOwnedCommentCreateCommand.java +++ /dev/null @@ -1,104 +0,0 @@ -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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Model; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; - -/** - * @generated - */ -public class ElementOwnedCommentCreateCommand extends EditElementCommand { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - public ElementOwnedCommentCreateCommand(CreateRelationshipRequest request, - EObject source, EObject target) { - super(request.getLabel(), null, request); - this.source = source; - this.target = target; - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (source == null && target == null) { - return false; - } - if (source != null && false == source instanceof Element) { - return false; - } - if (target != null && false == target instanceof Comment) { - 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 - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canCreateElementOwnedComment_3007(getSource(), getTarget()); - } - - /** - * @generated not - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in create link command"); //$NON-NLS-1$ - } - if (getSource() != null && getTarget() != null) { - getSource().getOwnedComments().add(getTarget()); - - // add the Element to the annotatedElement relation of the Comment - getTarget().getAnnotatedElements().add(getSource()); - - // check the parent of the comment. If has not elements in - // annotatedElement relation, the parent will be this Element; if - // has more than one element, the parent will be the model - if (getTarget().getAnnotatedElements().size() > 1) { - Model root = (Model) getSource().eResource().getContents().get( - 0); - root.getOwnedComments().add(getTarget()); - } - } - return CommandResult.newOKCommandResult(); - } - - /** - * @generated - */ - protected Element getSource() { - return (Element) source; - } - - /** - * @generated - */ - protected Comment getTarget() { - return (Comment) target; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/ElementOwnedCommentReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/ElementOwnedCommentReorientCommand.java deleted file mode 100644 index d5ead9836d5..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/ElementOwnedCommentReorientCommand.java +++ /dev/null @@ -1,158 +0,0 @@ -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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; - -/** - * @generated - */ -public class ElementOwnedCommentReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject referenceOwner; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - public ElementOwnedCommentReorientCommand( - ReorientReferenceRelationshipRequest request) { - super(request.getLabel(), null, request); - reorientDirection = request.getDirection(); - referenceOwner = request.getReferenceOwner(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == referenceOwner instanceof Element) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Comment && newEnd instanceof Element)) { - return false; - } - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistElementOwnedComment_3007(getNewSource(), - getOldTarget()); - } - - /** - * @generated - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Comment && newEnd instanceof Comment)) { - return false; - } - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistElementOwnedComment_3007(getOldSource(), - getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated - */ - protected CommandResult reorientSource() throws ExecutionException { - getOldSource().getOwnedComments().remove(getOldTarget()); - getNewSource().getOwnedComments().add(getOldTarget()); - return CommandResult.newOKCommandResult(referenceOwner); - } - - /** - * @generated - */ - protected CommandResult reorientTarget() throws ExecutionException { - getOldSource().getOwnedComments().remove(getOldTarget()); - getOldSource().getOwnedComments().add(getNewTarget()); - return CommandResult.newOKCommandResult(referenceOwner); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) referenceOwner; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Comment getOldTarget() { - return (Comment) oldEnd; - } - - /** - * @generated - */ - protected Comment getNewTarget() { - return (Comment) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Interaction2CreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Interaction2CreateCommand.java deleted file mode 100644 index 4ac629de2a6..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Interaction2CreateCommand.java +++ /dev/null @@ -1,136 +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.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -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.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class Interaction2CreateCommand extends CreateElementCommand { - - /** - * @generated - */ - private EClass eClass = null; - /** - * @generated - */ - private EObject eObject = null; - - /** - * @generated - */ - public Interaction2CreateCommand(CreateElementRequest req, EObject eObject) { - super(req); - this.eObject = eObject; - this.eClass = eObject != null ? eObject.eClass() : null; - } - - /** - * @generated - */ - public static Interaction2CreateCommand create(CreateElementRequest req, - EObject eObject) { - return new Interaction2CreateCommand(req, eObject); - } - - /** - * @generated - */ - public Interaction2CreateCommand(CreateElementRequest req) { - super(req); - } - - /** - * @generated - */ - @Override - protected EObject getElementToEdit() { - - EObject container = ((CreateElementRequest) getRequest()) - .getContainer(); - if (container instanceof View) { - container = ((View) container).getElement(); - } - if (container != null) { - return container; - } - return eObject; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - - EObject eObject = getElementToEdit(); - if (eObject != null) { - return eObject.eClass(); - } - if (eClass != null) { - return eClass; - } - return UMLPackage.eINSTANCE.getInteraction(); - } - - /** - * @generated - */ - protected Diagram getDiagramFromRequest() { - - if (getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource) != null) { - Object parameter = getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource); - if (parameter instanceof Diagram) { - return (Diagram) parameter; - } - } - return null; - } - - /** - * @generated - */ - @Override - protected EObject doDefaultElementCreation() { - Interaction newElement = (Interaction) super.doDefaultElementCreation(); - if (newElement != null) { - Interaction owner = (Interaction) getElementToEdit(); - owner.getFragments().add(newElement); - - UMLElementTypes.init_Interaction_2001(newElement); - - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newElement); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newElement); - } - } - return newElement; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/InteractionCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/InteractionCreateCommand.java deleted file mode 100644 index 743225546d7..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/InteractionCreateCommand.java +++ /dev/null @@ -1,137 +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.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -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.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class InteractionCreateCommand extends CreateElementCommand { - - /** - * @generated - */ - private EClass eClass = null; - /** - * @generated - */ - private EObject eObject = null; - - /** - * @generated - */ - public InteractionCreateCommand(CreateElementRequest req, EObject eObject) { - super(req); - this.eObject = eObject; - this.eClass = eObject != null ? eObject.eClass() : null; - } - - /** - * @generated - */ - public static InteractionCreateCommand create(CreateElementRequest req, - EObject eObject) { - return new InteractionCreateCommand(req, eObject); - } - - /** - * @generated - */ - public InteractionCreateCommand(CreateElementRequest req) { - super(req); - } - - /** - * @generated - */ - @Override - protected EObject getElementToEdit() { - - EObject container = ((CreateElementRequest) getRequest()) - .getContainer(); - if (container instanceof View) { - container = ((View) container).getElement(); - } - if (container != null) { - return container; - } - return eObject; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - - EObject eObject = getElementToEdit(); - if (eObject != null) { - return eObject.eClass(); - } - if (eClass != null) { - return eClass; - } - return UMLPackage.eINSTANCE.getPackage(); - } - - /** - * @generated - */ - protected Diagram getDiagramFromRequest() { - - if (getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource) != null) { - Object parameter = getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource); - if (parameter instanceof Diagram) { - return (Diagram) parameter; - } - } - return null; - } - - /** - * @generated - */ - @Override - protected EObject doDefaultElementCreation() { - Interaction newElement = (Interaction) super.doDefaultElementCreation(); - if (newElement != null) { - Package owner = (Package) getElementToEdit(); - owner.getPackagedElements().add(newElement); - - UMLElementTypes.init_Interaction_1001(newElement); - - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newElement); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newElement); - } - } - return newElement; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/LifelineCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/LifelineCreateCommand.java deleted file mode 100644 index 0ff34ee2271..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/LifelineCreateCommand.java +++ /dev/null @@ -1,137 +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.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -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.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class LifelineCreateCommand extends CreateElementCommand { - - /** - * @generated - */ - private EClass eClass = null; - /** - * @generated - */ - private EObject eObject = null; - - /** - * @generated - */ - public LifelineCreateCommand(CreateElementRequest req, EObject eObject) { - super(req); - this.eObject = eObject; - this.eClass = eObject != null ? eObject.eClass() : null; - } - - /** - * @generated - */ - public static LifelineCreateCommand create(CreateElementRequest req, - EObject eObject) { - return new LifelineCreateCommand(req, eObject); - } - - /** - * @generated - */ - public LifelineCreateCommand(CreateElementRequest req) { - super(req); - } - - /** - * @generated - */ - @Override - protected EObject getElementToEdit() { - - EObject container = ((CreateElementRequest) getRequest()) - .getContainer(); - if (container instanceof View) { - container = ((View) container).getElement(); - } - if (container != null) { - return container; - } - return eObject; - } - - /** - * @generated - */ - @Override - protected EClass getEClassToEdit() { - - EObject eObject = getElementToEdit(); - if (eObject != null) { - return eObject.eClass(); - } - if (eClass != null) { - return eClass; - } - return UMLPackage.eINSTANCE.getInteraction(); - } - - /** - * @generated - */ - protected Diagram getDiagramFromRequest() { - - if (getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource) != null) { - Object parameter = getRequest().getParameters().get( - MultiDiagramUtil.BelongToDiagramSource); - if (parameter instanceof Diagram) { - return (Diagram) parameter; - } - } - return null; - } - - /** - * @generated - */ - @Override - protected EObject doDefaultElementCreation() { - Lifeline newElement = (Lifeline) super.doDefaultElementCreation(); - if (newElement != null) { - Interaction owner = (Interaction) getElementToEdit(); - owner.getLifelines().add(newElement); - - UMLElementTypes.init_Lifeline_2002(newElement); - - Diagram diagram = getDiagramFromRequest(); - if (diagram != null) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - newElement); - } else { - MultiDiagramUtil.addEAnnotationReferenceToDiagram( - UMLDiagramEditorPlugin.getInstance(), newElement); - } - } - return newElement; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message2CreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message2CreateCommand.java deleted file mode 100644 index af07cb05736..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message2CreateCommand.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 Message2CreateCommand extends MessageTypeLinkCreateCommandCommon { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - private Interaction container; - - /** - * @generated - */ - public Message2CreateCommand(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_3002(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_3002(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; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message2ReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message2ReorientCommand.java deleted file mode 100644 index ffbcb3a94c5..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message2ReorientCommand.java +++ /dev/null @@ -1,262 +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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class Message2ReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - private View node; - - /** - * @generated - */ - private View link; - - /** - * @generated - */ - public Message2ReorientCommand(ReorientRelationshipRequest request) { - super(request.getLabel(), request.getRelationship(), request); - reorientDirection = request.getDirection(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - - if (request.getParameter(ReorientLinkIDs.nodeEditPart) != null) { - node = (View) request.getParameter(ReorientLinkIDs.nodeEditPart); - } - if (request.getParameter(ReorientLinkIDs.linkEditPart) != null) { - link = (View) request.getParameter(ReorientLinkIDs.linkEditPart); - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == getElementToEdit() instanceof Message) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated NOT - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // if (getLink().getOwnedElements().size() != 1) { - // return false; - // } - // Element target = (Element) getLink().getOwnedElements().get(0); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - // Get target element - Element target = MessageCommonUtil.getMessageDst(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3002(container, getNewSource(), target); - } - - /** - * @generated NOT - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // Element source = getLink().getOwner(); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getSendEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - // Get source element - Element source = MessageCommonUtil.getMessageSrc(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3002(container, source, getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated NOT - */ - protected CommandResult reorientSource() throws ExecutionException { - // getLink().setOwner(getNewSource()); - - // Added code - if (getLink().getSendEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - mosSource.getCovereds().clear(); - - if (getNewSource() instanceof Lifeline) { - mosSource.getCovereds().add((Lifeline) getNewSource()); - } else if (getNewSource() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosSource.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated NOT - */ - protected CommandResult reorientTarget() throws ExecutionException { - // getLink().getOwnedElements().remove(getOldTarget()); - // getLink().getOwnedElements().add(getNewTarget()); - - // Added code - if (getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - mosTarget.getCovereds().clear(); - - if (getNewTarget() instanceof Lifeline) { - mosTarget.getCovereds().add((Lifeline) getNewTarget()); - } else if (getNewTarget() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosTarget.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated - */ - protected Message getLink() { - return (Message) getElementToEdit(); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message3CreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message3CreateCommand.java deleted file mode 100644 index fe2fa751768..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message3CreateCommand.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 Message3CreateCommand extends MessageTypeLinkCreateCommandCommon { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - private Interaction container; - - /** - * @generated - */ - public Message3CreateCommand(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_3003(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_3003(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; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message3ReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message3ReorientCommand.java deleted file mode 100644 index 13b5d27b37f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message3ReorientCommand.java +++ /dev/null @@ -1,262 +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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class Message3ReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - private View node; - - /** - * @generated - */ - private View link; - - /** - * @generated - */ - public Message3ReorientCommand(ReorientRelationshipRequest request) { - super(request.getLabel(), request.getRelationship(), request); - reorientDirection = request.getDirection(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - - if (request.getParameter(ReorientLinkIDs.nodeEditPart) != null) { - node = (View) request.getParameter(ReorientLinkIDs.nodeEditPart); - } - if (request.getParameter(ReorientLinkIDs.linkEditPart) != null) { - link = (View) request.getParameter(ReorientLinkIDs.linkEditPart); - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == getElementToEdit() instanceof Message) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated NOT - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // if (getLink().getOwnedElements().size() != 1) { - // return false; - // } - // Element target = (Element) getLink().getOwnedElements().get(0); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - // Get target element - Element target = MessageCommonUtil.getMessageDst(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3003(container, getNewSource(), target); - } - - /** - * @generated NOT - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // Element source = getLink().getOwner(); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getSendEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - // Get source element - Element source = MessageCommonUtil.getMessageSrc(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3003(container, source, getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated NOT - */ - protected CommandResult reorientSource() throws ExecutionException { - // getLink().setOwner(getNewSource()); - - // Added code - if (getLink().getSendEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - mosSource.getCovereds().clear(); - - if (getNewSource() instanceof Lifeline) { - mosSource.getCovereds().add((Lifeline) getNewSource()); - } else if (getNewSource() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosSource.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated NOT - */ - protected CommandResult reorientTarget() throws ExecutionException { - // getLink().getOwnedElements().remove(getOldTarget()); - // getLink().getOwnedElements().add(getNewTarget()); - - // Added code - if (getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - mosTarget.getCovereds().clear(); - - if (getNewTarget() instanceof Lifeline) { - mosTarget.getCovereds().add((Lifeline) getNewTarget()); - } else if (getNewTarget() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosTarget.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated - */ - protected Message getLink() { - return (Message) getElementToEdit(); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} 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; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4ReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4ReorientCommand.java deleted file mode 100644 index a6370804217..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message4ReorientCommand.java +++ /dev/null @@ -1,262 +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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class Message4ReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - private View node; - - /** - * @generated - */ - private View link; - - /** - * @generated - */ - public Message4ReorientCommand(ReorientRelationshipRequest request) { - super(request.getLabel(), request.getRelationship(), request); - reorientDirection = request.getDirection(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - - if (request.getParameter(ReorientLinkIDs.nodeEditPart) != null) { - node = (View) request.getParameter(ReorientLinkIDs.nodeEditPart); - } - if (request.getParameter(ReorientLinkIDs.linkEditPart) != null) { - link = (View) request.getParameter(ReorientLinkIDs.linkEditPart); - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == getElementToEdit() instanceof Message) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated NOT - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // if (getLink().getOwnedElements().size() != 1) { - // return false; - // } - // Element target = (Element) getLink().getOwnedElements().get(0); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - // Get target element - Element target = MessageCommonUtil.getMessageDst(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3004(container, getNewSource(), target); - } - - /** - * @generated NOT - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // Element source = getLink().getOwner(); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getSendEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - // Get source element - Element source = MessageCommonUtil.getMessageSrc(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3004(container, source, getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated NOT - */ - protected CommandResult reorientSource() throws ExecutionException { - // getLink().setOwner(getNewSource()); - - // Added code - if (getLink().getSendEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - mosSource.getCovereds().clear(); - - if (getNewSource() instanceof Lifeline) { - mosSource.getCovereds().add((Lifeline) getNewSource()); - } else if (getNewSource() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosSource.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated NOT - */ - protected CommandResult reorientTarget() throws ExecutionException { - // getLink().getOwnedElements().remove(getOldTarget()); - // getLink().getOwnedElements().add(getNewTarget()); - - // Added code - if (getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - mosTarget.getCovereds().clear(); - - if (getNewTarget() instanceof Lifeline) { - mosTarget.getCovereds().add((Lifeline) getNewTarget()); - } else if (getNewTarget() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosTarget.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated - */ - protected Message getLink() { - return (Message) getElementToEdit(); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message5CreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message5CreateCommand.java deleted file mode 100644 index 5550d32cfe2..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message5CreateCommand.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 Message5CreateCommand extends MessageTypeLinkCreateCommandCommon { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - private Interaction container; - - /** - * @generated - */ - public Message5CreateCommand(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_3005(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_3005(newMessage); - - // Initialization of the message. This requires the creation of: - // 1. One CreationEvent - // 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; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message5ReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message5ReorientCommand.java deleted file mode 100644 index 0747d39a650..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message5ReorientCommand.java +++ /dev/null @@ -1,262 +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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class Message5ReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - private View node; - - /** - * @generated - */ - private View link; - - /** - * @generated - */ - public Message5ReorientCommand(ReorientRelationshipRequest request) { - super(request.getLabel(), request.getRelationship(), request); - reorientDirection = request.getDirection(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - - if (request.getParameter(ReorientLinkIDs.nodeEditPart) != null) { - node = (View) request.getParameter(ReorientLinkIDs.nodeEditPart); - } - if (request.getParameter(ReorientLinkIDs.linkEditPart) != null) { - link = (View) request.getParameter(ReorientLinkIDs.linkEditPart); - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == getElementToEdit() instanceof Message) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated NOT - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // if (getLink().getOwnedElements().size() != 1) { - // return false; - // } - // Element target = (Element) getLink().getOwnedElements().get(0); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - // Get target element - Element target = MessageCommonUtil.getMessageDst(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3005(container, getNewSource(), target); - } - - /** - * @generated NOT - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // Element source = getLink().getOwner(); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getSendEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - // Get source element - Element source = MessageCommonUtil.getMessageSrc(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3005(container, source, getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated NOT - */ - protected CommandResult reorientSource() throws ExecutionException { - // getLink().setOwner(getNewSource()); - - // Added code - if (getLink().getSendEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - mosSource.getCovereds().clear(); - - if (getNewSource() instanceof Lifeline) { - mosSource.getCovereds().add((Lifeline) getNewSource()); - } else if (getNewSource() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosSource.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated NOT - */ - protected CommandResult reorientTarget() throws ExecutionException { - // getLink().getOwnedElements().remove(getOldTarget()); - // getLink().getOwnedElements().add(getNewTarget()); - - // Added code - if (getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - mosTarget.getCovereds().clear(); - - if (getNewTarget() instanceof Lifeline) { - mosTarget.getCovereds().add((Lifeline) getNewTarget()); - } else if (getNewTarget() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosTarget.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated - */ - protected Message getLink() { - return (Message) getElementToEdit(); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message6CreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message6CreateCommand.java deleted file mode 100644 index ffe239ed049..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message6CreateCommand.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 Message6CreateCommand extends MessageTypeLinkCreateCommandCommon { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - private Interaction container; - - /** - * @generated - */ - public Message6CreateCommand(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_3006(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_3006(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; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message6ReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message6ReorientCommand.java deleted file mode 100644 index b98bd353be0..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/Message6ReorientCommand.java +++ /dev/null @@ -1,262 +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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class Message6ReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - private View node; - - /** - * @generated - */ - private View link; - - /** - * @generated - */ - public Message6ReorientCommand(ReorientRelationshipRequest request) { - super(request.getLabel(), request.getRelationship(), request); - reorientDirection = request.getDirection(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - - if (request.getParameter(ReorientLinkIDs.nodeEditPart) != null) { - node = (View) request.getParameter(ReorientLinkIDs.nodeEditPart); - } - if (request.getParameter(ReorientLinkIDs.linkEditPart) != null) { - link = (View) request.getParameter(ReorientLinkIDs.linkEditPart); - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == getElementToEdit() instanceof Message) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated NOT - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // if (getLink().getOwnedElements().size() != 1) { - // return false; - // } - // Element target = (Element) getLink().getOwnedElements().get(0); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - // Get target element - Element target = MessageCommonUtil.getMessageDst(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3006(container, getNewSource(), target); - } - - /** - * @generated NOT - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // Element source = getLink().getOwner(); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getSendEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - // Get source element - Element source = MessageCommonUtil.getMessageSrc(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3006(container, source, getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated NOT - */ - protected CommandResult reorientSource() throws ExecutionException { - // getLink().setOwner(getNewSource()); - - // Added code - if (getLink().getSendEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - mosSource.getCovereds().clear(); - - if (getNewSource() instanceof Lifeline) { - mosSource.getCovereds().add((Lifeline) getNewSource()); - } else if (getNewSource() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosSource.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated NOT - */ - protected CommandResult reorientTarget() throws ExecutionException { - // getLink().getOwnedElements().remove(getOldTarget()); - // getLink().getOwnedElements().add(getNewTarget()); - - // Added code - if (getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - mosTarget.getCovereds().clear(); - - if (getNewTarget() instanceof Lifeline) { - mosTarget.getCovereds().add((Lifeline) getNewTarget()); - } else if (getNewTarget() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosTarget.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated - */ - protected Message getLink() { - return (Message) getElementToEdit(); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/MessageCreateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/MessageCreateCommand.java deleted file mode 100644 index f07a29c56aa..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/MessageCreateCommand.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 MessageCreateCommand extends MessageTypeLinkCreateCommandCommon { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - private Interaction container; - - /** - * @generated - */ - public MessageCreateCommand(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_3001(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_3001(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; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/MessageReorientCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/MessageReorientCommand.java deleted file mode 100644 index fd39e73819c..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/MessageReorientCommand.java +++ /dev/null @@ -1,262 +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.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLBaseItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class MessageReorientCommand extends EditElementCommand { - - /** - * @generated - */ - private final int reorientDirection; - - /** - * @generated - */ - private final EObject oldEnd; - - /** - * @generated - */ - private final EObject newEnd; - - /** - * @generated - */ - private View node; - - /** - * @generated - */ - private View link; - - /** - * @generated - */ - public MessageReorientCommand(ReorientRelationshipRequest request) { - super(request.getLabel(), request.getRelationship(), request); - reorientDirection = request.getDirection(); - oldEnd = request.getOldRelationshipEnd(); - newEnd = request.getNewRelationshipEnd(); - - if (request.getParameter(ReorientLinkIDs.nodeEditPart) != null) { - node = (View) request.getParameter(ReorientLinkIDs.nodeEditPart); - } - if (request.getParameter(ReorientLinkIDs.linkEditPart) != null) { - link = (View) request.getParameter(ReorientLinkIDs.linkEditPart); - } - } - - /** - * @generated - */ - @Override - public boolean canExecute() { - if (false == getElementToEdit() instanceof Message) { - return false; - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - /** - * @generated NOT - */ - protected boolean canReorientSource() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // if (getLink().getOwnedElements().size() != 1) { - // return false; - // } - // Element target = (Element) getLink().getOwnedElements().get(0); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - // Get target element - Element target = MessageCommonUtil.getMessageDst(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3001(container, getNewSource(), target); - } - - /** - * @generated NOT - */ - protected boolean canReorientTarget() { - if (!(oldEnd instanceof Element && newEnd instanceof Element)) { - return false; - } - // Element source = getLink().getOwner(); - if (!(getLink().eContainer() instanceof Interaction)) { - return false; - } - - // Added code - if (!(getLink().getSendEvent() instanceof MessageOccurrenceSpecification)) { - return false; - } - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - // Get source element - Element source = MessageCommonUtil.getMessageSrc(getLink()); - - // End added code - - Interaction container = (Interaction) getLink().eContainer(); - return UMLBaseItemSemanticEditPolicy.LinkConstraints - .canExistMessage_3001(container, source, getNewTarget()); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - if (!canExecute()) { - throw new ExecutionException( - "Invalid arguments in reorient link command"); //$NON-NLS-1$ - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - /** - * @generated NOT - */ - protected CommandResult reorientSource() throws ExecutionException { - // getLink().setOwner(getNewSource()); - - // Added code - if (getLink().getSendEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosSource = (MessageOccurrenceSpecification) getLink() - .getSendEvent(); - - mosSource.getCovereds().clear(); - - if (getNewSource() instanceof Lifeline) { - mosSource.getCovereds().add((Lifeline) getNewSource()); - } else if (getNewSource() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosSource.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated NOT - */ - protected CommandResult reorientTarget() throws ExecutionException { - // getLink().getOwnedElements().remove(getOldTarget()); - // getLink().getOwnedElements().add(getNewTarget()); - - // Added code - if (getLink().getReceiveEvent() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification mosTarget = (MessageOccurrenceSpecification) getLink() - .getReceiveEvent(); - - mosTarget.getCovereds().clear(); - - if (getNewTarget() instanceof Lifeline) { - mosTarget.getCovereds().add((Lifeline) getNewTarget()); - } else if (getNewTarget() instanceof BehaviorExecutionSpecification) { - BehaviorExecutionSpecification bes = (BehaviorExecutionSpecification) getNewSource(); - mosTarget.getCovereds().add(bes.getCovereds().get(0)); - } - } - // End added code - - return CommandResult.newOKCommandResult(getLink()); - } - - /** - * @generated - */ - protected Message getLink() { - return (Message) getElementToEdit(); - } - - /** - * @generated - */ - protected Element getOldSource() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewSource() { - return (Element) newEnd; - } - - /** - * @generated - */ - protected Element getOldTarget() { - return (Element) oldEnd; - } - - /** - * @generated - */ - protected Element getNewTarget() { - return (Element) newEnd; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/UMLCreateShortcutDecorationsCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/UMLCreateShortcutDecorationsCommand.java deleted file mode 100644 index 4f316340fe0..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/UMLCreateShortcutDecorationsCommand.java +++ /dev/null @@ -1,82 +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 java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ -public class UMLCreateShortcutDecorationsCommand extends - AbstractTransactionalCommand { - - /** - * @generated - */ - private List myDescriptors; - - /** - * @generated - */ - public UMLCreateShortcutDecorationsCommand( - TransactionalEditingDomain editingDomain, View parentView, - List viewDescriptors) { - super(editingDomain, "Create Shortcuts", getWorkspaceFiles(parentView)); //$NON-NLS-1$ - myDescriptors = viewDescriptors; - } - - /** - * @generated - */ - public UMLCreateShortcutDecorationsCommand( - TransactionalEditingDomain editingDomain, View parentView, - CreateViewRequest.ViewDescriptor viewDescriptor) { - this(editingDomain, parentView, Collections - .singletonList(viewDescriptor)); - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, - IAdaptable info) throws ExecutionException { - for (Iterator it = myDescriptors.iterator(); it.hasNext();) { - CreateViewRequest.ViewDescriptor nextDescriptor = (CreateViewRequest.ViewDescriptor) it - .next(); - View view = (View) nextDescriptor.getAdapter(View.class); - if (view != null && view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$ - EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE - .createEAnnotation(); - shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ - shortcutAnnotation.getDetails().put( - "modelID", PackageEditPart.MODEL_ID); //$NON-NLS-1$ - view.getEAnnotations().add(shortcutAnnotation); - } - } - return CommandResult.newOKCommandResult(); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/UMLReorientConnectionViewCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/UMLReorientConnectionViewCommand.java deleted file mode 100644 index d3e9b577721..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/commands/UMLReorientConnectionViewCommand.java +++ /dev/null @@ -1,82 +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 java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class UMLReorientConnectionViewCommand extends - AbstractTransactionalCommand { - - /** - * @generated - */ - private IAdaptable edgeAdaptor; - - /** - * @generated - */ - public UMLReorientConnectionViewCommand( - TransactionalEditingDomain editingDomain, String label) { - super(editingDomain, label, null); - } - - /** - * @generated - */ - @Override - public List getAffectedFiles() { - View view = (View) edgeAdaptor.getAdapter(View.class); - if (view != null) { - return getWorkspaceFiles(view); - } - return super.getAffectedFiles(); - } - - /** - * @generated - */ - public IAdaptable getEdgeAdaptor() { - return edgeAdaptor; - } - - /** - * @generated - */ - public void setEdgeAdaptor(IAdaptable edgeAdaptor) { - this.edgeAdaptor = edgeAdaptor; - } - - /** - * @generated - */ - @Override - protected CommandResult doExecuteWithResult( - IProgressMonitor progressMonitor, IAdaptable info) { - assert null != edgeAdaptor : "Null child in UMLReorientConnectionViewCommand"; //$NON-NLS-1$ - Edge edge = (Edge) getEdgeAdaptor().getAdapter(Edge.class); - assert null != edge : "Null edge in UMLReorientConnectionViewCommand"; //$NON-NLS-1$ - View tempView = edge.getSource(); - edge.setSource(edge.getTarget()); - edge.setTarget(tempView); - return CommandResult.newOKCommandResult(); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/BehaviorExecutionSpecificationEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/BehaviorExecutionSpecificationEditHelper.java deleted file mode 100644 index 6d2e0148d41..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/BehaviorExecutionSpecificationEditHelper.java +++ /dev/null @@ -1,17 +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.helpers; - -/** - * @generated - */ -public class BehaviorExecutionSpecificationEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/CombinedFragmentEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/CombinedFragmentEditHelper.java deleted file mode 100644 index 2ccf0dd54ff..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/CombinedFragmentEditHelper.java +++ /dev/null @@ -1,17 +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.helpers; - -/** - * @generated - */ -public class CombinedFragmentEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/CommentEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/CommentEditHelper.java deleted file mode 100644 index 101826affb2..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/CommentEditHelper.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.edit.helpers; - -/** - * @generated - */ -public class CommentEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/InteractionEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/InteractionEditHelper.java deleted file mode 100644 index d7a6f69a353..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/InteractionEditHelper.java +++ /dev/null @@ -1,17 +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.helpers; - -/** - * @generated - */ -public class InteractionEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/LifelineEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/LifelineEditHelper.java deleted file mode 100644 index 0abc7d167ce..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/LifelineEditHelper.java +++ /dev/null @@ -1,17 +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.helpers; - -/** - * @generated - */ -public class LifelineEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/MessageEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/MessageEditHelper.java deleted file mode 100644 index b2f81eecb27..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/MessageEditHelper.java +++ /dev/null @@ -1,17 +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.helpers; - -/** - * @generated - */ -public class MessageEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/PackageEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/PackageEditHelper.java deleted file mode 100644 index a7ea4f5a645..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/PackageEditHelper.java +++ /dev/null @@ -1,17 +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.helpers; - -/** - * @generated - */ -public class PackageEditHelper extends UMLBaseEditHelper { -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/UMLBaseEditHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/UMLBaseEditHelper.java deleted file mode 100644 index 27eef223822..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/helpers/UMLBaseEditHelper.java +++ /dev/null @@ -1,83 +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.helpers; - -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.edithelper.AbstractEditHelper; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; - -/** - * @generated - */ -public class UMLBaseEditHelper extends AbstractEditHelper { - - /** - * @generated - */ - public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$ - - /** - * @generated - */ - @Override - protected ICommand getInsteadCommand(IEditCommandRequest req) { - ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND); - req.setParameter(EDIT_POLICY_COMMAND, null); - ICommand ehCommand = super.getInsteadCommand(req); - if (epCommand == null) { - return ehCommand; - } - if (ehCommand == null) { - return epCommand; - } - CompositeCommand command = new CompositeCommand(null); - command.add(epCommand); - command.add(ehCommand); - return command; - } - - /** - * @generated - */ - @Override - protected ICommand getCreateCommand(CreateElementRequest req) { - return null; - } - - /** - * @generated - */ - @Override - protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) { - return null; - } - - /** - * @generated - */ - @Override - protected ICommand getDestroyElementCommand(DestroyElementRequest req) { - return null; - } - - /** - * @generated - */ - @Override - protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) { - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java deleted file mode 100644 index 9c7ac6da951..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java +++ /dev/null @@ -1,559 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.PrecisionPoint; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.graphics.Color; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.AnnotateNodeStyleCommand; -import org.eclipse.papyrus.diagram.common.commands.PreserveAnchorsPositionCommand; -import org.eclipse.papyrus.diagram.common.commands.ReconnectToIntersectionPoints; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.editparts.PrimaryShapeEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageOrderCommand; -import org.eclipse.papyrus.diagram.sequence.edit.policies.BehaviorExecutionSpecificationItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class BehaviorExecutionSpecificationEditPart extends ShapeNodeEditPart - implements PrimaryShapeEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 2003; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public BehaviorExecutionSpecificationEditPart(View view) { - super(view); - } - - /** - * This is to modify the feedback if anchors are going to be preserved - * - * @author gmerin - * @NOT-generated - */ - @Override - public void showSourceFeedback(Request request) { - super.showSourceFeedback(PreserveAnchorsPositionCommand - .getNewSourceFeedbackRequest(request, this)); - } - - /** - * /** - * - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new BehaviorExecutionSpecificationItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that - // would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies. - // EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - protected LayoutEditPolicy createLayoutEditPolicy() { - LayoutEditPolicy lep = new LayoutEditPolicy() { - - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child - .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - BehaviourExecutionFigure figure = new BehaviourExecutionFigure(); - return primaryShape = figure; - } - - /** - * @generated - */ - public BehaviourExecutionFigure getPrimaryShape() { - return (BehaviourExecutionFigure) primaryShape; - } - - /** - * @generated NOT - */ - protected NodeFigure createNodePlate() { - BESNodeFigure result = new BESNodeFigure(getMapMode().DPtoLP(16), - getMapMode().DPtoLP(60)); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model so - * you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createNodeFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - /** - * Default implementation treats passed figure as content pane. Respects - * layout one may have set for generated figure. - * - * @param nodeShape - * instance of generated figure class - * @generated - */ - protected IFigure setupContentPane(IFigure nodeShape) { - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - if (event.getNotifier() instanceof ShapeStyle) { - super.handleNotificationEvent(event); - - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) event.getFeature(), event - .getNewValue()); - ep.refresh(); - } - } - - } else { - super.handleNotificationEvent(event); - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getElement_OwnedComment()); - DiagramEditPartsUtil - .handleNotificationForDiagram(this, event, features); - } - - /** - * @NOT-generated - */ - @Override - public Command getCommand(Request _request) { - // can create comments by clicking into the compartment - if (_request instanceof CreateUnspecifiedTypeRequest) { - CreateUnspecifiedTypeRequest cutr = (CreateUnspecifiedTypeRequest) _request; - String type = (String) cutr.getType(); - IHintedType iet = (IHintedType) cutr.getElementTypes().get(0); - String id = iet.getSemanticHint(); - - if (RequestConstants.REQ_CREATE.equals(type) - && (String.valueOf(CommentEditPart.VISUAL_ID).equals(id))) { - return org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil - .getDiagramEditPart(this).getCommand(_request); - } - }// end - - if (_request instanceof CreateConnectionViewAndElementRequest) { - - CreateConnectionViewAndElementRequest createViewAndElemReq = (CreateConnectionViewAndElementRequest) _request; - - // Only order Message connections - if (!MessageCommonUtil.isMessageEditPart(createViewAndElemReq - .getConnectionViewDescriptor().getSemanticHint())) - return super.getCommand(_request); - - CompoundCommand ccommand = new CompoundCommand(); - - // Needed to add the start command to the request - ccommand.add(super.getCommand(_request)); - - // Check if there is another element at the same point - if (!MessageCommonUtil.checkFreeConnectionEnds(_request)) { - return null; - } - - // Add a command to swap between created anchors (points where the - // user clicked and dropped the connection) with the real - // intersection points - ccommand - .add(new ReconnectToIntersectionPoints(createViewAndElemReq)); - - // Creation of the ordering command - MessageOrderCommand msgOrderCmd = new MessageOrderCommand( - createViewAndElemReq); - ccommand.add(msgOrderCmd); - - return ccommand; - } - - if (_request instanceof ReconnectRequest) { - - ReconnectRequest reconnReq = (ReconnectRequest) _request; - - // Only order Message connections - if (!MessageCommonUtil.isMessageEditPart(reconnReq - .getConnectionEditPart())) - return super.getCommand(_request); - - CompoundCommand ccommand = new CompoundCommand(); - - // Check if there is another element at the same point - if (!MessageCommonUtil.checkFreeConnectionEnds(_request)) { - return null; - } - - // Modify the request with the real target anchoring point instead - // of target mouse reference point - ReconnectToIntersectionPoints.modifyLocation(reconnReq); - - // Create the commands with the real target anchoring point - ccommand.add(super.getCommand(_request)); - - // Creation of the re-orientation/re-anchoring command - MessageOrderCommand msgOrderCmd = new MessageOrderCommand(reconnReq); - ccommand.add(msgOrderCmd); - - return ccommand; - } - - return super.getCommand(_request); - } - - /** - * @NOT-generated - */ - public class BESNodeFigure extends DefaultSizeNodeFigure { - - public BESNodeFigure(Dimension defSize) { - super(defSize.width, defSize.height); - } - - public BESNodeFigure(int width, int height) { - super(width, height); - } - - @Override - protected boolean isDefaultAnchorArea(PrecisionPoint p) { - // We don't want a default anchor area for the BES Node Figure. - return false; - } - - } - - /** - * @generated - */ - public class BehaviourExecutionFigure extends RectangleFigure { - - /** - * @generated - */ - public BehaviourExecutionFigure() { - this.setForegroundColor(ColorConstants.black); - this.setBackgroundColor(THIS_BACK); - this.setMaximumSize(new Dimension(getMapMode().DPtoLP(16), - getMapMode().DPtoLP(1000))); - this.setMinimumSize(new Dimension(getMapMode().DPtoLP(16), - getMapMode().DPtoLP(25))); - } - - /** - * @generated - */ - private boolean myUseLocalCoordinates = false; - - /** - * @generated - */ - @Override - protected boolean useLocalCoordinates() { - return myUseLocalCoordinates; - } - - /** - * @generated - */ - protected void setUseLocalCoordinates(boolean useLocalCoordinates) { - myUseLocalCoordinates = useLocalCoordinates; - } - - } - - /** - * @generated - */ - static final Color THIS_BACK = new Color(null, 255, 215, 174); - - /** - * @generated - */ - protected EAnnotation getAppearenceEAnnotation() { - EAnnotation eAnn = getPrimaryView().getEAnnotation( - AnnotateNodeStyleCommand.APPEARANCE_EANNOTATION_NAME); - return eAnn; - } - - /** - * @generated - */ - private List<EObject> changesFromDefaultStyle() { - EAnnotation eAnn = getAppearenceEAnnotation(); - if (eAnn == null) - return new ArrayList<EObject>(); - else - return eAnn.getReferences(); - } - - /** - * @generated - */ - public static boolean isLabel(IFigure figure) { - if (figure instanceof Label) { - return true; - } - if (figure instanceof WrappingLabel) { - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean isFigureFromChildEditPart(IFigure figure) { - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof AbstractGraphicalEditPart) { - AbstractGraphicalEditPart gEP = (AbstractGraphicalEditPart) obj; - if (gEP.getFigure() == figure) { - // Check if semantic elements are different - if (gEP instanceof GraphicalEditPart - && ((GraphicalEditPart) gEP) - .resolveSemanticElement() == resolveSemanticElement()) { - return false; - } - return true; - } else { - // Check if it is a child figure of the editpart - for (java.lang.Object child : gEP.getChildren()) { - if (child instanceof GraphicalEditPart) { - GraphicalEditPart childEP = (GraphicalEditPart) child; - if (childEP.getFigure() == figure) { - if (childEP.resolveSemanticElement() != resolveSemanticElement()) - return true; - else - return false; - } - } - } - } // end else - } - } - return false; - } - - /** - * @generated - */ - @Override - protected void setBackgroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.FILL_STYLE__FILL_COLOR)) { - setOwnedFiguresBackgroundColor(getFigure(), color); - } else - super.setBackgroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresBackgroundColor(IFigure parent, Color color) { - parent.setBackgroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresBackgroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresForegroundColor(getFigure(), color); - } else - super.setForegroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresForegroundColor(IFigure parent, Color color) { - if (!isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof IFigure && !isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresForegroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - - @Override - protected void setFontColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresFontColor(getFigure(), color); - } else - super.setFontColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresFontColor(IFigure parent, Color color) { - if (isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure && isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresFontColor((IFigure) obj, color); - } - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CombinedFragmentEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CombinedFragmentEditPart.java deleted file mode 100644 index 214e4eae79d..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CombinedFragmentEditPart.java +++ /dev/null @@ -1,561 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.BorderLayout; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.papyrus.diagram.common.commands.AnnotateNodeStyleCommand; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.draw2d.InteractionFigure; -import org.eclipse.papyrus.diagram.common.draw2d.LeftToolbarLayout; -import org.eclipse.papyrus.diagram.common.editparts.PrimaryShapeEditPart; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.CombinedFragmentItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class CombinedFragmentEditPart extends ShapeNodeEditPart implements - PrimaryShapeEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 2004; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public CombinedFragmentEditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new CombinedFragmentItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - protected LayoutEditPolicy createLayoutEditPolicy() { - LayoutEditPolicy lep = new LayoutEditPolicy() { - - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child - .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - CombinedFragmentFigure figure = new CombinedFragmentFigure(); - return primaryShape = figure; - } - - /** - * @generated - */ - public CombinedFragmentFigure getPrimaryShape() { - return (CombinedFragmentFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof CombinedFragmentInteractionOperatorEditPart) { - ((CombinedFragmentInteractionOperatorEditPart) childEditPart) - .setLabel(getPrimaryShape() - .getFigureCombinedFragmentLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - - return super.getContentPaneFor(editPart); - } - - /** - * @generated - */ - protected NodeFigure createNodePlate() { - DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode() - .DPtoLP(200), getMapMode().DPtoLP(200)); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model so - * you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createNodeFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - /** - * Default implementation treats passed figure as content pane. Respects - * layout one may have set for generated figure. - * - * @param nodeShape - * instance of generated figure class - * @generated - */ - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(getMapMode().DPtoLP(5)); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry - .getType(CombinedFragmentInteractionOperatorEditPart.VISUAL_ID)); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - if (event.getNotifier() instanceof ShapeStyle) { - super.handleNotificationEvent(event); - - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) event.getFeature(), event - .getNewValue()); - ep.refresh(); - } - } - - } else { - super.handleNotificationEvent(event); - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getElement_OwnedComment()); - DiagramEditPartsUtil - .handleNotificationForDiagram(this, event, features); - } - - /** - * @generated - */ - public class CombinedFragmentFigure extends RectangleFigure { - - /** - * @generated - */ - private WrappingLabel fFigureCombinedFragmentLabelFigure; - - /** - * @generated - */ - public CombinedFragmentFigure() { - - BorderLayout layoutThis = new BorderLayout(); - this.setLayoutManager(layoutThis); - - this.setFill(false); - this.setForegroundColor(ColorConstants.black); - this.setBorder(new MarginBorder(getMapMode().DPtoLP(-2), - getMapMode().DPtoLP(3), getMapMode().DPtoLP(3), - getMapMode().DPtoLP(3))); - createContents(); - } - - /** - * @generated - */ - private void createContents() { - - RectangleFigure combinedFragmentLabel0 = new RectangleFigure(); - combinedFragmentLabel0.setFill(false); - combinedFragmentLabel0.setOutline(false); - - this.add(combinedFragmentLabel0, BorderLayout.TOP); - - BorderLayout layoutCombinedFragmentLabel0 = new BorderLayout(); - combinedFragmentLabel0 - .setLayoutManager(layoutCombinedFragmentLabel0); - - InteractionFigure combinedFragmentLabelContainer1 = new InteractionFigure(); - - combinedFragmentLabelContainer1.setBorder(new MarginBorder( - getMapMode().DPtoLP(3), getMapMode().DPtoLP(3), - getMapMode().DPtoLP(3), getMapMode().DPtoLP(3))); - - combinedFragmentLabel0.add(combinedFragmentLabelContainer1, - BorderLayout.LEFT); - - LeftToolbarLayout layoutCombinedFragmentLabelContainer1 = new LeftToolbarLayout(); - - combinedFragmentLabelContainer1 - .setLayoutManager(layoutCombinedFragmentLabelContainer1); - - fFigureCombinedFragmentLabelFigure = new WrappingLabel(); - fFigureCombinedFragmentLabelFigure.setText(""); - - fFigureCombinedFragmentLabelFigure - .setFont(FFIGURECOMBINEDFRAGMENTLABELFIGURE_FONT); - - combinedFragmentLabelContainer1 - .add(fFigureCombinedFragmentLabelFigure); - - } - - /** - * @generated - */ - private boolean myUseLocalCoordinates = false; - - /** - * @generated - */ - @Override - protected boolean useLocalCoordinates() { - return myUseLocalCoordinates; - } - - /** - * @generated - */ - protected void setUseLocalCoordinates(boolean useLocalCoordinates) { - myUseLocalCoordinates = useLocalCoordinates; - } - - /** - * @generated - */ - public WrappingLabel getFigureCombinedFragmentLabelFigure() { - return fFigureCombinedFragmentLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGURECOMBINEDFRAGMENTLABELFIGURE_FONT = new Font( - Display.getCurrent(), "SANS", 10, SWT.BOLD); - - /** - * @generated - */ - protected EAnnotation getAppearenceEAnnotation() { - EAnnotation eAnn = getPrimaryView().getEAnnotation( - AnnotateNodeStyleCommand.APPEARANCE_EANNOTATION_NAME); - return eAnn; - } - - /** - * @generated - */ - private List<EObject> changesFromDefaultStyle() { - EAnnotation eAnn = getAppearenceEAnnotation(); - if (eAnn == null) - return new ArrayList<EObject>(); - else - return eAnn.getReferences(); - } - - /** - * @generated - */ - public static boolean isLabel(IFigure figure) { - if (figure instanceof Label) { - return true; - } - if (figure instanceof WrappingLabel) { - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean isFigureFromChildEditPart(IFigure figure) { - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof AbstractGraphicalEditPart) { - AbstractGraphicalEditPart gEP = (AbstractGraphicalEditPart) obj; - if (gEP.getFigure() == figure) { - // Check if semantic elements are different - if (gEP instanceof GraphicalEditPart - && ((GraphicalEditPart) gEP) - .resolveSemanticElement() == resolveSemanticElement()) { - return false; - } - return true; - } else { - // Check if it is a child figure of the editpart - for (java.lang.Object child : gEP.getChildren()) { - if (child instanceof GraphicalEditPart) { - GraphicalEditPart childEP = (GraphicalEditPart) child; - if (childEP.getFigure() == figure) { - if (childEP.resolveSemanticElement() != resolveSemanticElement()) - return true; - else - return false; - } - } - } - } // end else - } - } - return false; - } - - /** - * @generated - */ - @Override - protected void setBackgroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.FILL_STYLE__FILL_COLOR)) { - setOwnedFiguresBackgroundColor(getFigure(), color); - } else - super.setBackgroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresBackgroundColor(IFigure parent, Color color) { - parent.setBackgroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresBackgroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresForegroundColor(getFigure(), color); - } else - super.setForegroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresForegroundColor(IFigure parent, Color color) { - if (!isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof IFigure && !isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresForegroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - - @Override - protected void setFontColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresFontColor(getFigure(), color); - } else - super.setFontColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresFontColor(IFigure parent, Color color) { - if (isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure && isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresFontColor((IFigure) obj, color); - } - } - } - -}
\ No newline at end of file diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CombinedFragmentInteractionOperatorEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CombinedFragmentInteractionOperatorEditPart.java deleted file mode 100644 index b288fa8d167..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CombinedFragmentInteractionOperatorEditPart.java +++ /dev/null @@ -1,609 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.NonResizableHandleKit; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class CombinedFragmentInteractionOperatorEditPart extends - CompartmentEditPart implements ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4002; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - public CombinedFragmentInteractionOperatorEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, - new NonResizableEditPolicy() { - - protected List createSelectionHandles() { - List handles = new ArrayList(); - NonResizableHandleKit.addMoveHandle( - (GraphicalEditPart) getHost(), handles); - return handles; - } - - public Command getCommand(Request request) { - return null; - } - - public boolean understandsRequest(Request request) { - return false; - } - }); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.CombinedFragment_2004, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentAnnotatedElementEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentAnnotatedElementEditPart.java deleted file mode 100644 index 34f5a13a598..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentAnnotatedElementEditPart.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Collections; - -import java.util.List; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.CommentAnnotatedElementItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class CommentAnnotatedElementEditPart extends ConnectionNodeEditPart - implements ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3008; - - /** - * @generated - */ - public CommentAnnotatedElementEditPart(View view) { - super(view); - } - - /** - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new CommentAnnotatedElementItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - CommentAnnotatedElementEditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new CommentLinkFigure(); - } - - /** - * @generated - */ - public CommentLinkFigure getPrimaryShape() { - return (CommentLinkFigure) getFigure(); - } - - /** - * @generated - */ - public class CommentLinkFigure extends PolylineConnectionEx { - - /** - * @generated - */ - public CommentLinkFigure() { - this.setLineStyle(Graphics.LINE_DASHDOT); - this.setForegroundColor(ColorConstants.lightGray); - - } - - } - - /** - * @generated - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - // no target or source features found - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - - /** - * @generated not - */ - @Override - public Command getCommand(Request _request) { - if (_request instanceof GroupRequest - && RequestConstants.REQ_DELETE.equals(_request.getType())) { - return getEditPolicy(EditPolicyRoles.SEMANTIC_ROLE).getCommand( - _request); - } - - return super.getCommand(_request); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentBodyEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentBodyEditPart.java deleted file mode 100644 index 878d2d7ca0f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentBodyEditPart.java +++ /dev/null @@ -1,612 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.NonResizableHandleKit; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class CommentBodyEditPart extends CompartmentEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 5003; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - public CommentBodyEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, - new NonResizableEditPolicy() { - - protected List createSelectionHandles() { - List handles = new ArrayList(); - NonResizableHandleKit.addMoveHandle( - (GraphicalEditPart) getHost(), handles); - return handles; - } - - public Command getCommand(Request request) { - return null; - } - - public boolean understandsRequest(Request request) { - return false; - } - }); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated not - */ - public void setLabel(WrapLabel figure) { - unregisterVisuals(); - setFigure(figure); - figure.setTextWrap(true); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Comment_2005, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentEditPart.java deleted file mode 100644 index 0018a00b264..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/CommentEditPart.java +++ /dev/null @@ -1,607 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Shape; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.AnnotateNodeStyleCommand; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.editparts.PrimaryShapeEditPart; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.CommentItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class CommentEditPart extends ShapeNodeEditPart implements - PrimaryShapeEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 2005; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public CommentEditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new CommentItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - protected LayoutEditPolicy createLayoutEditPolicy() { - LayoutEditPolicy lep = new LayoutEditPolicy() { - - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child - .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - CommentFigure figure = new CommentFigure(); - return primaryShape = figure; - } - - /** - * @generated - */ - public CommentFigure getPrimaryShape() { - return (CommentFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof CommentBodyEditPart) { - ((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureCommentBody_label()); - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - - return super.getContentPaneFor(editPart); - } - - /** - * @generated - */ - protected NodeFigure createNodePlate() { - DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode() - .DPtoLP(160), getMapMode().DPtoLP(75)); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createNodeFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - /** - * Default implementation treats passed figure as content pane. - * Respects layout one may have set for generated figure. - * @param nodeShape instance of generated figure class - * @generated - */ - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(getMapMode().DPtoLP(5)); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry - .getType(CommentBodyEditPart.VISUAL_ID)); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - - if (event.getNotifier() == getModel() - && EcorePackage.eINSTANCE.getEModelElement_EAnnotations() - .equals(event.getFeature())) { - handleMajorSemanticChange(); - } else if (event.getNotifier() instanceof ShapeStyle) { - super.handleNotificationEvent(event); - - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) event.getFeature(), event - .getNewValue()); - ep.refresh(); - } - } - - } - - else { - super.handleNotificationEvent(event); - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getElement_OwnedComment()); - features.add(UMLPackage.eINSTANCE.getComment_AnnotatedElement()); - DiagramEditPartsUtil - .handleNotificationForDiagram(this, event, features); - } - - /** - * @generated - */ - public class CommentFigure extends Shape { - - /** - * @generated - */ - private WrappingLabel fFigureCommentBody_label; - - /** - * @generated - */ - public CommentFigure() { - this.addPoint(new Point(getMapMode().DPtoLP(90), getMapMode() - .DPtoLP(0))); - this.addPoint(new Point(getMapMode().DPtoLP(0), getMapMode() - .DPtoLP(0))); - this.addPoint(new Point(getMapMode().DPtoLP(0), getMapMode() - .DPtoLP(60))); - this.addPoint(new Point(getMapMode().DPtoLP(100), getMapMode() - .DPtoLP(60))); - this.addPoint(new Point(getMapMode().DPtoLP(100), getMapMode() - .DPtoLP(10))); - this.addPoint(new Point(getMapMode().DPtoLP(90), getMapMode() - .DPtoLP(0))); - this.addPoint(new Point(getMapMode().DPtoLP(90), getMapMode() - .DPtoLP(10))); - this.addPoint(new Point(getMapMode().DPtoLP(100), getMapMode() - .DPtoLP(10))); - this.addPoint(new Point(getMapMode().DPtoLP(90), getMapMode() - .DPtoLP(0))); - this.setFill(true); - this.setForegroundColor(ColorConstants.black); - this.setBackgroundColor(ColorConstants.white); - createContents(); - } - - /** - * @generated - */ - private void createContents() { - - fFigureCommentBody_label = new WrappingLabel(); - fFigureCommentBody_label.setText(""); - - fFigureCommentBody_label.setFont(FFIGURECOMMENTBODY_LABEL_FONT); - - fFigureCommentBody_label.setBorder(new MarginBorder(getMapMode() - .DPtoLP(2), getMapMode().DPtoLP(2), getMapMode().DPtoLP(2), - getMapMode().DPtoLP(15))); - - this.add(fFigureCommentBody_label); - - } - - /** - * @generated - */ - private final PointList myTemplate = new PointList(); - /** - * @generated - */ - private Rectangle myTemplateBounds; - - /** - * @generated - */ - public void addPoint(Point point) { - myTemplate.addPoint(point); - myTemplateBounds = null; - } - - /** - * @generated - */ - @Override - protected void fillShape(Graphics graphics) { - Rectangle bounds = getBounds(); - graphics.pushState(); - graphics.translate(bounds.x, bounds.y); - graphics.fillPolygon(scalePointList()); - graphics.popState(); - } - - /** - * @generated - */ - @Override - protected void outlineShape(Graphics graphics) { - Rectangle bounds = getBounds(); - graphics.pushState(); - graphics.translate(bounds.x, bounds.y); - graphics.drawPolygon(scalePointList()); - graphics.popState(); - } - - /** - * @generated - */ - private Rectangle getTemplateBounds() { - if (myTemplateBounds == null) { - myTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0); - //just safety -- we are going to use this as divider - if (myTemplateBounds.width < 1) { - myTemplateBounds.width = 1; - } - if (myTemplateBounds.height < 1) { - myTemplateBounds.height = 1; - } - } - return myTemplateBounds; - } - - /** - * @generated - */ - private int[] scalePointList() { - Rectangle pointsBounds = getTemplateBounds(); - Rectangle actualBounds = getBounds(); - - float xScale = ((float) actualBounds.width) / pointsBounds.width; - float yScale = ((float) actualBounds.height) / pointsBounds.height; - - if (xScale == 1 && yScale == 1) { - return myTemplate.toIntArray(); - } - int[] scaled = (int[]) myTemplate.toIntArray().clone(); - for (int i = 0; i < scaled.length; i += 2) { - scaled[i] = (int) Math.floor(scaled[i] * xScale); - scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale); - } - return scaled; - } - - /** - * @generated - */ - public WrappingLabel getFigureCommentBody_label() { - return fFigureCommentBody_label; - } - - } - - /** - * @generated - */ - static final Font FFIGURECOMMENTBODY_LABEL_FONT = new Font(Display - .getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @generated - */ - protected EAnnotation getAppearenceEAnnotation() { - EAnnotation eAnn = getPrimaryView().getEAnnotation( - AnnotateNodeStyleCommand.APPEARANCE_EANNOTATION_NAME); - return eAnn; - } - - /** - * @generated - */ - private List<EObject> changesFromDefaultStyle() { - EAnnotation eAnn = getAppearenceEAnnotation(); - if (eAnn == null) - return new ArrayList<EObject>(); - else - return eAnn.getReferences(); - } - - /** - * @generated - */ - public static boolean isLabel(IFigure figure) { - if (figure instanceof Label) { - return true; - } - if (figure instanceof WrappingLabel) { - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean isFigureFromChildEditPart(IFigure figure) { - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof AbstractGraphicalEditPart) { - AbstractGraphicalEditPart gEP = (AbstractGraphicalEditPart) obj; - if (gEP.getFigure() == figure) { - // Check if semantic elements are different - if (gEP instanceof GraphicalEditPart - && ((GraphicalEditPart) gEP) - .resolveSemanticElement() == resolveSemanticElement()) { - return false; - } - return true; - } else { - // Check if it is a child figure of the editpart - for (java.lang.Object child : gEP.getChildren()) { - if (child instanceof GraphicalEditPart) { - GraphicalEditPart childEP = (GraphicalEditPart) child; - if (childEP.getFigure() == figure) { - if (childEP.resolveSemanticElement() != resolveSemanticElement()) - return true; - else - return false; - } - } - } - } // end else - } - } - return false; - } - - /** - * @generated - */ - @Override - protected void setBackgroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.FILL_STYLE__FILL_COLOR)) { - setOwnedFiguresBackgroundColor(getFigure(), color); - } else - super.setBackgroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresBackgroundColor(IFigure parent, Color color) { - parent.setBackgroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresBackgroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresForegroundColor(getFigure(), color); - } else - super.setForegroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresForegroundColor(IFigure parent, Color color) { - if (!isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof IFigure && !isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresForegroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - - @Override - protected void setFontColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresFontColor(getFigure(), color); - } else - super.setFontColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresFontColor(IFigure parent, Color color) { - if (isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure && isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresFontColor((IFigure) obj, color); - } - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/ElementOwnedCommentEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/ElementOwnedCommentEditPart.java deleted file mode 100644 index 37c6965e993..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/ElementOwnedCommentEditPart.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Collections; - -import java.util.List; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.ElementOwnedCommentItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class ElementOwnedCommentEditPart extends ConnectionNodeEditPart - implements ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3007; - - /** - * @generated - */ - public ElementOwnedCommentEditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new ElementOwnedCommentItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - ElementOwnedCommentEditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new CommentLinkFigure(); - } - - /** - * @generated - */ - public CommentLinkFigure getPrimaryShape() { - return (CommentLinkFigure) getFigure(); - } - - /** - * @generated - */ - public class CommentLinkFigure extends PolylineConnectionEx { - - /** - * @generated - */ - public CommentLinkFigure() { - this.setLineStyle(Graphics.LINE_DASHDOT); - this.setForegroundColor(ColorConstants.lightGray); - - } - - } - - /** - * @generated - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - // no target or source features found - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - - /** - * @generated not - */ - @Override - public Command getCommand(Request _request) { - if (_request instanceof GroupRequest - && RequestConstants.REQ_DELETE.equals(_request.getType())) { - return getEditPolicy(EditPolicyRoles.SEMANTIC_ROLE).getCommand( - _request); - } - - return super.getCommand(_request); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Interaction2EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Interaction2EditPart.java deleted file mode 100644 index 4840252de3f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Interaction2EditPart.java +++ /dev/null @@ -1,603 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.BorderLayout; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.papyrus.diagram.common.commands.AnnotateNodeStyleCommand; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.draw2d.InteractionFigure; -import org.eclipse.papyrus.diagram.common.draw2d.LeftToolbarLayout; -import org.eclipse.papyrus.diagram.common.editparts.PrimaryShapeEditPart; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.Interaction2ItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Interaction2EditPart extends ShapeNodeEditPart implements - PrimaryShapeEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 2001; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public Interaction2EditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new Interaction2ItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - protected LayoutEditPolicy createLayoutEditPolicy() { - LayoutEditPolicy lep = new LayoutEditPolicy() { - - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child - .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - InteractionRectangleFigure figure = new InteractionRectangleFigure(); - return primaryShape = figure; - } - - /** - * @generated - */ - public InteractionRectangleFigure getPrimaryShape() { - return (InteractionRectangleFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof InteractionName2EditPart) { - ((InteractionName2EditPart) childEditPart) - .setLabel(getPrimaryShape() - .getFigureInteractionLabelFigure()); - return true; - } - if (childEditPart instanceof InteractionInteractionCompartment2EditPart) { - IFigure pane = getPrimaryShape() - .getFigureInteractionCompartmentFigure(); - setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane - .add(((InteractionInteractionCompartment2EditPart) childEditPart) - .getFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof InteractionInteractionCompartment2EditPart) { - IFigure pane = getPrimaryShape() - .getFigureInteractionCompartmentFigure(); - pane - .remove(((InteractionInteractionCompartment2EditPart) childEditPart) - .getFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - - if (editPart instanceof InteractionInteractionCompartment2EditPart) { - return getPrimaryShape().getFigureInteractionCompartmentFigure(); - } - return super.getContentPaneFor(editPart); - } - - /** - * @generated - */ - protected NodeFigure createNodePlate() { - DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode() - .DPtoLP(600), getMapMode().DPtoLP(400)); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createNodeFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - /** - * Default implementation treats passed figure as content pane. - * Respects layout one may have set for generated figure. - * @param nodeShape instance of generated figure class - * @generated - */ - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(getMapMode().DPtoLP(5)); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry - .getType(InteractionName2EditPart.VISUAL_ID)); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - if (event.getNotifier() instanceof ShapeStyle) { - super.handleNotificationEvent(event); - - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) event.getFeature(), event - .getNewValue()); - ep.refresh(); - } - } - - } else { - super.handleNotificationEvent(event); - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedComment()); - DiagramEditPartsUtil - .handleNotificationForDiagram(this, event, features); - } - - /** - * @generated - */ - public class InteractionRectangleFigure extends RectangleFigure { - - /** - * @generated - */ - private WrappingLabel fFigureInteractionLabelFigure; - /** - * @generated - */ - private RectangleFigure fFigureInteractionCompartmentFigure; - - /** - * @generated - */ - public InteractionRectangleFigure() { - - BorderLayout layoutThis = new BorderLayout(); - this.setLayoutManager(layoutThis); - - this.setFill(false); - this.setForegroundColor(ColorConstants.black); - this.setBorder(new MarginBorder(getMapMode().DPtoLP(-2), - getMapMode().DPtoLP(3), getMapMode().DPtoLP(3), - getMapMode().DPtoLP(3))); - createContents(); - } - - /** - * @generated - */ - private void createContents() { - - RectangleFigure interactionLabel0 = new RectangleFigure(); - interactionLabel0.setFill(false); - interactionLabel0.setOutline(false); - - this.add(interactionLabel0, BorderLayout.TOP); - - BorderLayout layoutInteractionLabel0 = new BorderLayout(); - interactionLabel0.setLayoutManager(layoutInteractionLabel0); - - InteractionFigure interactionLabelContainer1 = new InteractionFigure(); - - interactionLabelContainer1.setBorder(new MarginBorder(getMapMode() - .DPtoLP(3), getMapMode().DPtoLP(3), getMapMode().DPtoLP(3), - getMapMode().DPtoLP(3))); - - interactionLabel0 - .add(interactionLabelContainer1, BorderLayout.LEFT); - - LeftToolbarLayout layoutInteractionLabelContainer1 = new LeftToolbarLayout(); - - interactionLabelContainer1 - .setLayoutManager(layoutInteractionLabelContainer1); - - fFigureInteractionLabelFigure = new WrappingLabel(); - fFigureInteractionLabelFigure.setText(""); - - fFigureInteractionLabelFigure - .setFont(FFIGUREINTERACTIONLABELFIGURE_FONT); - - interactionLabelContainer1.add(fFigureInteractionLabelFigure); - - fFigureInteractionCompartmentFigure = new RectangleFigure(); - fFigureInteractionCompartmentFigure.setFill(false); - fFigureInteractionCompartmentFigure.setOutline(false); - fFigureInteractionCompartmentFigure.setLineWidth(0); - fFigureInteractionCompartmentFigure - .setForegroundColor(ColorConstants.white); - - this.add(fFigureInteractionCompartmentFigure, BorderLayout.CENTER); - - } - - /** - * @generated - */ - private boolean myUseLocalCoordinates = false; - - /** - * @generated - */ - @Override - protected boolean useLocalCoordinates() { - return myUseLocalCoordinates; - } - - /** - * @generated - */ - protected void setUseLocalCoordinates(boolean useLocalCoordinates) { - myUseLocalCoordinates = useLocalCoordinates; - } - - /** - * @generated - */ - public WrappingLabel getFigureInteractionLabelFigure() { - return fFigureInteractionLabelFigure; - } - - /** - * @generated - */ - public RectangleFigure getFigureInteractionCompartmentFigure() { - return fFigureInteractionCompartmentFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREINTERACTIONLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 10, SWT.BOLD); - - /** - * @generated - */ - protected EAnnotation getAppearenceEAnnotation() { - EAnnotation eAnn = getPrimaryView().getEAnnotation( - AnnotateNodeStyleCommand.APPEARANCE_EANNOTATION_NAME); - return eAnn; - } - - /** - * @generated - */ - private List<EObject> changesFromDefaultStyle() { - EAnnotation eAnn = getAppearenceEAnnotation(); - if (eAnn == null) - return new ArrayList<EObject>(); - else - return eAnn.getReferences(); - } - - /** - * @generated - */ - public static boolean isLabel(IFigure figure) { - if (figure instanceof Label) { - return true; - } - if (figure instanceof WrappingLabel) { - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean isFigureFromChildEditPart(IFigure figure) { - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof AbstractGraphicalEditPart) { - AbstractGraphicalEditPart gEP = (AbstractGraphicalEditPart) obj; - if (gEP.getFigure() == figure) { - // Check if semantic elements are different - if (gEP instanceof GraphicalEditPart - && ((GraphicalEditPart) gEP) - .resolveSemanticElement() == resolveSemanticElement()) { - return false; - } - return true; - } else { - // Check if it is a child figure of the editpart - for (java.lang.Object child : gEP.getChildren()) { - if (child instanceof GraphicalEditPart) { - GraphicalEditPart childEP = (GraphicalEditPart) child; - if (childEP.getFigure() == figure) { - if (childEP.resolveSemanticElement() != resolveSemanticElement()) - return true; - else - return false; - } - } - } - } // end else - } - } - return false; - } - - /** - * @generated - */ - @Override - protected void setBackgroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.FILL_STYLE__FILL_COLOR)) { - setOwnedFiguresBackgroundColor(getFigure(), color); - } else - super.setBackgroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresBackgroundColor(IFigure parent, Color color) { - parent.setBackgroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresBackgroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresForegroundColor(getFigure(), color); - } else - super.setForegroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresForegroundColor(IFigure parent, Color color) { - if (!isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof IFigure && !isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresForegroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - - @Override - protected void setFontColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresFontColor(getFigure(), color); - } else - super.setFontColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresFontColor(IFigure parent, Color color) { - if (isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure && isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresFontColor((IFigure) obj, color); - } - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionEditPart.java deleted file mode 100644 index 60d3e2f9182..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionEditPart.java +++ /dev/null @@ -1,611 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.BorderLayout; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.AnnotateNodeStyleCommand; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.draw2d.InteractionFigure; -import org.eclipse.papyrus.diagram.common.draw2d.LeftToolbarLayout; -import org.eclipse.papyrus.diagram.common.editparts.PrimaryShapeEditPart; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class InteractionEditPart extends ShapeNodeEditPart implements - PrimaryShapeEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 1001; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public InteractionEditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new InteractionItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - protected LayoutEditPolicy createLayoutEditPolicy() { - LayoutEditPolicy lep = new LayoutEditPolicy() { - - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child - .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - InteractionRectangleFigure figure = new InteractionRectangleFigure(); - return primaryShape = figure; - } - - /** - * @generated - */ - public InteractionRectangleFigure getPrimaryShape() { - return (InteractionRectangleFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof InteractionNameEditPart) { - ((InteractionNameEditPart) childEditPart) - .setLabel(getPrimaryShape() - .getFigureInteractionLabelFigure()); - return true; - } - if (childEditPart instanceof InteractionInteractionCompartmentEditPart) { - IFigure pane = getPrimaryShape() - .getFigureInteractionCompartmentFigure(); - setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane - .add(((InteractionInteractionCompartmentEditPart) childEditPart) - .getFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof InteractionInteractionCompartmentEditPart) { - IFigure pane = getPrimaryShape() - .getFigureInteractionCompartmentFigure(); - pane - .remove(((InteractionInteractionCompartmentEditPart) childEditPart) - .getFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - - if (editPart instanceof InteractionInteractionCompartmentEditPart) { - return getPrimaryShape().getFigureInteractionCompartmentFigure(); - } - return super.getContentPaneFor(editPart); - } - - /** - * @generated - */ - protected NodeFigure createNodePlate() { - DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode() - .DPtoLP(600), getMapMode().DPtoLP(400)); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createNodeFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - /** - * Default implementation treats passed figure as content pane. - * Respects layout one may have set for generated figure. - * @param nodeShape instance of generated figure class - * @generated - */ - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(getMapMode().DPtoLP(5)); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry - .getType(InteractionNameEditPart.VISUAL_ID)); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - - if (event.getNotifier() == getModel() - && EcorePackage.eINSTANCE.getEModelElement_EAnnotations() - .equals(event.getFeature())) { - handleMajorSemanticChange(); - } else if (event.getNotifier() instanceof ShapeStyle) { - super.handleNotificationEvent(event); - - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) event.getFeature(), event - .getNewValue()); - ep.refresh(); - } - } - - } - - else { - super.handleNotificationEvent(event); - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getInteraction_Message()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedComment()); - DiagramEditPartsUtil - .handleNotificationForDiagram(this, event, features); - } - - /** - * @generated - */ - public class InteractionRectangleFigure extends RectangleFigure { - - /** - * @generated - */ - private WrappingLabel fFigureInteractionLabelFigure; - /** - * @generated - */ - private RectangleFigure fFigureInteractionCompartmentFigure; - - /** - * @generated - */ - public InteractionRectangleFigure() { - - BorderLayout layoutThis = new BorderLayout(); - this.setLayoutManager(layoutThis); - - this.setFill(false); - this.setForegroundColor(ColorConstants.black); - this.setBorder(new MarginBorder(getMapMode().DPtoLP(-2), - getMapMode().DPtoLP(3), getMapMode().DPtoLP(3), - getMapMode().DPtoLP(3))); - createContents(); - } - - /** - * @generated - */ - private void createContents() { - - RectangleFigure interactionLabel0 = new RectangleFigure(); - interactionLabel0.setFill(false); - interactionLabel0.setOutline(false); - - this.add(interactionLabel0, BorderLayout.TOP); - - BorderLayout layoutInteractionLabel0 = new BorderLayout(); - interactionLabel0.setLayoutManager(layoutInteractionLabel0); - - InteractionFigure interactionLabelContainer1 = new InteractionFigure(); - - interactionLabelContainer1.setBorder(new MarginBorder(getMapMode() - .DPtoLP(3), getMapMode().DPtoLP(3), getMapMode().DPtoLP(3), - getMapMode().DPtoLP(3))); - - interactionLabel0 - .add(interactionLabelContainer1, BorderLayout.LEFT); - - LeftToolbarLayout layoutInteractionLabelContainer1 = new LeftToolbarLayout(); - - interactionLabelContainer1 - .setLayoutManager(layoutInteractionLabelContainer1); - - fFigureInteractionLabelFigure = new WrappingLabel(); - fFigureInteractionLabelFigure.setText(""); - - fFigureInteractionLabelFigure - .setFont(FFIGUREINTERACTIONLABELFIGURE_FONT); - - interactionLabelContainer1.add(fFigureInteractionLabelFigure); - - fFigureInteractionCompartmentFigure = new RectangleFigure(); - fFigureInteractionCompartmentFigure.setFill(false); - fFigureInteractionCompartmentFigure.setOutline(false); - fFigureInteractionCompartmentFigure.setLineWidth(0); - fFigureInteractionCompartmentFigure - .setForegroundColor(ColorConstants.white); - - this.add(fFigureInteractionCompartmentFigure, BorderLayout.CENTER); - - } - - /** - * @generated - */ - private boolean myUseLocalCoordinates = false; - - /** - * @generated - */ - @Override - protected boolean useLocalCoordinates() { - return myUseLocalCoordinates; - } - - /** - * @generated - */ - protected void setUseLocalCoordinates(boolean useLocalCoordinates) { - myUseLocalCoordinates = useLocalCoordinates; - } - - /** - * @generated - */ - public WrappingLabel getFigureInteractionLabelFigure() { - return fFigureInteractionLabelFigure; - } - - /** - * @generated - */ - public RectangleFigure getFigureInteractionCompartmentFigure() { - return fFigureInteractionCompartmentFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREINTERACTIONLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 10, SWT.BOLD); - - /** - * @generated - */ - protected EAnnotation getAppearenceEAnnotation() { - EAnnotation eAnn = getPrimaryView().getEAnnotation( - AnnotateNodeStyleCommand.APPEARANCE_EANNOTATION_NAME); - return eAnn; - } - - /** - * @generated - */ - private List<EObject> changesFromDefaultStyle() { - EAnnotation eAnn = getAppearenceEAnnotation(); - if (eAnn == null) - return new ArrayList<EObject>(); - else - return eAnn.getReferences(); - } - - /** - * @generated - */ - public static boolean isLabel(IFigure figure) { - if (figure instanceof Label) { - return true; - } - if (figure instanceof WrappingLabel) { - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean isFigureFromChildEditPart(IFigure figure) { - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof AbstractGraphicalEditPart) { - AbstractGraphicalEditPart gEP = (AbstractGraphicalEditPart) obj; - if (gEP.getFigure() == figure) { - // Check if semantic elements are different - if (gEP instanceof GraphicalEditPart - && ((GraphicalEditPart) gEP) - .resolveSemanticElement() == resolveSemanticElement()) { - return false; - } - return true; - } else { - // Check if it is a child figure of the editpart - for (java.lang.Object child : gEP.getChildren()) { - if (child instanceof GraphicalEditPart) { - GraphicalEditPart childEP = (GraphicalEditPart) child; - if (childEP.getFigure() == figure) { - if (childEP.resolveSemanticElement() != resolveSemanticElement()) - return true; - else - return false; - } - } - } - } // end else - } - } - return false; - } - - /** - * @generated - */ - @Override - protected void setBackgroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.FILL_STYLE__FILL_COLOR)) { - setOwnedFiguresBackgroundColor(getFigure(), color); - } else - super.setBackgroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresBackgroundColor(IFigure parent, Color color) { - parent.setBackgroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresBackgroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresForegroundColor(getFigure(), color); - } else - super.setForegroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresForegroundColor(IFigure parent, Color color) { - if (!isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof IFigure && !isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresForegroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - - @Override - protected void setFontColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresFontColor(getFigure(), color); - } else - super.setFontColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresFontColor(IFigure parent, Color color) { - if (isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure && isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresFontColor((IFigure) obj, color); - } - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionInteractionCompartment2EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionInteractionCompartment2EditPart.java deleted file mode 100644 index de945fdb5a6..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionInteractionCompartment2EditPart.java +++ /dev/null @@ -1,311 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.diagram.ui.requests.ZOrderRequest; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.ChangeZOrderOfCreatedEP; -import org.eclipse.papyrus.diagram.common.editpolicies.DragDropEditPolicy; -import org.eclipse.papyrus.diagram.common.editpolicies.ViewAndFeatureResolver; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CreateLifelineAndBESCommand; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionCompartmentXYLayoutEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionInteractionCompartment2CanonicalEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionInteractionCompartment2ItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDiagramDragAndDropEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class InteractionInteractionCompartment2EditPart extends - ShapeCompartmentEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 5002; - - /** - * @generated NOT - */ - private final ViewAndFeatureResolver resolver = new ViewAndFeatureResolver() { - - /** - * generated NOT - */ - public boolean isEObjectNode(EObject element) { - if (element instanceof Interaction) { - // Check if is children - if (resolveSemanticElement().eContents().contains(element)) { - // check if there is no existing view of the children - if (DiagramEditPartsUtil.getEObjectViews(element).size() == 0) - return true; - } - } - return false; - } - - public boolean isEObjectLink(EObject element) { - return false; - } - - public int getEObjectSemanticHint(EObject element) { - if (element instanceof Interaction) { - return UMLVisualIDRegistry.getNodeVisualID(getNotationView(), - element); - } - return -1; - } - - public EStructuralFeature getEStructuralFeatureForEClass(EClass class1) { - return null; - } - }; - - /** - * @generated - */ - public InteractionInteractionCompartment2EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - public String getCompartmentName() { - return Messages.InteractionInteractionCompartment2EditPart_title; - } - - /** - * @generated - */ - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super - .createFigure(); - result.setTitleVisibility(false); - return result; - } - - /** - * Modified to install custom Drag&Drop policy. - * - * @author Gabriel Merin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new InteractionInteractionCompartment2ItemSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, - new CreationEditPolicy()); - DragDropEditPolicy dragAndDropEditPolicy = null; - dragAndDropEditPolicy = new DragDropEditPolicy(resolver); - // fjcano: modified to add custom Drag&Drop policy - installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, - new SequenceDiagramDragAndDropEditPolicy(resolver)); - - installEditPolicy(EditPolicy.LAYOUT_ROLE, - new InteractionCompartmentXYLayoutEditPolicy()); - - installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, - new InteractionInteractionCompartment2CanonicalEditPolicy()); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - - if (notification.getNotifier() instanceof ShapeStyle) { - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) notification.getFeature(), - notification.getNewValue()); - ep.refresh(); - } - } - - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getInteraction_Fragment()); - features.add(UMLPackage.eINSTANCE.getInteraction_Lifeline()); - features.add(UMLPackage.eINSTANCE.getInteraction_Fragment()); - DiagramEditPartsUtil.handleNotificationForView(this, notification, - features); - } - - /** - * @generated - */ - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } - - /** - * When creating of a Lifeline a BES will be created too - * - * @generated-NOT - */ - @Override - public Command getCommand(Request _request) { - - // lets to create a CommentLink for an Activity by clicking in the - // Subvertices Compartment - if (_request instanceof CreateUnspecifiedTypeConnectionRequest) { - CreateUnspecifiedTypeConnectionRequest cutcr = (CreateUnspecifiedTypeConnectionRequest) _request; - String type = (String) cutcr.getType(); - IHintedType iet = (IHintedType) cutcr.getElementTypes().get(0); - String id = iet.getSemanticHint(); - - if (org.eclipse.gef.RequestConstants.REQ_CONNECTION_START - .equals(type) - && String.valueOf(ElementOwnedCommentEditPart.VISUAL_ID) - .equals(id)) { - if (cutcr.getTargetEditPart() instanceof InteractionInteractionCompartment2EditPart) - cutcr.setTargetEditPart(getParent()); - return getParent().getCommand(cutcr); - } else if (org.eclipse.gef.RequestConstants.REQ_CONNECTION_END - .equals(type) - && String.valueOf(ElementOwnedCommentEditPart.VISUAL_ID) - .equals(id)) { - if (cutcr.getSourceEditPart() instanceof InteractionInteractionCompartment2EditPart) - cutcr.setSourceEditPart(getParent()); - return getParent().getCommand(cutcr); - } - } - - // can create comments by clicking into the compartment - if (_request instanceof CreateUnspecifiedTypeRequest) { - CreateUnspecifiedTypeRequest cutr = (CreateUnspecifiedTypeRequest) _request; - String type = (String) cutr.getType(); - IHintedType iet = (IHintedType) cutr.getElementTypes().get(0); - String id = iet.getSemanticHint(); - - if (org.eclipse.gef.RequestConstants.REQ_CREATE.equals(type) - && (String.valueOf(CommentEditPart.VISUAL_ID).equals(id))) { - return org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil - .getDiagramEditPart(this).getCommand(_request); - } - } - // don't let to move a comment into a compartment - if (_request instanceof EditCommandRequestWrapper) { - EditCommandRequestWrapper ecrw = (EditCommandRequestWrapper) _request; - if (ecrw.getEditCommandRequest() instanceof MoveRequest) { - MoveRequest mr = (MoveRequest) ecrw.getEditCommandRequest(); - for (Object o : mr.getElementsToMove().keySet()) { - if (o instanceof Comment) { - return UnexecutableCommand.INSTANCE; - } - } - } - }// end - - if (_request instanceof CreateViewAndElementRequest) { - CreateViewAndElementRequest request = (CreateViewAndElementRequest) _request; - IElementType type = (IElementType) request - .getViewAndElementDescriptor() - .getCreateElementRequestAdapter().getAdapter( - IElementType.class); - if (type.equals(UMLElementTypes.Lifeline_2002)) { - CompoundCommand compoundCommand = new CompoundCommand( - "Create Lifeline and BES"); - compoundCommand.add(super.getCommand(request)); - compoundCommand.add(new ICommandProxy( - new CreateLifelineAndBESCommand(getEditingDomain(), - request.getViewAndElementDescriptor(), - getViewer()))); - return compoundCommand; - } - if (type.equals(UMLElementTypes.CombinedFragment_2004)) { - CompoundCommand compoundCommand = new CompoundCommand( - "Create Combined Fragment and send it to the back"); - compoundCommand.add(super.getCommand(request)); - compoundCommand.add(new ICommandProxy( - new ChangeZOrderOfCreatedEP(getEditingDomain(), request - .getViewAndElementDescriptor(), getViewer(), - ZOrderRequest.REQ_SEND_TO_BACK))); - return compoundCommand; - } - return super.getCommand(request); - } - - return super.getCommand(_request); - } - - /** - * @generated - */ - @Override - public Object getAdapter(Class adapter) { - if (adapter != null && adapter.equals(ViewAndFeatureResolver.class)) { - return this.resolver; - } - return super.getAdapter(adapter); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionInteractionCompartmentEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionInteractionCompartmentEditPart.java deleted file mode 100644 index 4ed83125544..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionInteractionCompartmentEditPart.java +++ /dev/null @@ -1,311 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.diagram.ui.requests.ZOrderRequest; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.ChangeZOrderOfCreatedEP; -import org.eclipse.papyrus.diagram.common.editpolicies.DragDropEditPolicy; -import org.eclipse.papyrus.diagram.common.editpolicies.ViewAndFeatureResolver; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CreateLifelineAndBESCommand; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionCompartmentXYLayoutEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionInteractionCompartmentCanonicalEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.InteractionInteractionCompartmentItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDiagramDragAndDropEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class InteractionInteractionCompartmentEditPart extends - ShapeCompartmentEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 5001; - - /** - * @generated NOT - */ - private final ViewAndFeatureResolver resolver = new ViewAndFeatureResolver() { - - /** - * generated NOT - */ - public boolean isEObjectNode(EObject element) { - if (element instanceof Interaction) { - // Check if is children - if (resolveSemanticElement().eContents().contains(element)) { - // check if there is no existing view of the children - if (DiagramEditPartsUtil.getEObjectViews(element).size() == 0) - return true; - } - } - return false; - } - - public boolean isEObjectLink(EObject element) { - return false; - } - - public int getEObjectSemanticHint(EObject element) { - if (element instanceof Interaction) { - return UMLVisualIDRegistry.getNodeVisualID(getNotationView(), - element); - } - return -1; - } - - public EStructuralFeature getEStructuralFeatureForEClass(EClass class1) { - return null; - } - }; - - /** - * @generated - */ - public InteractionInteractionCompartmentEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - public String getCompartmentName() { - return Messages.InteractionInteractionCompartmentEditPart_title; - } - - /** - * @generated - */ - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super - .createFigure(); - result.setTitleVisibility(false); - return result; - } - - /** - * Modified to install custom Drag&Drop policy. - * - * @author Gabriel Merin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new InteractionInteractionCompartmentItemSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, - new CreationEditPolicy()); - DragDropEditPolicy dragAndDropEditPolicy = null; - dragAndDropEditPolicy = new DragDropEditPolicy(resolver); - // modified to install custom Drag&Drop policy. - installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, - new SequenceDiagramDragAndDropEditPolicy(resolver)); - - installEditPolicy(EditPolicy.LAYOUT_ROLE, - new InteractionCompartmentXYLayoutEditPolicy()); - - installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, - new InteractionInteractionCompartmentCanonicalEditPolicy()); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - - if (notification.getNotifier() instanceof ShapeStyle) { - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) notification.getFeature(), - notification.getNewValue()); - ep.refresh(); - } - } - - } - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getInteraction_Fragment()); - features.add(UMLPackage.eINSTANCE.getInteraction_Lifeline()); - features.add(UMLPackage.eINSTANCE.getInteraction_Fragment()); - DiagramEditPartsUtil.handleNotificationForView(this, notification, - features); - } - - /** - * @generated - */ - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } - - /** - * When creating of a Lifeline a BES will be created too - * - * @generated-NOT - */ - @Override - public Command getCommand(Request _request) { - - // lets to create a CommentLink for an Activity by clicking in the - // Subvertices Compartment - if (_request instanceof CreateUnspecifiedTypeConnectionRequest) { - CreateUnspecifiedTypeConnectionRequest cutcr = (CreateUnspecifiedTypeConnectionRequest) _request; - String type = (String) cutcr.getType(); - IHintedType iet = (IHintedType) cutcr.getElementTypes().get(0); - String id = iet.getSemanticHint(); - - if (org.eclipse.gef.RequestConstants.REQ_CONNECTION_START - .equals(type) - && String.valueOf(ElementOwnedCommentEditPart.VISUAL_ID) - .equals(id)) { - if (cutcr.getTargetEditPart() instanceof InteractionInteractionCompartmentEditPart) - cutcr.setTargetEditPart(getParent()); - return getParent().getCommand(cutcr); - } else if (org.eclipse.gef.RequestConstants.REQ_CONNECTION_END - .equals(type) - && String.valueOf(ElementOwnedCommentEditPart.VISUAL_ID) - .equals(id)) { - if (cutcr.getSourceEditPart() instanceof InteractionInteractionCompartmentEditPart) - cutcr.setSourceEditPart(getParent()); - return getParent().getCommand(cutcr); - } - } - - // can create comments by clicking into the compartment - if (_request instanceof CreateUnspecifiedTypeRequest) { - CreateUnspecifiedTypeRequest cutr = (CreateUnspecifiedTypeRequest) _request; - String type = (String) cutr.getType(); - IHintedType iet = (IHintedType) cutr.getElementTypes().get(0); - String id = iet.getSemanticHint(); - - if (org.eclipse.gef.RequestConstants.REQ_CREATE.equals(type) - && (String.valueOf(CommentEditPart.VISUAL_ID).equals(id))) { - return org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil - .getDiagramEditPart(this).getCommand(_request); - } - } - // don't let to move a comment into a compartment - if (_request instanceof EditCommandRequestWrapper) { - EditCommandRequestWrapper ecrw = (EditCommandRequestWrapper) _request; - if (ecrw.getEditCommandRequest() instanceof MoveRequest) { - MoveRequest mr = (MoveRequest) ecrw.getEditCommandRequest(); - for (Object o : mr.getElementsToMove().keySet()) { - if (o instanceof Comment) { - return UnexecutableCommand.INSTANCE; - } - } - } - }// end - - if (_request instanceof CreateViewAndElementRequest) { - CreateViewAndElementRequest request = (CreateViewAndElementRequest) _request; - IElementType type = (IElementType) request - .getViewAndElementDescriptor() - .getCreateElementRequestAdapter().getAdapter( - IElementType.class); - if (type.equals(UMLElementTypes.Lifeline_2002)) { - CompoundCommand compoundCommand = new CompoundCommand( - "Create Lifeline and BES"); - compoundCommand.add(super.getCommand(request)); - compoundCommand.add(new ICommandProxy( - new CreateLifelineAndBESCommand(getEditingDomain(), - request.getViewAndElementDescriptor(), - getViewer()))); - return compoundCommand; - } - if (type.equals(UMLElementTypes.CombinedFragment_2004)) { - CompoundCommand compoundCommand = new CompoundCommand( - "Create Combined Fragment and send it to the back"); - compoundCommand.add(super.getCommand(request)); - compoundCommand.add(new ICommandProxy( - new ChangeZOrderOfCreatedEP(getEditingDomain(), request - .getViewAndElementDescriptor(), getViewer(), - ZOrderRequest.REQ_SEND_TO_BACK))); - return compoundCommand; - } - return super.getCommand(request); - } - - return super.getCommand(_request); - } - - /** - * @generated - */ - @Override - public Object getAdapter(Class adapter) { - if (adapter != null && adapter.equals(ViewAndFeatureResolver.class)) { - return this.resolver; - } - return super.getAdapter(adapter); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionName2EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionName2EditPart.java deleted file mode 100644 index 7aa062598a0..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionName2EditPart.java +++ /dev/null @@ -1,631 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2007-2008 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 - * Javier Muñoz (Prodevelop) – Label italized when classifier is abstract - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.NonResizableHandleKit; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class InteractionName2EditPart extends CompartmentEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4003; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - public InteractionName2EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, - new NonResizableEditPolicy() { - - protected List createSelectionHandles() { - List handles = new ArrayList(); - NonResizableHandleKit.addMoveHandle( - (GraphicalEditPart) getHost(), handles); - return handles; - } - - public Command getCommand(Request request) { - return null; - } - - public boolean understandsRequest(Request request) { - return false; - } - }); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Interaction_2001, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated not - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - - fontData.setStyle(isAbstract() ? SWT.ITALIC | fontData.getStyle() - : (~SWT.ITALIC) & fontData.getStyle()); - setFont(fontData); - } else if (this.getFigure() != null - && this.getFigure().getFont() != null - && this.getFigure().getFont().getFontData().length > 0) { - FontData fontData = this.getFigure().getFont().getFontData()[0]; - fontData.setStyle(isAbstract() ? SWT.ITALIC | fontData.getStyle() - : (~SWT.ITALIC) & fontData.getStyle()); - setFont(fontData); - } - } - - private boolean isAbstract() { - if (this.resolveSemanticElement() instanceof Classifier) { - return ((Classifier) this.resolveSemanticElement()).isAbstract(); - } - return false; - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated not - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else if (feature == UMLPackage.eINSTANCE.getClassifier_IsAbstract()) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionNameEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionNameEditPart.java deleted file mode 100644 index 561abfd4184..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/InteractionNameEditPart.java +++ /dev/null @@ -1,630 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2007-2008 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 - * Javier Muñoz (Prodevelop) – Label italized when classifier is abstract - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.NonResizableHandleKit; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class InteractionNameEditPart extends CompartmentEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4004; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - public InteractionNameEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, - new NonResizableEditPolicy() { - - protected List createSelectionHandles() { - List handles = new ArrayList(); - NonResizableHandleKit.addMoveHandle( - (GraphicalEditPart) getHost(), handles); - return handles; - } - - public Command getCommand(Request request) { - return null; - } - - public boolean understandsRequest(Request request) { - return false; - } - }); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Interaction_1001, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated not - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - fontData.setStyle(isAbstract() ? SWT.ITALIC | fontData.getStyle() - : (~SWT.ITALIC) & fontData.getStyle()); - setFont(fontData); - } else if (this.getFigure() != null - && this.getFigure().getFont() != null - && this.getFigure().getFont().getFontData().length > 0) { - FontData fontData = this.getFigure().getFont().getFontData()[0]; - fontData.setStyle(isAbstract() ? SWT.ITALIC | fontData.getStyle() - : (~SWT.ITALIC) & fontData.getStyle()); - setFont(fontData); - } - } - - private boolean isAbstract() { - if (this.resolveSemanticElement() instanceof Classifier) { - return ((Classifier) this.resolveSemanticElement()).isAbstract(); - } - return false; - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated not - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else if (feature == UMLPackage.eINSTANCE.getClassifier_IsAbstract()) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/LifelineEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/LifelineEditPart.java deleted file mode 100644 index 309b0ef6354..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/LifelineEditPart.java +++ /dev/null @@ -1,878 +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.parts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.BorderLayout; -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.draw2d.XYLayout; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.draw2d.geometry.PrecisionPoint; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.PopupBarEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.IPolygonAnchorableFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.DestructionEvent; -import org.eclipse.uml2.uml.InteractionFragment; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.MessageOccurrenceSpecification; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.AnnotateNodeStyleCommand; -import org.eclipse.papyrus.diagram.common.commands.PreserveAnchorsPositionCommand; -import org.eclipse.papyrus.diagram.common.commands.ReconnectToIntersectionPoints; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.draw2d.LifelineDotLineFigure; -import org.eclipse.papyrus.diagram.common.editparts.PrimaryShapeEditPart; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageOrderCommand; -import org.eclipse.papyrus.diagram.sequence.edit.policies.LifelineCanonicalEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.LifelineItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.LifelineXYLayoutEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class LifelineEditPart extends ShapeNodeEditPart implements - PrimaryShapeEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 2002; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public LifelineEditPart(View view) { - super(view); - } - - /** - * This is to modify the feedback if anchors are going to be preserved - * - * @author gmerin - * @NOT-generated - */ - @Override - public void showSourceFeedback(Request request) { - super.showSourceFeedback(PreserveAnchorsPositionCommand - .getNewSourceFeedbackRequest(request, this)); - } - - /** - * This operation returns the BES EditParts contained in the Lifeline - * EditPart - * - * @author gmerin - * @NOT-generated - * @return the list of BES EditParts - */ - public List<BehaviorExecutionSpecificationEditPart> getBESList() { - List<BehaviorExecutionSpecificationEditPart> besList = new ArrayList<BehaviorExecutionSpecificationEditPart>(); - for (Object obj : getChildren()) { - if (obj instanceof BehaviorExecutionSpecificationEditPart) { - besList.add((BehaviorExecutionSpecificationEditPart) obj); - } - - } - return besList; - } - - /** - * @generated NOT - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - - // Check if exists any MessageOccurrenceSpecification covered by this - // Lifeline and with a DestructionEvent - Lifeline lifeline = (Lifeline) this.resolveSemanticElement(); - if (lifeline == null) { - return; - } - EList<InteractionFragment> list = lifeline.getCoveredBys(); - boolean drawCrossAtEnd = false; - for (InteractionFragment fragment : list) { - if (fragment instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification msg = (MessageOccurrenceSpecification) fragment; - if ((msg.getEvent() != null) - && (msg.getEvent() instanceof DestructionEvent)) - drawCrossAtEnd = true; - } - } - this.getPrimaryShape().getFigureDotLineFigure().setCrossAtEnd( - drawCrossAtEnd); - } - - /** - * @author Gabriel Merin - * @generated NOT - */ - @Override - protected void handleNotificationEvent(Notification notification) { - if (notification.getNotifier() == getModel() - && EcorePackage.eINSTANCE.getEModelElement_EAnnotations() - .equals(notification.getFeature())) { - handleMajorSemanticChange(); - } else if (notification.getNotifier() instanceof ShapeStyle) { - super.handleNotificationEvent(notification); - - // Propagate style - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (!(obj instanceof GraphicalEditPart)) - continue; - GraphicalEditPart ep = (GraphicalEditPart) obj; - - if (ep.resolveSemanticElement() != resolveSemanticElement()) - continue; - - ShapeStyle style = (ShapeStyle) ((View) ep.getModel()) - .getStyle(NotationPackage.eINSTANCE.getShapeStyle()); - if (style != null) { - style.eSet((EStructuralFeature) notification.getFeature(), - notification.getNewValue()); - ep.refresh(); - } - } - - } - - else { - super.handleNotificationEvent(notification); - } - - // Added code - if (notification.getNewValue() instanceof MessageOccurrenceSpecification) { - MessageOccurrenceSpecification msgNew = (MessageOccurrenceSpecification) notification - .getNewValue(); - if (msgNew.getEvent() instanceof DestructionEvent) { - // If the MessageOccurrenceSpecification is covered by this - // Lifeline, set the cross at the end of the Lifeline - if (msgNew.getCovereds() - .contains(this.resolveSemanticElement())) { - refreshVisuals(); - } - } - } - - if (notification.getOldValue() instanceof MessageOccurrenceSpecification) { - refreshVisuals(); - } - // end added code - - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - features.add(UMLPackage.eINSTANCE.getElement_OwnedComment()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - - /** - * @author Gabriel Merin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - installEditPolicy(EditPolicyRoles.CREATION_ROLE, - new CreationEditPolicy()); - - // super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new GraphicalNodeEditPolicy()); - - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new LifelineItemSemanticEditPolicy()); - // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies. - // EditPolicyRoles.DRAG_DROP_ROLE, - // new - //org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, - new LifelineCanonicalEditPolicy()); - // installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - // Changed policy - installEditPolicy(EditPolicy.LAYOUT_ROLE, - new LifelineXYLayoutEditPolicy()); - - // Added by gmerin to have a BES shortcut on Lifelines - installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, - new PopupBarEditPolicy()); - } - - /** - * @generated - */ - protected LayoutEditPolicy createLayoutEditPolicy() { - LayoutEditPolicy lep = new LayoutEditPolicy() { - - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child - .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - LifelineFigure figure = new LifelineFigure(); - return primaryShape = figure; - } - - /** - * @generated - */ - public LifelineFigure getPrimaryShape() { - return (LifelineFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof LifelineNameEditPart) { - ((LifelineNameEditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureLifelineLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated NOT - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - - if (editPart instanceof BehaviorExecutionSpecificationEditPart) { - return getPrimaryShape().getFigureDotLineFigure(); - } - - return super.getContentPaneFor(editPart); - } - - /** - * @generated NOT - */ - protected NodeFigure createNodePlate() { - LifelineNodeFigure result = new LifelineNodeFigure(getMapMode().DPtoLP( - 100), getMapMode().DPtoLP(250)); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model so - * you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createNodeFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - /** - * Default implementation treats passed figure as content pane. Respects - * layout one may have set for generated figure. - * - * @param nodeShape - * instance of generated figure class - * @generated NOT - */ - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(getMapMode().DPtoLP(5)); - nodeShape.setLayoutManager(layout); - } - - if (nodeShape instanceof LifelineFigure) { - LifelineFigure lFigure = (LifelineFigure) nodeShape; - return lFigure.getFigureDotLineFigure(); - } - - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry - .getType(LifelineNameEditPart.VISUAL_ID)); - } - - /** - * @NOT-generated - */ - @Override - public Command getCommand(Request _request) { - // can create comments by clicking into the compartment - if (_request instanceof CreateUnspecifiedTypeRequest) { - CreateUnspecifiedTypeRequest cutr = (CreateUnspecifiedTypeRequest) _request; - String type = (String) cutr.getType(); - IHintedType iet = (IHintedType) cutr.getElementTypes().get(0); - String id = iet.getSemanticHint(); - - // To allow creation of Comments over a Lifeline - if (RequestConstants.REQ_CREATE.equals(type) - && (String.valueOf(CommentEditPart.VISUAL_ID).equals(id))) { - return org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil - .getDiagramEditPart(this).getCommand(_request); - } - - // To allow creation of CombinedFragments over a Lifeline - if (RequestConstants.REQ_CREATE.equals(type) - && (String.valueOf(CombinedFragmentEditPart.VISUAL_ID) - .equals(id))) { - return this.getParent().getCommand(_request); - } - }// end - - if (_request instanceof CreateConnectionViewAndElementRequest) { - - CreateConnectionViewAndElementRequest createViewAndElemReq = (CreateConnectionViewAndElementRequest) _request; - - // Only order Message connections - if (!MessageCommonUtil.isMessageEditPart(createViewAndElemReq - .getConnectionViewDescriptor().getSemanticHint())) - return super.getCommand(_request); - - CompoundCommand ccommand = new CompoundCommand(); - - // Needed to add the start command to the request - ccommand.add(super.getCommand(_request)); - - // Check if there is another element at the same point - if (!MessageCommonUtil.checkFreeConnectionEnds(_request)) { - return null; - } - - // Add a command to swap between created anchors (points where the - // user clicked and dropped the connection) with the real - // intersection points - ccommand - .add(new ReconnectToIntersectionPoints(createViewAndElemReq)); - - // Creation of the ordering command - MessageOrderCommand msgOrderCmd = new MessageOrderCommand( - createViewAndElemReq); - ccommand.add(msgOrderCmd); - - return ccommand; - } - - if (_request instanceof ReconnectRequest) { - - ReconnectRequest reconnReq = (ReconnectRequest) _request; - - // Only order Message connections - if (!MessageCommonUtil.isMessageEditPart(reconnReq - .getConnectionEditPart())) - return super.getCommand(_request); - - CompoundCommand ccommand = new CompoundCommand(); - - // Check if there is another element at the same point and - if (!MessageCommonUtil.checkFreeConnectionEnds(_request)) { - return null; - } - - // Modify the request with the real target anchoring point instead - // of target mouse reference point - ReconnectToIntersectionPoints.modifyLocation(reconnReq); - - // Create the commands with the real target anchoring point - ccommand.add(super.getCommand(_request)); - - // Creation of the ordering command - MessageOrderCommand msgOrderCmd = new MessageOrderCommand(reconnReq); - ccommand.add(msgOrderCmd); - - return ccommand; - } - - return super.getCommand(_request); - } - - /** - * @NOT-generated - */ - public class LifelineNodeFigure extends DefaultSizeNodeFigure implements - IPolygonAnchorableFigure { - - public LifelineNodeFigure(Dimension defSize) { - super(defSize.width, defSize.height); - } - - public LifelineNodeFigure(int width, int height) { - super(width, height); - } - - @Override - public PointList getPolygonPoints() { - PointList polygonList = new PointList(); - - Rectangle r = getBounds(); - - Point pStart = new Point(); - Point pEnd = new Point(); - - pStart.x = r.x + r.width / 2; - pStart.y = r.y + 1; - - pEnd.x = pStart.x; - pEnd.y = pStart.y + r.height - 1; - - polygonList.addPoint(pStart); - polygonList.addPoint(pEnd); - - return polygonList; - } - - @Override - protected boolean isDefaultAnchorArea(PrecisionPoint p) { - // We don't want a default anchor area for the Lifeline Node Figure. - return false; - } - - } - - /** - * @generated - */ - public class LifelineFigure extends RectangleFigure { - - /** - * @generated - */ - private WrappingLabel fFigureLifelineLabelFigure; - /** - * @generated - */ - private RectangleFigure fFigureExecutionsContainerFigure; - - /** - * @generated - */ - public LifelineFigure() { - - BorderLayout layoutThis = new BorderLayout(); - this.setLayoutManager(layoutThis); - - this.setFill(false); - this.setOutline(false); - this.setPreferredSize(new Dimension(getMapMode().DPtoLP(100), - getMapMode().DPtoLP(200))); - createContents(); - } - - /** - * @generated NOT - */ - private void createContents() { - - RectangleFigure lifelineNameContainerFigure0 = new RectangleFigure(); - lifelineNameContainerFigure0 - .setForegroundColor(ColorConstants.black); - lifelineNameContainerFigure0 - .setBackgroundColor(LIFELINENAMECONTAINERFIGURE0_BACK); - - this.add(lifelineNameContainerFigure0, BorderLayout.TOP); - - lifelineNameContainerFigure0.setLayoutManager(new StackLayout()); - - fFigureLifelineLabelFigure = new WrapLabel(); - fFigureLifelineLabelFigure.setText("Lifeline"); - - fFigureLifelineLabelFigure.setBorder(new MarginBorder(getMapMode() - .DPtoLP(7), getMapMode().DPtoLP(7), getMapMode().DPtoLP(7), - getMapMode().DPtoLP(7))); - - fFigureLifelineLabelFigure.setFont(FFIGURELIFELINELABELFIGURE_FONT); - - lifelineNameContainerFigure0.add(fFigureLifelineLabelFigure); - - fFigureExecutionsContainerFigure = new RectangleFigure(); - fFigureExecutionsContainerFigure.setOutline(false); - fFigureExecutionsContainerFigure.setFill(false); - - this.add(fFigureExecutionsContainerFigure, BorderLayout.CENTER); - - fFigureExecutionsContainerFigure - .setLayoutManager(new StackLayout()); - - LifelineDotLineFigure lifelineLineFigure1 = new LifelineDotLineFigure(); - // test - lifelineLineFigure1.setLayoutManager(new XYLayout()); - - fFigureExecutionsContainerFigure.add(lifelineLineFigure1); - - // added - // lifelineLineFigure1.setLayoutManager(new XYLayout()); - setFigureDotLineFigure(lifelineLineFigure1); - - fFigureExecutionsContainerFigure.add(lifelineLineFigure1); - - } - - /** - * @generated NOT - */ - private LifelineDotLineFigure fLifelinDotLineFigure; - - /** - * @generated NOT - */ - public void setFigureDotLineFigure(LifelineDotLineFigure dlFigure) { - fLifelinDotLineFigure = dlFigure; - } - - /** - * @generated NOT - */ - public LifelineDotLineFigure getFigureDotLineFigure() { - return fLifelinDotLineFigure; - } - - /** - * @generated - */ - private boolean myUseLocalCoordinates = false; - - /** - * @generated - */ - @Override - protected boolean useLocalCoordinates() { - return myUseLocalCoordinates; - } - - /** - * @generated - */ - protected void setUseLocalCoordinates(boolean useLocalCoordinates) { - myUseLocalCoordinates = useLocalCoordinates; - } - - /** - * @generated - */ - public WrappingLabel getFigureLifelineLabelFigure() { - return fFigureLifelineLabelFigure; - } - - /** - * @generated - */ - public RectangleFigure getFigureExecutionsContainerFigure() { - return fFigureExecutionsContainerFigure; - } - - } - - /** - * @generated - */ - static final Color LIFELINENAMECONTAINERFIGURE0_BACK = new Color(null, 253, - 253, 221); - - /** - * @generated - */ - static final Font FFIGURELIFELINELABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 10, SWT.BOLD); - - /** - * @generated - */ - protected EAnnotation getAppearenceEAnnotation() { - EAnnotation eAnn = getPrimaryView().getEAnnotation( - AnnotateNodeStyleCommand.APPEARANCE_EANNOTATION_NAME); - return eAnn; - } - - /** - * @generated - */ - private List<EObject> changesFromDefaultStyle() { - EAnnotation eAnn = getAppearenceEAnnotation(); - if (eAnn == null) - return new ArrayList<EObject>(); - else - return eAnn.getReferences(); - } - - /** - * @generated - */ - public static boolean isLabel(IFigure figure) { - if (figure instanceof Label) { - return true; - } - if (figure instanceof WrappingLabel) { - return true; - } - return false; - } - - /** - * @generated - */ - protected boolean isFigureFromChildEditPart(IFigure figure) { - for (Iterator i = getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof AbstractGraphicalEditPart) { - AbstractGraphicalEditPart gEP = (AbstractGraphicalEditPart) obj; - if (gEP.getFigure() == figure) { - // Check if semantic elements are different - if (gEP instanceof GraphicalEditPart - && ((GraphicalEditPart) gEP) - .resolveSemanticElement() == resolveSemanticElement()) { - return false; - } - return true; - } else { - // Check if it is a child figure of the editpart - for (java.lang.Object child : gEP.getChildren()) { - if (child instanceof GraphicalEditPart) { - GraphicalEditPart childEP = (GraphicalEditPart) child; - if (childEP.getFigure() == figure) { - if (childEP.resolveSemanticElement() != resolveSemanticElement()) - return true; - else - return false; - } - } - } - } // end else - } - } - return false; - } - - /** - * @generated - */ - @Override - protected void setBackgroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.FILL_STYLE__FILL_COLOR)) { - setOwnedFiguresBackgroundColor(getFigure(), color); - } else - super.setBackgroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresBackgroundColor(IFigure parent, Color color) { - parent.setBackgroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresBackgroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresForegroundColor(getFigure(), color); - } else - super.setForegroundColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresForegroundColor(IFigure parent, Color color) { - if (!isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof IFigure && !isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresForegroundColor((IFigure) obj, color); - } - } - } - - /** - * @generated - */ - - @Override - protected void setFontColor(Color color) { - // Only update if the Node doesn't have the default style - if (changesFromDefaultStyle().contains( - NotationPackage.Literals.LINE_STYLE__LINE_COLOR)) { - setOwnedFiguresFontColor(getFigure(), color); - } else - super.setFontColor(color); - - } - - /** - * @generated - */ - public void setOwnedFiguresFontColor(IFigure parent, Color color) { - if (isLabel(parent)) - parent.setForegroundColor(color); - for (Iterator i = parent.getChildren().iterator(); i.hasNext();) { - Object obj = i.next(); - if (obj instanceof IFigure && isLabel((IFigure) obj) - && !isFigureFromChildEditPart((IFigure) obj)) { - setOwnedFiguresFontColor((IFigure) obj, color); - } - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/LifelineNameEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/LifelineNameEditPart.java deleted file mode 100644 index 27d87b6eac6..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/LifelineNameEditPart.java +++ /dev/null @@ -1,638 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.NonResizableHandleKit; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class LifelineNameEditPart extends CompartmentEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4001; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - public LifelineNameEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, - new NonResizableEditPolicy() { - - protected List createSelectionHandles() { - List handles = new ArrayList(); - NonResizableHandleKit.addMoveHandle( - (GraphicalEditPart) getHost(), handles); - return handles; - } - - public Command getCommand(Request request) { - return null; - } - - public boolean understandsRequest(Request request) { - return false; - } - }); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Lifeline_2002, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @author Javier Muñoz - * @generated NOT - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - refreshParentLifelineBounds(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - - // Lined added - refreshParentLifelineBounds(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @author Javier Muñoz - * @NOT-generated - */ - private void refreshParentLifelineBounds() { - Dimension labelPreferedDimension = this.getFigure().getPreferredSize(); - Dimension labelDimension = this.getFigure().getSize(); - - int widthDelta = labelPreferedDimension.width - labelDimension.width; - - ChangeBoundsRequest request = new ChangeBoundsRequest( - org.eclipse.gef.RequestConstants.REQ_RESIZE); - request.setResizeDirection(PositionConstants.EAST); - request.setSizeDelta(new Dimension(widthDelta, 0)); - request.setMoveDelta(new Point(0, 0)); - request.setEditParts(this.getParent()); - - Command command = ((IGraphicalEditPart) this.getParent()) - .getCommand(request); - super.executeCommand(command); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message2EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message2EditPart.java deleted file mode 100644 index 5039538cf4b..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message2EditPart.java +++ /dev/null @@ -1,228 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.PolylineDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.Message2ItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class Message2EditPart extends ConnectionNodeEditPart implements - ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3002; - - /** - * @generated - */ - public Message2EditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new Message2ItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - Message2EditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof MessageName2EditPart) { - ((MessageName2EditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureMessageAsyncLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new CallAsync(); - } - - /** - * @generated - */ - public CallAsync getPrimaryShape() { - return (CallAsync) getFigure(); - } - - /** - * @generated - */ - public class CallAsync extends PolylineConnectionEx { - - /** - * @generated - */ - private WrappingLabel fFigureMessageAsyncLabelFigure; - - /** - * @generated - */ - public CallAsync() { - this.setForegroundColor(ColorConstants.black); - - createContents(); - setTargetDecoration(createTargetDecoration()); - } - - /** - * @generated - */ - private void createContents() { - - fFigureMessageAsyncLabelFigure = new WrappingLabel(); - fFigureMessageAsyncLabelFigure.setText(""); - - fFigureMessageAsyncLabelFigure - .setFont(FFIGUREMESSAGEASYNCLABELFIGURE_FONT); - - this.add(fFigureMessageAsyncLabelFigure); - - } - - /** - * @generated - */ - private RotatableDecoration createTargetDecoration() { - PolylineDecoration df = new PolylineDecoration(); - df.setForegroundColor(ColorConstants.black); - PointList pl = new PointList(); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2)); - df.setTemplate(pl); - df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); - return df; - } - - /** - * @generated - */ - public WrappingLabel getFigureMessageAsyncLabelFigure() { - return fFigureMessageAsyncLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREMESSAGEASYNCLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @author jmunoz - * @generated NOT - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - features.add(UMLPackage.eINSTANCE.getElement_Owner()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedElement()); - features.add(UMLPackage.eINSTANCE.getMessage_MessageSort()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message3EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message3EditPart.java deleted file mode 100644 index 8ba3e65df5e..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message3EditPart.java +++ /dev/null @@ -1,245 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.PolylineDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.Message3ItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class Message3EditPart extends ConnectionNodeEditPart implements - ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3003; - - /** - * @generated - */ - public Message3EditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new Message3ItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - Message3EditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof MessageName3EditPart) { - ((MessageName3EditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureMessageReplyLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new Reply(); - } - - /** - * @generated - */ - public Reply getPrimaryShape() { - return (Reply) getFigure(); - } - - /** - * @generated - */ - public class Reply extends PolylineConnectionEx { - - /** - * @generated - */ - private WrappingLabel fFigureMessageReplyLabelFigure; - - /** - * @generated - */ - public Reply() { - this.setLineStyle(Graphics.LINE_DASH); - this.setForegroundColor(ColorConstants.black); - - createContents(); - setTargetDecoration(createTargetDecoration()); - } - - /** - * @NOT-generated - */ - @Override - protected void outlineShape(Graphics g) { - int[] dashes = new int[1]; - dashes[0] = 6; - - g.setLineStyle(Graphics.LINE_DASH); - g.setLineDash(dashes); - g.setForegroundColor(ColorConstants.black); - - super.outlineShape(g); - } - - /** - * @generated - */ - private void createContents() { - - fFigureMessageReplyLabelFigure = new WrappingLabel(); - fFigureMessageReplyLabelFigure.setText(""); - - fFigureMessageReplyLabelFigure - .setFont(FFIGUREMESSAGEREPLYLABELFIGURE_FONT); - - this.add(fFigureMessageReplyLabelFigure); - - } - - /** - * @generated - */ - private RotatableDecoration createTargetDecoration() { - PolylineDecoration df = new PolylineDecoration(); - df.setForegroundColor(ColorConstants.black); - PointList pl = new PointList(); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2)); - df.setTemplate(pl); - df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); - return df; - } - - /** - * @generated - */ - public WrappingLabel getFigureMessageReplyLabelFigure() { - return fFigureMessageReplyLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREMESSAGEREPLYLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @author jmunoz - * @generated NOT - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - features.add(UMLPackage.eINSTANCE.getElement_Owner()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedElement()); - features.add(UMLPackage.eINSTANCE.getMessage_MessageSort()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message4EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message4EditPart.java deleted file mode 100644 index 4828c408951..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message4EditPart.java +++ /dev/null @@ -1,228 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.PolylineDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.Message4ItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class Message4EditPart extends ConnectionNodeEditPart implements - ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3004; - - /** - * @generated - */ - public Message4EditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new Message4ItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - Message4EditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof MessageName4EditPart) { - ((MessageName4EditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureMessageSignalLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new Signal(); - } - - /** - * @generated - */ - public Signal getPrimaryShape() { - return (Signal) getFigure(); - } - - /** - * @generated - */ - public class Signal extends PolylineConnectionEx { - - /** - * @generated - */ - private WrappingLabel fFigureMessageSignalLabelFigure; - - /** - * @generated - */ - public Signal() { - this.setForegroundColor(ColorConstants.black); - - createContents(); - setTargetDecoration(createTargetDecoration()); - } - - /** - * @generated - */ - private void createContents() { - - fFigureMessageSignalLabelFigure = new WrappingLabel(); - fFigureMessageSignalLabelFigure.setText(""); - - fFigureMessageSignalLabelFigure - .setFont(FFIGUREMESSAGESIGNALLABELFIGURE_FONT); - - this.add(fFigureMessageSignalLabelFigure); - - } - - /** - * @generated - */ - private RotatableDecoration createTargetDecoration() { - PolylineDecoration df = new PolylineDecoration(); - df.setForegroundColor(ColorConstants.black); - PointList pl = new PointList(); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2)); - df.setTemplate(pl); - df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); - return df; - } - - /** - * @generated - */ - public WrappingLabel getFigureMessageSignalLabelFigure() { - return fFigureMessageSignalLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREMESSAGESIGNALLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @author jmunoz - * @generated NOT - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - features.add(UMLPackage.eINSTANCE.getElement_Owner()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedElement()); - features.add(UMLPackage.eINSTANCE.getMessage_MessageSort()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message5EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message5EditPart.java deleted file mode 100644 index 100e4208b43..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message5EditPart.java +++ /dev/null @@ -1,228 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.PolylineDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.Message5ItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class Message5EditPart extends ConnectionNodeEditPart implements - ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3005; - - /** - * @generated - */ - public Message5EditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new Message5ItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - Message5EditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof MessageName5EditPart) { - ((MessageName5EditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureMessageCreationLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new Creation(); - } - - /** - * @generated - */ - public Creation getPrimaryShape() { - return (Creation) getFigure(); - } - - /** - * @generated - */ - public class Creation extends PolylineConnectionEx { - - /** - * @generated - */ - private WrappingLabel fFigureMessageCreationLabelFigure; - - /** - * @generated - */ - public Creation() { - this.setForegroundColor(ColorConstants.black); - - createContents(); - setTargetDecoration(createTargetDecoration()); - } - - /** - * @generated - */ - private void createContents() { - - fFigureMessageCreationLabelFigure = new WrappingLabel(); - fFigureMessageCreationLabelFigure.setText(""); - - fFigureMessageCreationLabelFigure - .setFont(FFIGUREMESSAGECREATIONLABELFIGURE_FONT); - - this.add(fFigureMessageCreationLabelFigure); - - } - - /** - * @generated - */ - private RotatableDecoration createTargetDecoration() { - PolylineDecoration df = new PolylineDecoration(); - df.setForegroundColor(ColorConstants.black); - PointList pl = new PointList(); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2)); - df.setTemplate(pl); - df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); - return df; - } - - /** - * @generated - */ - public WrappingLabel getFigureMessageCreationLabelFigure() { - return fFigureMessageCreationLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREMESSAGECREATIONLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @author jmunoz - * @generated NOT - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - features.add(UMLPackage.eINSTANCE.getElement_Owner()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedElement()); - features.add(UMLPackage.eINSTANCE.getMessage_MessageSort()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message6EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message6EditPart.java deleted file mode 100644 index ecca4058eca..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/Message6EditPart.java +++ /dev/null @@ -1,226 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.PolylineDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.Message6ItemSemanticEditPolicy; - -/** - * @generated - */ -public class Message6EditPart extends ConnectionNodeEditPart implements - ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3006; - - /** - * @generated - */ - public Message6EditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new Message6ItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new DeleteOnlyViewComponentEditPolicy()); - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - Message6EditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof MessageName6EditPart) { - ((MessageName6EditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureMessageDestructionLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new Destruction(); - } - - /** - * @generated - */ - public Destruction getPrimaryShape() { - return (Destruction) getFigure(); - } - - /** - * @generated - */ - public class Destruction extends PolylineConnectionEx { - - /** - * @generated - */ - private WrappingLabel fFigureMessageDestructionLabelFigure; - - /** - * @generated - */ - public Destruction() { - this.setForegroundColor(ColorConstants.black); - - createContents(); - setTargetDecoration(createTargetDecoration()); - } - - /** - * @generated - */ - private void createContents() { - - fFigureMessageDestructionLabelFigure = new WrappingLabel(); - fFigureMessageDestructionLabelFigure.setText(""); - - fFigureMessageDestructionLabelFigure - .setFont(FFIGUREMESSAGEDESTRUCTIONLABELFIGURE_FONT); - - this.add(fFigureMessageDestructionLabelFigure); - - } - - /** - * @generated - */ - private RotatableDecoration createTargetDecoration() { - PolylineDecoration df = new PolylineDecoration(); - df.setForegroundColor(ColorConstants.black); - PointList pl = new PointList(); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2)); - df.setTemplate(pl); - df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); - return df; - } - - /** - * @generated - */ - public WrappingLabel getFigureMessageDestructionLabelFigure() { - return fFigureMessageDestructionLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREMESSAGEDESTRUCTIONLABELFIGURE_FONT = new Font( - Display.getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @author jmunoz - * @generated NOT - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - features.add(UMLPackage.eINSTANCE.getElement_Owner()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedElement()); - features.add(UMLPackage.eINSTANCE.getMessage_MessageSort()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageEditPart.java deleted file mode 100644 index a6fc8658755..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageEditPart.java +++ /dev/null @@ -1,238 +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.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.PolygonDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.commands.RemoveEObjectReferencesFromDiagram; -import org.eclipse.papyrus.diagram.common.editpolicies.DeleteOnlyViewComponentEditPolicy; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.policies.MessageItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDeleteOnlyViewComponentEditPolicy; - -/** - * @generated - */ -public class MessageEditPart extends ConnectionNodeEditPart implements - ITreeBranchEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 3001; - - /** - * @generated - */ - public MessageEditPart(View view) { - super(view); - } - - /** - * @author gmerin - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new MessageItemSemanticEditPolicy()); - // ** install new ComponentEditPolicy - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new SequenceDeleteOnlyViewComponentEditPolicy()); // changed by - // gmerin - // ** install new ConnectionEditPolicy - installEditPolicy(EditPolicy.CONNECTION_ROLE, - new ConnectionEditPolicy() { - @Override - protected boolean shouldDeleteSemantic() { - return false; - } - - @Override - protected Command createDeleteViewCommand( - GroupRequest deleteRequest) { - Command command = super - .createDeleteViewCommand(deleteRequest); - command = command - .chain(new ICommandProxy( - new RemoveEObjectReferencesFromDiagram( - getEditingDomain(), - MessageEditPart.this - .getDiagramView(), - Collections - .singletonList(resolveSemanticElement())))); - return command; - } - }); - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof MessageNameEditPart) { - ((MessageNameEditPart) childEditPart).setLabel(getPrimaryShape() - .getFigureMessageSyncLabelFigure()); - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - - @Override - protected Connection createConnectionFigure() { - return new CallSync(); - } - - /** - * @generated - */ - public CallSync getPrimaryShape() { - return (CallSync) getFigure(); - } - - @Override - public Command getCommand(Request _request) { - // TODO Auto-generated method stub - return super.getCommand(_request); - } - - /** - * @generated - */ - public class CallSync extends PolylineConnectionEx { - - /** - * @generated - */ - private WrappingLabel fFigureMessageSyncLabelFigure; - - /** - * @generated - */ - public CallSync() { - this.setForegroundColor(ColorConstants.black); - - createContents(); - setTargetDecoration(createTargetDecoration()); - } - - /** - * @generated - */ - private void createContents() { - - fFigureMessageSyncLabelFigure = new WrappingLabel(); - fFigureMessageSyncLabelFigure.setText(""); - - fFigureMessageSyncLabelFigure - .setFont(FFIGUREMESSAGESYNCLABELFIGURE_FONT); - - this.add(fFigureMessageSyncLabelFigure); - - } - - /** - * @generated - */ - private RotatableDecoration createTargetDecoration() { - PolygonDecoration df = new PolygonDecoration(); - df.setFill(true); - df.setForegroundColor(ColorConstants.black); - df.setBackgroundColor(ColorConstants.black); - PointList pl = new PointList(); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2)); - pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2)); - df.setTemplate(pl); - df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); - return df; - } - - /** - * @generated - */ - public WrappingLabel getFigureMessageSyncLabelFigure() { - return fFigureMessageSyncLabelFigure; - } - - } - - /** - * @generated - */ - static final Font FFIGUREMESSAGESYNCLABELFIGURE_FONT = new Font(Display - .getCurrent(), "SANS", 9, SWT.NORMAL); - - /** - * @author jmunoz - * @generated NOT - */ - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(); - - features.add(UMLPackage.eINSTANCE.getElement_Owner()); - features.add(UMLPackage.eINSTANCE.getElement_OwnedElement()); - features.add(UMLPackage.eINSTANCE.getMessage_MessageSort()); - DiagramEditPartsUtil.handleNotificationForDiagram(this, notification, - features); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName2EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName2EditPart.java deleted file mode 100644 index ef315b01432..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName2EditPart.java +++ /dev/null @@ -1,588 +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.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class MessageName2EditPart extends LabelEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4006; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry - .getType(org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName2EditPart.VISUAL_ID), - new Point(1, -13)); - } - - /** - * @generated - */ - public MessageName2EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - } - - /** - * @generated - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3002, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName3EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName3EditPart.java deleted file mode 100644 index 6e5805dadf7..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName3EditPart.java +++ /dev/null @@ -1,588 +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.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class MessageName3EditPart extends LabelEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4007; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry - .getType(org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName3EditPart.VISUAL_ID), - new Point(1, -13)); - } - - /** - * @generated - */ - public MessageName3EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - } - - /** - * @generated - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3003, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName4EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName4EditPart.java deleted file mode 100644 index 89560ea9a1e..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName4EditPart.java +++ /dev/null @@ -1,588 +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.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class MessageName4EditPart extends LabelEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4008; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry - .getType(org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName4EditPart.VISUAL_ID), - new Point(1, -13)); - } - - /** - * @generated - */ - public MessageName4EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - } - - /** - * @generated - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3004, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName5EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName5EditPart.java deleted file mode 100644 index 33c04ad5e38..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName5EditPart.java +++ /dev/null @@ -1,588 +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.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class MessageName5EditPart extends LabelEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4009; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry - .getType(org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName5EditPart.VISUAL_ID), - new Point(1, -13)); - } - - /** - * @generated - */ - public MessageName5EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - } - - /** - * @generated - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3005, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName6EditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName6EditPart.java deleted file mode 100644 index 5cff41cd592..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageName6EditPart.java +++ /dev/null @@ -1,588 +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.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class MessageName6EditPart extends LabelEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4010; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry - .getType(org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName6EditPart.VISUAL_ID), - new Point(1, -13)); - } - - /** - * @generated - */ - public MessageName6EditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - } - - /** - * @generated - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3006, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageNameEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageNameEditPart.java deleted file mode 100644 index 126dfe0c129..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/MessageNameEditPart.java +++ /dev/null @@ -1,588 +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.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class MessageNameEditPart extends LabelEditPart implements - ITextAwareEditPart { - - /** - * @generated - */ - public static final int VISUAL_ID = 4005; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry - .getType(org.eclipse.papyrus.diagram.sequence.edit.parts.MessageNameEditPart.VISUAL_ID), - new Point(1, -13)); - } - - /** - * @generated - */ - public MessageNameEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new LabelDirectEditPolicy()); - } - - /** - * @generated - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setAlignment(PositionConstants.CENTER); - } - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - new EObjectAdapter(parserElement), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString( - new EObjectAdapter(getParserElement()), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl() { - - public void run() { - setResult(parser.isValidEditString( - new EObjectAdapter(element), - (String) value)); - } - }); - return valid.getCode() == ParserEditStatus.EDITABLE ? null - : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor( - new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - public IParser getParser() { - if (parser == null) { - String parserHint = ((View) getModel()).getType(); - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3001, getParserElement(), - parserHint); - parser = ParserService.getInstance().getParser(hintAdapter); - - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new TextDirectEditManager(this, TextDirectEditManager - .getTextCellEditorClass(this), UMLEditPartFactory - .getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager().getClass() == TextDirectEditManager.class) { - ((TextDirectEditManager) getManager()).show(eventLocation - .getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - try { - getEditingDomain().runExclusive(new Runnable() { - - public void run() { - if (isActive() && isEditable()) { - if (theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest - .getExtendedData() - .get( - RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style - .isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( - NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style - .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) - | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()) - .getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter( - "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return (View) getModel(); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( - feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() - .equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( - feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold() - .equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( - feature)) { - refreshFont(); - } else { - if (getParser() != null - && getParser().isAffectingEvent(event, - getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/PackageEditPart.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/PackageEditPart.java deleted file mode 100644 index 68ad01b86a6..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/PackageEditPart.java +++ /dev/null @@ -1,157 +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.parts; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.editpolicies.DiagramDragDropEditPolicy; -import org.eclipse.papyrus.diagram.common.editpolicies.ViewAndFeatureResolver; -import org.eclipse.papyrus.diagram.common.providers.ViewInfo; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.ids.UMLDiagramEditorIDs; -import org.eclipse.papyrus.diagram.sequence.edit.policies.PackageCanonicalEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.PackageItemSemanticEditPolicy; -import org.eclipse.papyrus.diagram.sequence.edit.policies.SequenceDiagramDragAndDropEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class PackageEditPart extends DiagramEditPart { - - /** - * @generated NOT - */ - // public final static String MODEL_ID = "UMLSequence"; //$NON-NLS-1$ - // all model IDs are grouped in org.eclipse.papyrus.diagram.common.ids - public final static String MODEL_ID = UMLDiagramEditorIDs.SequenceModelID; - - /** - * @generated - */ - public static final int VISUAL_ID = 79; - - /** - * Modified to perform correct Drag&Drop of an <Interaction>. - * - * @generated NOT - */ - private final ViewAndFeatureResolver resolver = new ViewAndFeatureResolver() { - /** - * generated NOT - */ - public boolean isEObjectNode(EObject element) { - if (element instanceof Interaction) { - // an Interaction's View can now be correctly initialized. - // Check if is children - if (resolveSemanticElement().eContents().contains(element)) { - // check if there is no existing view of the children - if (DiagramEditPartsUtil.getEObjectViews(element).size() == 0) - return true; - } - } - if (element instanceof Comment) { - return true; - } - return false; - } - - public boolean isEObjectLink(EObject element) { - return false; - } - - public int getEObjectSemanticHint(EObject element) { - // we will only allow Interaction Drag and Drop - if (element instanceof Interaction) { - return UMLVisualIDRegistry.getNodeVisualID(getNotationView(), - element); - } - return -1; - } - - public EStructuralFeature getEStructuralFeatureForEClass(EClass class1) { - if (UMLPackage.eINSTANCE.getComment().equals(class1)) { - return UMLPackage.eINSTANCE.getElement_OwnedComment(); - } - return null; - } - }; - - /** - * @generated - */ - public PackageEditPart(View view) { - super(view); - } - - /** - * Modified to install custom Drag&Drop policy. - * - * @generated NOT - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, - new PackageItemSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, - new PackageCanonicalEditPolicy()); - // fjcano: modified to install custom Drag&Drop policy. - installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, - new SequenceDiagramDragAndDropEditPolicy(resolver)); - - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies. - // EditPolicyRoles.POPUPBAR_ROLE); - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - - super.handleNotificationEvent(event); - if (event.getNotifier() instanceof EAnnotation) { - EAnnotation eAnnotation = (EAnnotation) event.getNotifier(); - if (eAnnotation.getSource() != null - && eAnnotation.getSource().equals( - MDTUtil.FilterViewAndLabelsSource)) { - DiagramEditPartsUtil.updateDiagram(this); - } - } - } - - /** - * @generated - */ - @Override - public Object getAdapter(Class adapter) { - if (adapter != null && adapter.equals(ViewAndFeatureResolver.class)) { - return this.resolver; - } - - if (adapter != null && adapter.equals(ViewInfo.class)) { - return UMLVisualIDRegistry.getDiagramViewInfo(); - } - return super.getAdapter(adapter); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/UMLEditPartFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/UMLEditPartFactory.java deleted file mode 100644 index 33b39f091fd..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/parts/UMLEditPartFactory.java +++ /dev/null @@ -1,274 +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.parts; - -import org.eclipse.draw2d.FigureUtilities; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Text; - -import org.eclipse.papyrus.diagram.common.editpolicies.ShowViewEditPolicy; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLEditPartFactory implements EditPartFactory { - - /** - * @generated - */ - public EditPart createEditPart(EditPart context, Object model) { - if (model instanceof View) { - View view = (View) model; - EditPart ep = null; - switch (UMLVisualIDRegistry.getVisualID(view)) { - - case PackageEditPart.VISUAL_ID: - ep = new PackageEditPart(view); - break; - - case InteractionEditPart.VISUAL_ID: - ep = new InteractionEditPart(view); - break; - - case InteractionNameEditPart.VISUAL_ID: - ep = new InteractionNameEditPart(view); - break; - - case CommentEditPart.VISUAL_ID: - ep = new CommentEditPart(view); - break; - - case CommentBodyEditPart.VISUAL_ID: - ep = new CommentBodyEditPart(view); - break; - - case Interaction2EditPart.VISUAL_ID: - ep = new Interaction2EditPart(view); - break; - - case InteractionName2EditPart.VISUAL_ID: - ep = new InteractionName2EditPart(view); - break; - - case LifelineEditPart.VISUAL_ID: - ep = new LifelineEditPart(view); - break; - - case LifelineNameEditPart.VISUAL_ID: - ep = new LifelineNameEditPart(view); - break; - - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - ep = new BehaviorExecutionSpecificationEditPart(view); - break; - - case CombinedFragmentEditPart.VISUAL_ID: - ep = new CombinedFragmentEditPart(view); - break; - - case CombinedFragmentInteractionOperatorEditPart.VISUAL_ID: - ep = new CombinedFragmentInteractionOperatorEditPart(view); - break; - - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - ep = new InteractionInteractionCompartmentEditPart(view); - break; - - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - ep = new InteractionInteractionCompartment2EditPart(view); - break; - - case MessageEditPart.VISUAL_ID: - ep = new MessageEditPart(view); - break; - - case MessageNameEditPart.VISUAL_ID: - ep = new MessageNameEditPart(view); - break; - - case Message2EditPart.VISUAL_ID: - ep = new Message2EditPart(view); - break; - - case MessageName2EditPart.VISUAL_ID: - ep = new MessageName2EditPart(view); - break; - - case Message3EditPart.VISUAL_ID: - ep = new Message3EditPart(view); - break; - - case MessageName3EditPart.VISUAL_ID: - ep = new MessageName3EditPart(view); - break; - - case Message4EditPart.VISUAL_ID: - ep = new Message4EditPart(view); - break; - - case MessageName4EditPart.VISUAL_ID: - ep = new MessageName4EditPart(view); - break; - - case Message5EditPart.VISUAL_ID: - ep = new Message5EditPart(view); - break; - - case MessageName5EditPart.VISUAL_ID: - ep = new MessageName5EditPart(view); - break; - - case Message6EditPart.VISUAL_ID: - ep = new Message6EditPart(view); - break; - - case MessageName6EditPart.VISUAL_ID: - ep = new MessageName6EditPart(view); - break; - - case ElementOwnedCommentEditPart.VISUAL_ID: - ep = new ElementOwnedCommentEditPart(view); - break; - - case CommentAnnotatedElementEditPart.VISUAL_ID: - ep = new CommentAnnotatedElementEditPart(view); - break; - } - if (ep != null) { - ep.installEditPolicy(EditPolicyRoles.OPEN_ROLE, - ShowViewEditPolicy.createOpenEditPolicy()); - return ep; - } - } - return createUnrecognizedEditPart(context, model); - } - - /** - * @generated - */ - private EditPart createUnrecognizedEditPart(EditPart context, Object model) { - // Handle creation of unrecognized child node EditParts here - return null; - } - - /** - * @generated - */ - public static CellEditorLocator getTextCellEditorLocator( - ITextAwareEditPart source) { - if (source.getFigure() instanceof WrappingLabel) - return new TextCellEditorLocator((WrappingLabel) source.getFigure()); - else { - return new LabelCellEditorLocator((Label) source.getFigure()); - } - } - - /** - * @generated - */ - static private class TextCellEditorLocator implements CellEditorLocator { - - /** - * @generated - */ - private WrappingLabel wrapLabel; - - /** - * @generated - */ - public TextCellEditorLocator(WrappingLabel wrapLabel) { - this.wrapLabel = wrapLabel; - } - - /** - * @generated - */ - public WrappingLabel getWrapLabel() { - return wrapLabel; - } - - /** - * @generated - */ - public void relocate(CellEditor celleditor) { - Text text = (Text) celleditor.getControl(); - Rectangle rect = getWrapLabel().getTextBounds().getCopy(); - getWrapLabel().translateToAbsolute(rect); - if (getWrapLabel().isTextWrapOn() - && getWrapLabel().getText().length() > 0) { - rect.setSize(new Dimension(text.computeSize(rect.width, - SWT.DEFAULT))); - } else { - int avr = FigureUtilities.getFontMetrics(text.getFont()) - .getAverageCharWidth(); - rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, - SWT.DEFAULT)).expand(avr * 2, 0)); - } - if (!rect.equals(new Rectangle(text.getBounds()))) { - text.setBounds(rect.x, rect.y, rect.width, rect.height); - } - } - - } - - /** - * @generated - */ - private static class LabelCellEditorLocator implements CellEditorLocator { - - /** - * @generated - */ - private Label label; - - /** - * @generated - */ - public LabelCellEditorLocator(Label label) { - this.label = label; - } - - /** - * @generated - */ - public Label getLabel() { - return label; - } - - /** - * @generated - */ - public void relocate(CellEditor celleditor) { - Text text = (Text) celleditor.getControl(); - Rectangle rect = getLabel().getTextBounds().getCopy(); - getLabel().translateToAbsolute(rect); - int avr = FigureUtilities.getFontMetrics(text.getFont()) - .getAverageCharWidth(); - rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, - SWT.DEFAULT)).expand(avr * 2, 0)); - if (!rect.equals(new Rectangle(text.getBounds()))) { - text.setBounds(rect.x, rect.y, rect.width, rect.height); - } - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/BehaviorExecutionSpecificationItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/BehaviorExecutionSpecificationItemSemanticEditPolicy.java deleted file mode 100644 index fca2eb4f691..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/BehaviorExecutionSpecificationItemSemanticEditPolicy.java +++ /dev/null @@ -1,223 +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.policies; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class BehaviorExecutionSpecificationItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - CompoundCommand cc = getDestroyEdgesCommand(); - addDestroyShortcutsCommand(cc); - cc.add(getGEFWrapper(new DestroyElementCommand(req))); - return cc.unwrap(); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return null; - } - return null; - } - - /** - * @generated - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return null; - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - - // add the view element - req.setParameter(ReorientLinkIDs.nodeEditPart, - ((IGraphicalEditPart) this.getHost()).getNotationView()); - // add the view link - List list = DiagramEditPartsUtil.getEObjectViews(req.getRelationship()); - if (list.size() > 0) { - req.setParameter(ReorientLinkIDs.linkEditPart, list.get(0)); - } - - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - - /** - * Returns command to reorient EReference based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - switch (getVisualID(req)) { - case ElementOwnedCommentEditPart.VISUAL_ID: - return getGEFWrapper(new ElementOwnedCommentReorientCommand(req)); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); - } - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CombinedFragmentItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CombinedFragmentItemSemanticEditPolicy.java deleted file mode 100644 index 7cfa9a6c0df..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CombinedFragmentItemSemanticEditPolicy.java +++ /dev/null @@ -1,223 +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.policies; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class CombinedFragmentItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - CompoundCommand cc = getDestroyEdgesCommand(); - addDestroyShortcutsCommand(cc); - cc.add(getGEFWrapper(new DestroyElementCommand(req))); - return cc.unwrap(); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return null; - } - return null; - } - - /** - * @generated - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return null; - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - - // add the view element - req.setParameter(ReorientLinkIDs.nodeEditPart, - ((IGraphicalEditPart) this.getHost()).getNotationView()); - // add the view link - List list = DiagramEditPartsUtil.getEObjectViews(req.getRelationship()); - if (list.size() > 0) { - req.setParameter(ReorientLinkIDs.linkEditPart, list.get(0)); - } - - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - - /** - * Returns command to reorient EReference based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - switch (getVisualID(req)) { - case ElementOwnedCommentEditPart.VISUAL_ID: - return getGEFWrapper(new ElementOwnedCommentReorientCommand(req)); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); - } - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java deleted file mode 100644 index 2bbca8fa41b..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.policies; - -import java.util.Iterator; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Model; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; - -/** - * @generated - */ -public class CommentAnnotatedElementItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - public Command getCommand(Request request) { - if (request instanceof GroupRequest - && RequestConstants.REQ_DELETE.equals(request.getType())) { - CommentAnnotatedElementEditPart ep = (CommentAnnotatedElementEditPart) getHost(); - DestroyReferenceRequest drr = new DestroyReferenceRequest( - ((View) ep.getSource().getModel()).getElement(), - UMLPackage.eINSTANCE.getComment_AnnotatedElement(), - ((View) ep.getTarget().getModel()).getElement(), false); - return getDestroyReferenceCommand(drr); - } - return super.getCommand(request); - } - - /** - * @generated NOT - */ - @Override - protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) { - CompoundCommand cc = new CompoundCommand(); - Comment c = (Comment) req.getContainer(); - - cc.add(getGEFWrapper(new DestroyReferenceCommand(req))); - - if (c.getAnnotatedElements().size() < 2 - || c.getAnnotatedElements().size() > 2) { - Model m = (Model) c.eResource().getContents().get(0); - SetRequest sr = new SetRequest(m, UMLPackage.eINSTANCE - .getElement_OwnedComment(), c); - cc.add(new ICommandProxy(new SetValueCommand(sr))); - } else { - Element e = findNewParent((Element) req.getReferencedObject(), c - .getAnnotatedElements()); - SetRequest sr = new SetRequest(e, UMLPackage.eINSTANCE - .getElement_OwnedComment(), c); - cc.add(new ICommandProxy(new SetValueCommand(sr))); - } - - return cc; - } - - /** - * @not generated - */ - private Element findNewParent(Element oldValue, EList<Element> elements) { - for (Iterator<Element> it = elements.iterator(); it.hasNext();) { - Element e = it.next(); - if (e != oldValue) - return e; - } - - return null; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CommentItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CommentItemSemanticEditPolicy.java deleted file mode 100644 index 26ea9a43543..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/CommentItemSemanticEditPolicy.java +++ /dev/null @@ -1,220 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.policies; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class CommentItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - CompoundCommand cc = getDestroyEdgesCommand(); - addDestroyShortcutsCommand(cc); - View view = (View) getHost().getModel(); - if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ - req.setElementToDestroy(view); - } - cc.add(getGEFWrapper(new DestroyElementCommand(req))); - return cc.unwrap(); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - - // add the view element - req.setParameter(ReorientLinkIDs.nodeEditPart, - ((IGraphicalEditPart) this.getHost()).getNotationView()); - // add the view link - List list = DiagramEditPartsUtil.getEObjectViews(req.getRelationship()); - if (list.size() > 0) { - req.setParameter(ReorientLinkIDs.linkEditPart, list.get(0)); - } - - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - - /** - * Returns command to reorient EReference based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - switch (getVisualID(req)) { - case ElementOwnedCommentEditPart.VISUAL_ID: - return getGEFWrapper(new ElementOwnedCommentReorientCommand(req)); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); - } - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/ElementOwnedCommentItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/ElementOwnedCommentItemSemanticEditPolicy.java deleted file mode 100644 index 1d4de3b2ecd..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/ElementOwnedCommentItemSemanticEditPolicy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.edit.policies; - -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.emf.ecore.resource.Resource; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; - -/** - * @generated - */ -public class ElementOwnedCommentItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - public Command getCommand(Request request) { - if (request instanceof GroupRequest - && RequestConstants.REQ_DELETE.equals(request.getType())) { - ElementOwnedCommentEditPart ep = (ElementOwnedCommentEditPart) getHost(); - DestroyReferenceRequest drr = new DestroyReferenceRequest( - ((View) ep.getSource().getModel()).getElement(), - UMLPackage.eINSTANCE.getElement_OwnedComment(), ((View) ep - .getTarget().getModel()).getElement(), false); - return getDestroyReferenceCommand(drr); - } - return super.getCommand(request); - } - - /** - * @generated NOT - */ - @Override - protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) { - EObject eObject = org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil - .getDiagramEditPart( - ((ElementOwnedCommentEditPart) this.getHost()) - .getTarget()).resolveSemanticElement(); - - SetRequest sr = new SetRequest(eObject, UMLPackage.eINSTANCE - .getElement_OwnedComment(), req.getReferencedObject()); - return new ICommandProxy(new SetValueCommand(sr)); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Interaction2ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Interaction2ItemSemanticEditPolicy.java deleted file mode 100644 index 58ad0242edf..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Interaction2ItemSemanticEditPolicy.java +++ /dev/null @@ -1,348 +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.policies; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.InteractionFragment; -import org.eclipse.uml2.uml.Lifeline; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class Interaction2ItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - // This line is also GMF generated code - CompoundCommand cc = getDestroyEdgesCommand(); - - // First destroy all the Lifelines/Interactions within the Interaction - if (req.getElementToDestroy() instanceof Interaction) { - Interaction interaction = (Interaction) req.getElementToDestroy(); - - // Lifelines - for (Iterator it = interaction.getLifelines().iterator(); it - .hasNext();) { - Lifeline lifeline = (Lifeline) it.next(); - - // Search for its EditPart - EditPart lifelineEditPart = null; - for (Iterator epIt = getHost().getViewer() - .getEditPartRegistry().keySet().iterator(); epIt - .hasNext();) { - Object epObj = epIt.next(); - if (epObj instanceof Node) { - Node node = (Node) epObj; - if (node.getElement() == lifeline) { - lifelineEditPart = (EditPart) getHost().getViewer() - .getEditPartRegistry().get(node); - break; - } - } - } - if (lifelineEditPart != null) { - EditCommandRequestWrapper editCommandRequest = new EditCommandRequestWrapper( - new DestroyElementRequest( - ((Interaction2EditPart) getHost()) - .getEditingDomain(), req - .isConfirmationRequired()), - Collections.EMPTY_MAP); - cc.add(lifelineEditPart.getCommand(editCommandRequest)); - } - } - - // Interactions - for (Iterator it = interaction.getFragments().iterator(); it - .hasNext();) { - InteractionFragment fragment = (InteractionFragment) it.next(); - if (fragment instanceof Interaction) { - EditPart interaction2EditPart = null; - for (Iterator epIt = getHost().getViewer() - .getEditPartRegistry().keySet().iterator(); epIt - .hasNext();) { - Object epObj = epIt.next(); - if (epObj instanceof Node) { - Node node = (Node) epObj; - if (node.getElement() == fragment) { - interaction2EditPart = (EditPart) getHost() - .getViewer().getEditPartRegistry().get( - node); - break; - } - } - } - if (interaction2EditPart != null) { - if (interaction2EditPart instanceof InteractionInteractionCompartment2EditPart) { - interaction2EditPart = interaction2EditPart - .getParent(); - } - EditCommandRequestWrapper editCommandRequest = new EditCommandRequestWrapper( - new DestroyElementRequest( - ((Interaction2EditPart) getHost()) - .getEditingDomain(), req - .isConfirmationRequired()), - Collections.EMPTY_MAP); - cc.add(interaction2EditPart - .getCommand(editCommandRequest)); - } - } - } - } - - // What comes next is GMF generated code - addDestroyChildNodesCommand(cc); - addDestroyShortcutsCommand(cc); - cc.add(getGEFWrapper(new DestroyElementCommand(req))); - return cc.unwrap(); - } - - /** - * @generated - */ - protected void addDestroyChildNodesCommand(CompoundCommand cmd) { - View view = (View) getHost().getModel(); - EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if (annotation != null) { - return; - } - for (Iterator it = view.getChildren().iterator(); it.hasNext();) { - Node node = (Node) it.next(); - switch (UMLVisualIDRegistry.getVisualID(node)) { - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - for (Iterator cit = node.getChildren().iterator(); cit - .hasNext();) { - Node cnode = (Node) cit.next(); - switch (UMLVisualIDRegistry.getVisualID(cnode)) { - case Interaction2EditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(cnode)); - break; - case LifelineEditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(cnode)); - break; - case CombinedFragmentEditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(cnode)); - break; - } - } - break; - } - } - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return null; - } - return null; - } - - /** - * @generated - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return null; - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - - // add the view element - req.setParameter(ReorientLinkIDs.nodeEditPart, - ((IGraphicalEditPart) this.getHost()).getNotationView()); - // add the view link - List list = DiagramEditPartsUtil.getEObjectViews(req.getRelationship()); - if (list.size() > 0) { - req.setParameter(ReorientLinkIDs.linkEditPart, list.get(0)); - } - - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - - /** - * Returns command to reorient EReference based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - switch (getVisualID(req)) { - case ElementOwnedCommentEditPart.VISUAL_ID: - return getGEFWrapper(new ElementOwnedCommentReorientCommand(req)); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); - } - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartment2CanonicalEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartment2CanonicalEditPolicy.java deleted file mode 100644 index 91822cdef98..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartment2CanonicalEditPolicy.java +++ /dev/null @@ -1,126 +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.policies; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewType; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramUpdater; -import org.eclipse.papyrus.diagram.sequence.part.UMLNodeDescriptor; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class InteractionInteractionCompartment2CanonicalEditPolicy extends - CanonicalEditPolicy { - - /** - * @generated - */ - Set myFeaturesToSynchronize; - - /** - * @generated - */ - @Override - protected List getSemanticChildrenList() { - View viewObject = (View) getHost().getModel(); - List result = new LinkedList(); - for (Iterator it = UMLDiagramUpdater - .getInteractionInteractionCompartment_5002SemanticChildren( - viewObject).iterator(); it.hasNext();) { - EObject nextValue = ((UMLNodeDescriptor) it.next()) - .getModelElement(); - if (MultiDiagramUtil.findEObjectReferencedInEAnnotation(getHost(), - nextValue)) { - result.add(nextValue); - } - } - return result; - } - - /** - * @generated - */ - @Override - protected boolean isOrphaned(Collection semanticChildren, final View view) { - if (view.getType() == ViewType.NOTE || view.getType() == ViewType.TEXT) { - return false; - } - if (view.getElement() != null) { - int actualID = UMLVisualIDRegistry.getVisualID(view); - int suggestedID = UMLVisualIDRegistry.getNodeVisualID( - (View) getHost().getModel(), view.getElement()); - switch (actualID) { - case Interaction2EditPart.VISUAL_ID: - case LifelineEditPart.VISUAL_ID: - case CombinedFragmentEditPart.VISUAL_ID: - return actualID != suggestedID; - } - return false; - } - return true; - } - - /** - * @generated - */ - @Override - protected String getDefaultFactoryHint() { - return null; - } - - /** - * @generated - */ - @Override - protected Set getFeaturesToSynchronize() { - if (myFeaturesToSynchronize == null) { - myFeaturesToSynchronize = new HashSet(); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getInteraction_Lifeline()); - } - return myFeaturesToSynchronize; - } - - /** - * @generated - */ - @Override - protected void refreshSemantic() { - super.refreshSemantic(); - // this will take care of the filtering of views - Diagram diagram = MDTUtil.getHostDiagram(this); - if (diagram != null) { - MDTUtil.filterDiagramViews(diagram); - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartment2ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartment2ItemSemanticEditPolicy.java deleted file mode 100644 index 044d58e4f70..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartment2ItemSemanticEditPolicy.java +++ /dev/null @@ -1,78 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CombinedFragmentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Interaction2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.LifelineCreateCommand; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class InteractionInteractionCompartment2ItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Interaction_2001 == req.getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - } - return getGEFWrapper(new Interaction2CreateCommand(req)); - } - if (UMLElementTypes.Lifeline_2002 == req.getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Lifeline()); - } - return getGEFWrapper(new LifelineCreateCommand(req)); - } - if (UMLElementTypes.CombinedFragment_2004 == req.getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - } - return getGEFWrapper(new CombinedFragmentCreateCommand(req)); - } - return super.getCreateCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return getHost().getParent().getCommand( - new EditCommandRequestWrapper(req)); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartmentCanonicalEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartmentCanonicalEditPolicy.java deleted file mode 100644 index 4b3ee0327bb..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartmentCanonicalEditPolicy.java +++ /dev/null @@ -1,126 +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.policies; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewType; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramUpdater; -import org.eclipse.papyrus.diagram.sequence.part.UMLNodeDescriptor; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class InteractionInteractionCompartmentCanonicalEditPolicy extends - CanonicalEditPolicy { - - /** - * @generated - */ - Set myFeaturesToSynchronize; - - /** - * @generated - */ - @Override - protected List getSemanticChildrenList() { - View viewObject = (View) getHost().getModel(); - List result = new LinkedList(); - for (Iterator it = UMLDiagramUpdater - .getInteractionInteractionCompartment_5001SemanticChildren( - viewObject).iterator(); it.hasNext();) { - EObject nextValue = ((UMLNodeDescriptor) it.next()) - .getModelElement(); - if (MultiDiagramUtil.findEObjectReferencedInEAnnotation(getHost(), - nextValue)) { - result.add(nextValue); - } - } - return result; - } - - /** - * @generated - */ - @Override - protected boolean isOrphaned(Collection semanticChildren, final View view) { - if (view.getType() == ViewType.NOTE || view.getType() == ViewType.TEXT) { - return false; - } - if (view.getElement() != null) { - int actualID = UMLVisualIDRegistry.getVisualID(view); - int suggestedID = UMLVisualIDRegistry.getNodeVisualID( - (View) getHost().getModel(), view.getElement()); - switch (actualID) { - case Interaction2EditPart.VISUAL_ID: - case LifelineEditPart.VISUAL_ID: - case CombinedFragmentEditPart.VISUAL_ID: - return actualID != suggestedID; - } - return false; - } - return true; - } - - /** - * @generated - */ - @Override - protected String getDefaultFactoryHint() { - return null; - } - - /** - * @generated - */ - @Override - protected Set getFeaturesToSynchronize() { - if (myFeaturesToSynchronize == null) { - myFeaturesToSynchronize = new HashSet(); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getInteraction_Lifeline()); - } - return myFeaturesToSynchronize; - } - - /** - * @generated - */ - @Override - protected void refreshSemantic() { - super.refreshSemantic(); - // this will take care of the filtering of views - Diagram diagram = MDTUtil.getHostDiagram(this); - if (diagram != null) { - MDTUtil.filterDiagramViews(diagram); - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java deleted file mode 100644 index ccb3375a339..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java +++ /dev/null @@ -1,78 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CombinedFragmentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Interaction2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.LifelineCreateCommand; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class InteractionInteractionCompartmentItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Interaction_2001 == req.getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - } - return getGEFWrapper(new Interaction2CreateCommand(req)); - } - if (UMLElementTypes.Lifeline_2002 == req.getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Lifeline()); - } - return getGEFWrapper(new LifelineCreateCommand(req)); - } - if (UMLElementTypes.CombinedFragment_2004 == req.getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - } - return getGEFWrapper(new CombinedFragmentCreateCommand(req)); - } - return super.getCreateCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return getHost().getParent().getCommand( - new EditCommandRequestWrapper(req)); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java deleted file mode 100644 index 62ac3cda7f6..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java +++ /dev/null @@ -1,355 +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.policies; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.InteractionFragment; -import org.eclipse.uml2.uml.Lifeline; - -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class InteractionItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - // This line is also GMF generated code - CompoundCommand cc = getDestroyEdgesCommand(); - - // First destroy all the Lifelines/Interactions within the Interaction - if (req.getElementToDestroy() instanceof Interaction) { - Interaction interaction = (Interaction) req.getElementToDestroy(); - - // Lifelines - for (Iterator it = interaction.getLifelines().iterator(); it - .hasNext();) { - Lifeline lifeline = (Lifeline) it.next(); - - // Search for its EditPart - EditPart lifelineEditPart = null; - for (Iterator epIt = getHost().getViewer() - .getEditPartRegistry().keySet().iterator(); epIt - .hasNext();) { - Object epObj = epIt.next(); - if (epObj instanceof Node) { - Node node = (Node) epObj; - if (node.getElement() == lifeline) { - lifelineEditPart = (EditPart) getHost().getViewer() - .getEditPartRegistry().get(node); - break; - } - } - } - if (lifelineEditPart != null) { - EditCommandRequestWrapper editCommandRequest = new EditCommandRequestWrapper( - new DestroyElementRequest( - ((InteractionEditPart) getHost()) - .getEditingDomain(), req - .isConfirmationRequired()), - Collections.EMPTY_MAP); - cc.add(lifelineEditPart.getCommand(editCommandRequest)); - } - } - - // Interactions - for (Iterator it = interaction.getFragments().iterator(); it - .hasNext();) { - InteractionFragment fragment = (InteractionFragment) it.next(); - if (fragment instanceof Interaction) { - EditPart interaction2EditPart = null; - for (Iterator epIt = getHost().getViewer() - .getEditPartRegistry().keySet().iterator(); epIt - .hasNext();) { - Object epObj = epIt.next(); - if (epObj instanceof Node) { - Node node = (Node) epObj; - if (node.getElement() == fragment) { - interaction2EditPart = (EditPart) getHost() - .getViewer().getEditPartRegistry().get( - node); - break; - } - } - } - if (interaction2EditPart != null) { - if (interaction2EditPart instanceof InteractionInteractionCompartment2EditPart) { - interaction2EditPart = interaction2EditPart - .getParent(); - } - EditCommandRequestWrapper editCommandRequest = new EditCommandRequestWrapper( - new DestroyElementRequest( - ((InteractionEditPart) getHost()) - .getEditingDomain(), req - .isConfirmationRequired()), - Collections.EMPTY_MAP); - cc.add(interaction2EditPart - .getCommand(editCommandRequest)); - } - } - } - } - - // What comes next is GMF generated code - // Do not destroy child nodes as we have already done it before - // addDestroyChildNodesCommand(cc); - addDestroyShortcutsCommand(cc); - View view = (View) getHost().getModel(); - if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ - req.setElementToDestroy(view); - } - cc.add(getGEFWrapper(new DestroyElementCommand(req))); - return cc.unwrap(); - } - - /** - * @generated - */ - protected void addDestroyChildNodesCommand(CompoundCommand cmd) { - View view = (View) getHost().getModel(); - EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if (annotation != null) { - return; - } - for (Iterator it = view.getChildren().iterator(); it.hasNext();) { - Node node = (Node) it.next(); - switch (UMLVisualIDRegistry.getVisualID(node)) { - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - for (Iterator cit = node.getChildren().iterator(); cit - .hasNext();) { - Node cnode = (Node) cit.next(); - switch (UMLVisualIDRegistry.getVisualID(cnode)) { - case Interaction2EditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(cnode)); - break; - case LifelineEditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(cnode)); - break; - case CombinedFragmentEditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(cnode)); - break; - } - } - break; - } - } - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return null; - } - return null; - } - - /** - * @generated - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return null; - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - - // add the view element - req.setParameter(ReorientLinkIDs.nodeEditPart, - ((IGraphicalEditPart) this.getHost()).getNotationView()); - // add the view link - List list = DiagramEditPartsUtil.getEObjectViews(req.getRelationship()); - if (list.size() > 0) { - req.setParameter(ReorientLinkIDs.linkEditPart, list.get(0)); - } - - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - - /** - * Returns command to reorient EReference based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - switch (getVisualID(req)) { - case ElementOwnedCommentEditPart.VISUAL_ID: - return getGEFWrapper(new ElementOwnedCommentReorientCommand(req)); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); - } - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/LifelineCanonicalEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/LifelineCanonicalEditPolicy.java deleted file mode 100644 index c23c8ed3711..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/LifelineCanonicalEditPolicy.java +++ /dev/null @@ -1,118 +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.policies; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewType; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramUpdater; -import org.eclipse.papyrus.diagram.sequence.part.UMLNodeDescriptor; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class LifelineCanonicalEditPolicy extends CanonicalEditPolicy { - - /** - * @generated - */ - Set myFeaturesToSynchronize; - - /** - * @generated - */ - @Override - protected List getSemanticChildrenList() { - View viewObject = (View) getHost().getModel(); - List result = new LinkedList(); - for (Iterator it = UMLDiagramUpdater.getLifeline_2002SemanticChildren( - viewObject).iterator(); it.hasNext();) { - EObject nextValue = ((UMLNodeDescriptor) it.next()) - .getModelElement(); - if (MultiDiagramUtil.findEObjectReferencedInEAnnotation(getHost(), - nextValue)) { - result.add(nextValue); - } - } - return result; - } - - /** - * @generated - */ - @Override - protected boolean isOrphaned(Collection semanticChildren, final View view) { - if (view.getType() == ViewType.NOTE || view.getType() == ViewType.TEXT) { - return false; - } - if (view.getElement() != null) { - int actualID = UMLVisualIDRegistry.getVisualID(view); - int suggestedID = UMLVisualIDRegistry.getNodeVisualID( - (View) getHost().getModel(), view.getElement()); - switch (actualID) { - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return actualID != suggestedID; - } - return false; - } - return true; - } - - /** - * @generated - */ - @Override - protected String getDefaultFactoryHint() { - return null; - } - - /** - * @generated - */ - @Override - protected Set getFeaturesToSynchronize() { - if (myFeaturesToSynchronize == null) { - myFeaturesToSynchronize = new HashSet(); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - } - return myFeaturesToSynchronize; - } - - /** - * @generated - */ - @Override - protected void refreshSemantic() { - super.refreshSemantic(); - // this will take care of the filtering of views - Diagram diagram = MDTUtil.getHostDiagram(this); - if (diagram != null) { - MDTUtil.filterDiagramViews(diagram); - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java deleted file mode 100644 index fd73a808cd3..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java +++ /dev/null @@ -1,341 +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.policies; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.command.wrappers.EMFtoGEFCommandWrapper; -import org.eclipse.papyrus.diagram.common.ids.ReorientLinkIDs; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.common.commands.CreateElementAndInitializeFeatureCommand; -import org.eclipse.papyrus.diagram.common.commands.UpdateLifelineRepresentsCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.BehaviorExecutionSpecificationCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentAnnotatedElementReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6CreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class LifelineItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.BehaviorExecutionSpecification_2003 == req - .getElementType()) { - if (req.getContainmentFeature() == null) { - req.setContainmentFeature(UMLPackage.eINSTANCE - .getInteraction_Fragment()); - } - - // Added to initialize the property "Covered" of the new - // BehaviourExecutionSpecification - CreateElementCommand behaviourCmd = new BehaviorExecutionSpecificationCreateCommand( - req); - EReference feature = UMLPackage.eINSTANCE - .getInteractionFragment_Covered(); - Object value = req.getContainer(); - return new CreateElementAndInitializeFeatureCommand(behaviourCmd, - feature, value); - - } - return super.getCreateCommand(req); - } - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - // This line is also GMF generated code - CompoundCommand cc = getDestroyEdgesCommand(); - - // First destroy all the BehaviourExecutionSpecifications within the - // Lifeline - if (req.getElementToDestroy() instanceof Lifeline) { - Lifeline lifeline = (Lifeline) req.getElementToDestroy(); - for (Iterator it = lifeline.getCoveredBys().iterator(); it - .hasNext();) { - Object obj = it.next(); - - if (obj instanceof BehaviorExecutionSpecification) { - // Search for its EditPart - EditPart besEditPart = null; - for (Iterator epIt = getHost().getViewer() - .getEditPartRegistry().keySet().iterator(); epIt - .hasNext();) { - Object epObj = epIt.next(); - if (epObj instanceof Node) { - Node node = (Node) epObj; - if (node.getElement() == obj) { - besEditPart = (EditPart) getHost().getViewer() - .getEditPartRegistry().get(node); - break; - } - } - } - if (besEditPart != null) { - EditCommandRequestWrapper editCommandRequest = new EditCommandRequestWrapper( - new DestroyElementRequest( - ((LifelineEditPart) getHost()) - .getEditingDomain(), req - .isConfirmationRequired()), - Collections.EMPTY_MAP); - cc.add(besEditPart.getCommand(editCommandRequest)); - } - } - } - - UpdateLifelineRepresentsCommand lifeLineCommand = new UpdateLifelineRepresentsCommand( - lifeline, null, this.getEditingDomain()); - - cc.add(new EMFtoGEFCommandWrapper(lifeLineCommand)); - - } - - // What comes next is GMF generated code - addDestroyChildNodesCommand(cc); - addDestroyShortcutsCommand(cc); - cc.add(getGEFWrapper(new DestroyElementCommand(req))); - return cc.unwrap(); - } - - /** - * @generated - */ - protected void addDestroyChildNodesCommand(CompoundCommand cmd) { - View view = (View) getHost().getModel(); - EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if (annotation != null) { - return; - } - for (Iterator it = view.getChildren().iterator(); it.hasNext();) { - Node node = (Node) it.next(); - switch (UMLVisualIDRegistry.getVisualID(node)) { - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - cmd.add(getDestroyElementCommand(node)); - break; - } - } - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return null; - } - return null; - } - - /** - * @generated - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - if (UMLElementTypes.Message_3001 == req.getElementType()) { - return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - req.getTarget())); - } - if (UMLElementTypes.Message_3002 == req.getElementType()) { - return getGEFWrapper(new Message2CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3003 == req.getElementType()) { - return getGEFWrapper(new Message3CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3004 == req.getElementType()) { - return getGEFWrapper(new Message4CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3005 == req.getElementType()) { - return getGEFWrapper(new Message5CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.Message_3006 == req.getElementType()) { - return getGEFWrapper(new Message6CreateCommand(req, - req.getSource(), req.getTarget())); - } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return null; - } - if (UMLElementTypes.CommentAnnotatedElement_3008 == req - .getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, - req.getSource(), req.getTarget())); - } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - - // add the view element - req.setParameter(ReorientLinkIDs.nodeEditPart, - ((IGraphicalEditPart) this.getHost()).getNotationView()); - // add the view link - List list = DiagramEditPartsUtil.getEObjectViews(req.getRelationship()); - if (list.size() > 0) { - req.setParameter(ReorientLinkIDs.linkEditPart, list.get(0)); - } - - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - - /** - * Returns command to reorient EReference based link. New link target or - * source should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - switch (getVisualID(req)) { - case ElementOwnedCommentEditPart.VISUAL_ID: - return getGEFWrapper(new ElementOwnedCommentReorientCommand(req)); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req)); - } - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message2ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message2ItemSemanticEditPolicy.java deleted file mode 100644 index 4222817aa97..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message2ItemSemanticEditPolicy.java +++ /dev/null @@ -1,160 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; - -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated NOT - */ -public class Message2ItemSemanticEditPolicy extends - MessageDestroySemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated not - * @author mgil - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated not - * @author mgil - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message3ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message3ItemSemanticEditPolicy.java deleted file mode 100644 index de9d6441805..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message3ItemSemanticEditPolicy.java +++ /dev/null @@ -1,160 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; - -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated NOT - */ -public class Message3ItemSemanticEditPolicy extends - MessageDestroySemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated not - * @author mgil - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated not - * @author mgil - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message4ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message4ItemSemanticEditPolicy.java deleted file mode 100644 index d85eb38c56c..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message4ItemSemanticEditPolicy.java +++ /dev/null @@ -1,160 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; - -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated NOT - */ -public class Message4ItemSemanticEditPolicy extends - MessageDestroySemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated not - * @author mgil - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated not - * @author mgil - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message5ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message5ItemSemanticEditPolicy.java deleted file mode 100644 index 28cc9176e52..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message5ItemSemanticEditPolicy.java +++ /dev/null @@ -1,160 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; - -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated NOT - */ -public class Message5ItemSemanticEditPolicy extends - MessageDestroySemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated not - * @author mgil - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated not - * @author mgil - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message6ItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message6ItemSemanticEditPolicy.java deleted file mode 100644 index 06b784a72d1..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/Message6ItemSemanticEditPolicy.java +++ /dev/null @@ -1,160 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; - -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated NOT - */ -public class Message6ItemSemanticEditPolicy extends - MessageDestroySemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated not - * @author mgil - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated not - * @author mgil - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/MessageItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/MessageItemSemanticEditPolicy.java deleted file mode 100644 index 3adc653e4ba..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/MessageItemSemanticEditPolicy.java +++ /dev/null @@ -1,160 +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.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; - -import org.eclipse.papyrus.diagram.sequence.edit.commands.ElementOwnedCommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message2ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message3ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message4ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message5ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.Message6ReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.MessageReorientCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated NOT - */ -public class MessageItemSemanticEditPolicy extends - MessageDestroySemanticEditPolicy { - - /** - * @generated NOT - */ - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - /** - * @generated - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) - : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super - .getCreateRelationshipCommand(req); - } - - /** - * @generated not - * @author mgil - */ - protected Command getStartCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - if (UMLElementTypes.ElementOwnedComment_3007 == req.getElementType()) { - return getGEFWrapper(new ElementOwnedCommentCreateCommand(req, req - .getSource(), req.getTarget())); - } - return null; - } - - /** - * @generated not - * @author mgil - */ - protected Command getCompleteCreateRelationshipCommand( - CreateRelationshipRequest req) { - /** - * Commented to avoid trying to link a Message from another Message - */ - // if (UMLElementTypes.Message_3001 == req.getElementType()) { - // return getGEFWrapper(new MessageCreateCommand(req, req.getSource(), - // req.getTarget())); - // } - // if (UMLElementTypes.Message_3002 == req.getElementType()) { - // return getGEFWrapper(new Message2CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3003 == req.getElementType()) { - // return getGEFWrapper(new Message3CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3004 == req.getElementType()) { - // return getGEFWrapper(new Message4CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3005 == req.getElementType()) { - // return getGEFWrapper(new Message5CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - // if (UMLElementTypes.Message_3006 == req.getElementType()) { - // return getGEFWrapper(new Message6CreateCommand(req, - // req.getSource(), req.getTarget())); - // } - return null; - } - - /** - * Returns command to reorient EClass based link. New link target or source - * should be the domain model element associated with this node. - * - * @generated - */ - @Override - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - switch (getVisualID(req)) { - case MessageEditPart.VISUAL_ID: - return getGEFWrapper(new MessageReorientCommand(req)); - case Message2EditPart.VISUAL_ID: - return getGEFWrapper(new Message2ReorientCommand(req)); - case Message3EditPart.VISUAL_ID: - return getGEFWrapper(new Message3ReorientCommand(req)); - case Message4EditPart.VISUAL_ID: - return getGEFWrapper(new Message4ReorientCommand(req)); - case Message5EditPart.VISUAL_ID: - return getGEFWrapper(new Message5ReorientCommand(req)); - case Message6EditPart.VISUAL_ID: - return getGEFWrapper(new Message6ReorientCommand(req)); - } - return super.getReorientRelationshipCommand(req); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/PackageCanonicalEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/PackageCanonicalEditPolicy.java deleted file mode 100644 index 10d803567c2..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/PackageCanonicalEditPolicy.java +++ /dev/null @@ -1,788 +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.policies; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewType; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction; -import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Event; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.InitializeInteractionViewCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramUpdater; -import org.eclipse.papyrus.diagram.sequence.part.UMLLinkDescriptor; -import org.eclipse.papyrus.diagram.sequence.part.UMLNodeDescriptor; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class PackageCanonicalEditPolicy extends CanonicalConnectionEditPolicy { - - /** - * @generated - */ - Set myFeaturesToSynchronize; - - /** - * @generated - */ - @Override - protected List getSemanticChildrenList() { - View viewObject = (View) getHost().getModel(); - List result = new LinkedList(); - for (Iterator it = UMLDiagramUpdater.getPackage_79SemanticChildren( - viewObject).iterator(); it.hasNext();) { - EObject nextValue = ((UMLNodeDescriptor) it.next()) - .getModelElement(); - if (MultiDiagramUtil.findEObjectReferencedInEAnnotation(getHost(), - nextValue)) { - result.add(nextValue); - } - } - return result; - } - - /** - * @generated - */ - @Override - protected boolean shouldDeleteView(View view) { - return true; - } - - /** - * @generated - */ - @Override - protected boolean isOrphaned(Collection semanticChildren, final View view) { - if (view.getType() == ViewType.NOTE || view.getType() == ViewType.TEXT) { - return false; - } - if (view.getElement() != null) { - int actualID = UMLVisualIDRegistry.getVisualID(view); - int suggestedID = UMLVisualIDRegistry.getNodeVisualID( - (View) getHost().getModel(), view.getElement()); - switch (actualID) { - case InteractionEditPart.VISUAL_ID: - case CommentEditPart.VISUAL_ID: - return actualID != suggestedID; - } - return false; - } - return true; - } - - /** - * @generated - */ - @Override - protected String getDefaultFactoryHint() { - return null; - } - - /** - * @generated - */ - @Override - protected Set getFeaturesToSynchronize() { - if (myFeaturesToSynchronize == null) { - myFeaturesToSynchronize = new HashSet(); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getPackage_PackagedElement()); - myFeaturesToSynchronize.add(UMLPackage.eINSTANCE - .getElement_OwnedComment()); - } - return myFeaturesToSynchronize; - } - - /** - * @generated - */ - @Override - protected List getSemanticConnectionsList() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - protected EObject getSourceElement(EObject relationship) { - return null; - } - - /** - * @generated - */ - @Override - protected EObject getTargetElement(EObject relationship) { - return null; - } - - /** - * @generated - */ - @Override - protected boolean shouldIncludeConnection(Edge connector, - Collection children) { - return false; - } - - /** - * @generated - */ - @Override - protected void refreshSemantic() { - List createdViews = new LinkedList(); - createdViews.addAll(refreshSemanticChildren()); - List createdConnectionViews = new LinkedList(); - createdConnectionViews.addAll(refreshSemanticConnections()); - createdConnectionViews.addAll(refreshConnections()); - if (createdViews.size() > 1) { - // perform a layout of the container - DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host() - .getEditingDomain(), createdViews, host()); - executeCommand(new ICommandProxy(layoutCmd)); - } - createdViews.addAll(createdConnectionViews); - makeViewsImmutable(createdViews); - Diagram diagram = MDTUtil.getHostDiagram(this); - - if (diagram != null) { - MDTUtil.filterDiagramViews(diagram); - } - } - - @Override - protected Command getCreateViewCommand(CreateRequest request) { - IGraphicalEditPart host = getHost() instanceof IGraphicalEditPart ? (IGraphicalEditPart) getHost() - : null; - CompositeCommand cc = null; - if (request instanceof CreateViewRequest && host != null - && host.getEditingDomain() != null) { - cc = new CompositeCommand("Initialize Interactions"); - List<Interaction> interactions = extractInteractionsFromRequest((CreateViewRequest) request); - for (Interaction interaction : interactions) { - InitializeInteractionViewCommand command = new InitializeInteractionViewCommand( - host.getEditingDomain(), "Initialize interaction view", - null); - command.setInteraction(interaction); - command.setParentEditPart(host); - cc.add(command); - } - } - if (cc != null && cc.canExecute()) { - Command command = super.getCreateViewCommand(request); - if (command != null && command.canExecute()) { - return command.chain(new ICommandProxy(cc)); - } else { - return new ICommandProxy(cc); - } - } else { - return super.getCommand(request); - } - } - - protected List<Interaction> extractInteractionsFromRequest( - CreateViewRequest request) { - List<Interaction> interactions = new ArrayList<Interaction>(); - List<ViewDescriptor> toRemove = new ArrayList<ViewDescriptor>(); - for (Object object : request.getViewDescriptors()) { - if (object instanceof ViewDescriptor) { - ViewDescriptor descriptor = (ViewDescriptor) object; - Object adapted = descriptor.getElementAdapter().getAdapter( - Interaction.class); - if (adapted instanceof Interaction) { - interactions.add((Interaction) adapted); - toRemove.add(descriptor); - } - } - } - for (ViewDescriptor descriptor : toRemove) { - request.getViewDescriptors().remove(descriptor); - } - return interactions; - } - - /** - * @generated - */ - private Diagram getDiagram() { - return ((View) getHost().getModel()).getDiagram(); - } - - /** - * @generated - */ - private Collection refreshConnections() { - Domain2Notation domain2NotationMap = new Domain2Notation(); - Collection linkDescriptors = collectAllLinks(getDiagram(), - domain2NotationMap); - Collection existingLinks = new LinkedList(getDiagram().getEdges()); - for (Iterator linksIterator = existingLinks.iterator(); linksIterator - .hasNext();) { - Edge nextDiagramLink = (Edge) linksIterator.next(); - int diagramLinkVisualID = UMLVisualIDRegistry - .getVisualID(nextDiagramLink); - if (diagramLinkVisualID == -1) { - if (nextDiagramLink.getSource() != null - && nextDiagramLink.getTarget() != null) { - linksIterator.remove(); - } - continue; - } - //don't remove notation-only links - if (isNotationOnlyEdge(nextDiagramLink)) { - linksIterator.remove(); - continue; - } - EObject diagramLinkObject = nextDiagramLink.getElement(); - EObject diagramLinkSrc = nextDiagramLink.getSource().getElement(); - EObject diagramLinkDst = nextDiagramLink.getTarget().getElement(); - for (Iterator LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator - .hasNext();) { - UMLLinkDescriptor nextLinkDescriptor = (UMLLinkDescriptor) LinkDescriptorsIterator - .next(); - if (diagramLinkObject == nextLinkDescriptor.getModelElement() - && diagramLinkSrc == nextLinkDescriptor.getSource() - && diagramLinkDst == nextLinkDescriptor - .getDestination() - && diagramLinkVisualID == nextLinkDescriptor - .getVisualID()) { - linksIterator.remove(); - LinkDescriptorsIterator.remove(); - } - } - } - deleteViews(existingLinks.iterator()); - return createConnections(linkDescriptors, domain2NotationMap); - } - - /** - * @generated - */ - private Collection collectAllLinks(View view, - Domain2Notation domain2NotationMap) { - if (!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(view))) { - return Collections.EMPTY_LIST; - } - List result = new LinkedList(); - switch (UMLVisualIDRegistry.getVisualID(view)) { - case PackageEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getPackage_79ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case InteractionEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getInteraction_1001ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case CommentEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getComment_2005ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case Interaction2EditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getInteraction_2001ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case LifelineEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getLifeline_2002ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result - .addAll(UMLDiagramUpdater - .getBehaviorExecutionSpecification_2003ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case CombinedFragmentEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getCombinedFragment_2004ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case MessageEditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getMessage_3001ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case Message2EditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getMessage_3002ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case Message3EditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getMessage_3003ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case Message4EditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getMessage_3004ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case Message5EditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getMessage_3005ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - case Message6EditPart.VISUAL_ID: { - if (!domain2NotationMap.containsKey(view.getElement())) { - result.addAll(UMLDiagramUpdater - .getMessage_3006ContainedLinks(view)); - } - domain2NotationMap.put(view.getElement(), view); - break; - } - } - for (Iterator children = view.getChildren().iterator(); children - .hasNext();) { - View childView = (View) children.next(); - result.addAll(collectAllLinks(childView, domain2NotationMap)); - } - for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) { - View childView = (View) edges.next(); - result.addAll(collectAllLinks(childView, domain2NotationMap)); - } - - if (view instanceof Diagram) { - result.addAll(getReferencesLinkDescriptors((Diagram) view)); - } - removeDuplicatedLinks(result); - purgeCollection(view.getDiagram(), result); - return result; - } - - /** - * @generated - */ - private void removeDuplicatedLinks(List linkDescriptors) { - List toDelete = new ArrayList(); - for (int i = 0; i < linkDescriptors.size(); i++) { - java.lang.Object object1 = linkDescriptors.get(i); - if (object1 instanceof UMLLinkDescriptor) { - UMLLinkDescriptor linkDescriptor1 = (UMLLinkDescriptor) object1; - for (int j = i + 1; j < linkDescriptors.size(); j++) { - java.lang.Object object2 = linkDescriptors.get(j); - if (object2 instanceof UMLLinkDescriptor) { - UMLLinkDescriptor linkDescriptor2 = (UMLLinkDescriptor) object2; - if (checkSameLinkDescriptor(linkDescriptor1, - linkDescriptor2)) { - if (toDelete.contains(linkDescriptor2) == false) { - toDelete.add(linkDescriptor2); - } - } - } - } - } - } - for (java.lang.Object object : toDelete) { - linkDescriptors.remove(object); - } - } - - /** - * @generated - */ - private void purgeCollection(Diagram diagram, Collection list) { - for (Iterator i = list.iterator(); i.hasNext();) { - java.lang.Object obj = i.next(); - if (obj instanceof Collection) { - purgeCollection(diagram, (Collection) obj); - } else { - if (obj instanceof UMLLinkDescriptor) { - UMLLinkDescriptor lDes = (UMLLinkDescriptor) obj; - if (lDes.getModelElement() != null - && !MultiDiagramUtil - .findEObjectReferencedInEAnnotation( - diagram, lDes.getModelElement())) { - i.remove(); - } - } - } - } - } - - /** - * @generated - */ - private boolean checkSameLinkDescriptor(UMLLinkDescriptor link1, - UMLLinkDescriptor link2) { - EObject model1 = link1.getModelElement(); - EObject model2 = link2.getModelElement(); - if (model1 == null && model2 != null) { - return false; - } - if (model1 != null && model2 == null) { - return false; - } - if (model1 != null && model1.equals(model2) == false) { - return false; - } - - EObject source1 = link1.getSource(); - EObject source2 = link2.getSource(); - if (source1 == null && source2 != null) { - return false; - } - if (source1 != null && source2 == null) { - return false; - } - if (source1 != null && source1.equals(source2) == false) { - return false; - } - - EObject destination1 = link1.getDestination(); - EObject destination2 = link2.getDestination(); - if (destination1 == null && destination2 != null) { - return false; - } - if (destination1 != null && destination2 == null) { - return false; - } - if (destination1 != null && destination1.equals(destination2) == false) { - return false; - } - - String type1 = link1.getType(); - String type2 = link2.getType(); - if (type1 == null && type2 != null) { - return false; - } - if (type1 != null && type2 == null) { - return false; - } - if (type1 != null && type1.equals(type2) == false) { - return false; - } - - int visualID1 = link1.getVisualID(); - int visualID2 = link2.getVisualID(); - if (visualID1 <= -1 || visualID2 <= -1) { - return false; - } - if (visualID1 != visualID2) { - return false; - } - - return true; - } - - /** - * @generated - */ - private List getReferencesLinkDescriptors(Diagram diagram) { - List<EObject> references = MultiDiagramUtil - .getAllReferencesInEAnnotation(diagram); - List linkDescriptors = new ArrayList(); - for (EObject eObject : references) { - if (UMLVisualIDRegistry.getLinkWithClassVisualID(eObject) >= 0) { - UMLLinkDescriptor linkDescriptor = UMLDiagramUpdater - .createLinkDescriptorFromModelElement(eObject); - if (linkDescriptor != null) { - linkDescriptors.add(linkDescriptor); - } - } - } - return linkDescriptors; - } - - /** - * @generated - */ - private Collection createConnections(Collection linkDescriptors, - Domain2Notation domain2NotationMap) { - List adapters = new LinkedList(); - for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator - .hasNext();) { - final UMLLinkDescriptor nextLinkDescriptor = (UMLLinkDescriptor) linkDescriptorsIterator - .next(); - EditPart sourceEditPart = getSourceEditPart(nextLinkDescriptor, - domain2NotationMap); - EditPart targetEditPart = getTargetEditPart(nextLinkDescriptor, - domain2NotationMap); - if (sourceEditPart == null || targetEditPart == null) { - continue; - } - CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor( - nextLinkDescriptor.getSemanticAdapter(), null, - ViewUtil.APPEND, false, ((IGraphicalEditPart) getHost()) - .getDiagramPreferencesHint()); - CreateConnectionViewRequest ccr = new CreateConnectionViewRequest( - descriptor); - ccr.setType(RequestConstants.REQ_CONNECTION_START); - ccr.setSourceEditPart(sourceEditPart); - sourceEditPart.getCommand(ccr); - ccr.setTargetEditPart(targetEditPart); - ccr.setType(RequestConstants.REQ_CONNECTION_END); - Command cmd = targetEditPart.getCommand(ccr); - if (cmd != null && cmd.canExecute()) { - executeCommand(cmd); - IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject(); - if (viewAdapter != null) { - adapters.add(viewAdapter); - } - } - } - return adapters; - } - - /** - * @generated - */ - private EditPart getEditPart(EObject domainModelElement, - Domain2Notation domain2NotationMap) { - View view = (View) domain2NotationMap.get(domainModelElement); - if (view != null) { - return (EditPart) getHost().getViewer().getEditPartRegistry().get( - view); - } - return null; - } - - /** - * @generated - */ - private EditPart getSourceEditPart(UMLLinkDescriptor descriptor, - Domain2Notation domain2NotationMap) { - return getEditPart(descriptor.getSource(), domain2NotationMap); - } - - /** - * @generated - */ - private EditPart getTargetEditPart(UMLLinkDescriptor descriptor, - Domain2Notation domain2NotationMap) { - return getEditPart(descriptor.getDestination(), domain2NotationMap); - } - - /** - * @generated - */ - protected final EditPart getHintedEditPart(EObject domainModelElement, - Domain2Notation domain2NotationMap, int hintVisualId) { - View view = (View) domain2NotationMap.getHinted(domainModelElement, - UMLVisualIDRegistry.getType(hintVisualId)); - if (view != null) { - return (EditPart) getHost().getViewer().getEditPartRegistry().get( - view); - } - return null; - } - - /** - * @generated - */ - private boolean isNotationOnlyEdge(Edge edge) { - return false; - } - - /** - * @generated - */ - private static class Domain2Notation { - /** - * @generated - */ - private final HashMap myMap = new HashMap(); - - /** - * @generated - */ - public boolean containsDomainElement(EObject domainElement) { - return myMap.containsKey(domainElement); - } - - /** - * @generated - */ - public boolean containsKey(EObject domainElement) { - return containsDomainElement(domainElement); - } - - /** - * @generated - */ - public void put(EObject domainElement, View view) { - Object viewOrList = myMap.get(domainElement); - if (viewOrList instanceof View) { - myMap.remove(domainElement); - List<View> list = new LinkedList<View>(); - list.add((View) viewOrList); - myMap.put(domainElement, list); - list.add(view); - } else if (viewOrList instanceof List) { - ((List) viewOrList).add(view); - } else { - myMap.put(domainElement, view); - } - } - - /** - * @generated - */ - public View get(EObject domainEObject) { - Object viewOrList = myMap.get(domainEObject); - if (viewOrList instanceof View) { - return (View) viewOrList; - } - if (viewOrList instanceof List) { - // preferring not-shortcut to shortcut -- important for cases when links arr to/from - // the element that is additionally shortcutted to the same diagram - for (Object next : (List) viewOrList) { - View nextView = (View) next; - if (nextView.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$ - return nextView; - } - } - return (View) ((List) viewOrList).get(0); - } - return null; - } - - /** - * @generated - */ - public View getHinted(EObject domainEObject, String hint) { - if (hint == null) { - return get(domainEObject); - } - Object viewOrList = myMap.get(domainEObject); - if (viewOrList instanceof View) { - //no choice, will return what we have - return (View) viewOrList; - } - for (Object next : (List) viewOrList) { - View nextView = (View) next; - if (hint.equals(nextView.getType())) { - return nextView; - } - } - //hint not found -- return what we have - return (View) ((List) viewOrList).get(0); - } - - } - - /** - * @NOT-generated - */ - @Override - protected boolean shouldHandleNotificationEvent(Notification event) { - // Created events in a Package don't need to refresh the diagram. This - // is done to avoid to refresh the diagram - // before the end of the MessageXCreateCommand. Remember that the Events - // of a Message are created during - // the "doDefaultMessageInitialize" operation. - if (event.getNewValue() instanceof Event) { - return false; - } - return super.shouldHandleNotificationEvent(event); - } - - /** - * @NOT-generated - * {@inheritDoc} - */ - @Override - public boolean canCreate(EObject object) { - // The returned value before was true. However, in order to make the Delete - // From Diagram action work, it should return false. The elements that shouldn't - // have enabled the delete diagram action, are controlled with the - // SequenceDeleteOnlyViewComponentEditPolicy. - return false; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java deleted file mode 100644 index 706ce128822..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java +++ /dev/null @@ -1,146 +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.policies; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLSwitch; - -import org.eclipse.papyrus.diagram.common.commands.DuplicateAnythingCommand; -import org.eclipse.papyrus.diagram.common.part.DiagramCanvasSwitch; -import org.eclipse.papyrus.diagram.common.util.BasicEcoreSwitch; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.CommentCreateCommand; -import org.eclipse.papyrus.diagram.sequence.edit.commands.InteractionCreateCommand; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class PackageItemSemanticEditPolicy extends - UMLBaseItemSemanticEditPolicy { - - /** - * @generated NOT - * - * modified to handle an Interaction as canvas element. - */ - static class EReferenceDiagramSwitch extends - BasicEcoreSwitch<EReference, IElementType> { - @Override - public EReference doSwitch(EObject modelElement) { - - final IElementType type = getInfo(); - if (type == null) { - return null; - } - UMLSwitch<EReference> aSwitch = new UMLSwitch<EReference>() { - @Override - public EReference casePackage(Package modelElement) { - EReference reference = null; - if (type.equals(UMLElementTypes.Interaction_1001)) { - reference = UMLPackage.eINSTANCE - .getPackage_PackagedElement(); - } - if (type.equals(UMLElementTypes.Comment_2005)) { - reference = UMLPackage.eINSTANCE - .getElement_OwnedComment(); - } - - return reference; - } - - @Override - public EReference caseInteraction(Interaction modelElement) { - EReference reference = null; - if (type.equals(UMLElementTypes.Comment_2005)) { - reference = UMLPackage.eINSTANCE - .getElement_OwnedComment(); - } - return reference; - } - - }; - - return aSwitch.doSwitch(modelElement); - } - } - - /** - * @generated - */ - private EReferenceDiagramSwitch aSwitch = new EReferenceDiagramSwitch(); - - /** - * @generated - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - Diagram diagram = DiagramEditPartsUtil - .findDiagramFromEditPart(getHost()); - if (diagram != null) { - req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, - diagram); - } - EObject canvasElement = DiagramCanvasSwitch.getCanvasElement(this); - if (canvasElement == null) { - return null; - } - aSwitch.setInfo(req.getElementType()); - req.setContainmentFeature(aSwitch.doSwitch(canvasElement)); - if (UMLElementTypes.Interaction_1001 == req.getElementType()) { - return getGEFWrapper(InteractionCreateCommand.create(req, - canvasElement)); - } - if (UMLElementTypes.Comment_2005 == req.getElementType()) { - return getGEFWrapper(CommentCreateCommand - .create(req, canvasElement)); - } - return super.getCreateCommand(req); - } - - /** - * Modified by gmerin: Sequence diagram should only allow duplicate of - * Interactions Interaction elements - * - * @generated NOT - */ - @Override - protected Command getDuplicateCommand(DuplicateElementsRequest req) { - // Only Interactions should be duplicated - for (Object obj : req.getElementsToBeDuplicated()) { - if (!(obj instanceof Interaction)) - return null; - } - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - Diagram currentDiagram = null; - if (getHost() instanceof IGraphicalEditPart) { - currentDiagram = ((IGraphicalEditPart) getHost()).getNotationView() - .getDiagram(); - } - return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req, - currentDiagram)); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLBaseItemSemanticEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLBaseItemSemanticEditPolicy.java deleted file mode 100644 index db1fd26819f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ /dev/null @@ -1,737 +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.policies; - -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; -import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; -import org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -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.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.sequence.edit.helpers.UMLBaseEditHelper; -import org.eclipse.papyrus.diagram.sequence.expressions.UMLAbstractExpression; -import org.eclipse.papyrus.diagram.sequence.expressions.UMLOCLFactory; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { - - /** - * Extended request data key to hold editpart visual id. - * - * @generated - */ - public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$ - - /** - * Extended request data key to hold editpart visual id. - * Add visual id of edited editpart to extended data of the request - * so command switch can decide what kind of diagram element is being edited. - * It is done in those cases when it's not possible to deduce diagram - * element kind from domain element. - * - * @generated - */ - @Override - public Command getCommand(Request request) { - if (request instanceof ReconnectRequest) { - Object view = ((ReconnectRequest) request).getConnectionEditPart() - .getModel(); - if (view instanceof View) { - Integer id = new Integer(UMLVisualIDRegistry - .getVisualID((View) view)); - request.getExtendedData().put(VISUAL_ID_KEY, id); - } - } - return super.getCommand(request); - } - - /** - * Returns visual id from request parameters. - * - * @generated - */ - protected int getVisualID(IEditCommandRequest request) { - Object id = request.getParameter(VISUAL_ID_KEY); - return id instanceof Integer ? ((Integer) id).intValue() : -1; - } - - /** - * @generated - */ - @Override - protected Command getSemanticCommand(IEditCommandRequest request) { - IEditCommandRequest completedRequest = completeRequest(request); - Object editHelperContext = completedRequest.getEditHelperContext(); - if (editHelperContext instanceof View - || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext) - .getEObject() instanceof View)) { - // no semantic commands are provided for pure design elements - return null; - } - if (editHelperContext == null) { - editHelperContext = ViewUtil - .resolveSemanticElement((View) getHost().getModel()); - } - IElementType elementType = ElementTypeRegistry.getInstance() - .getElementType(editHelperContext); - if (elementType == ElementTypeRegistry.getInstance().getType( - "org.eclipse.gmf.runtime.emf.type.core.default")) { //$NON-NLS-1$ - elementType = null; - } - Command semanticCommand = getSemanticCommandSwitch(completedRequest); - if (semanticCommand != null) { - ICommand command = semanticCommand instanceof ICommandProxy ? ((ICommandProxy) semanticCommand) - .getICommand() - : new CommandProxy(semanticCommand); -// completedRequest.setParameter( -// UMLBaseEditHelper.EDIT_POLICY_COMMAND, command); - } - if (elementType != null) { - ICommand command = elementType.getEditCommand(completedRequest); - if (command != null) { - if (!(command instanceof CompositeTransactionalCommand)) { - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - command = new CompositeTransactionalCommand(editingDomain, - command.getLabel()).compose(command); - } - semanticCommand = new ICommandProxy(command); - } - } - boolean shouldProceed = true; - if (completedRequest instanceof DestroyRequest) { - shouldProceed = shouldProceed((DestroyRequest) completedRequest); - } - if (shouldProceed) { - if (completedRequest instanceof DestroyRequest) { - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - Command deleteViewCommand = new ICommandProxy( - new DeleteCommand(editingDomain, (View) getHost() - .getModel())); - semanticCommand = semanticCommand == null ? deleteViewCommand - : semanticCommand.chain(deleteViewCommand); - } - return semanticCommand; - } - return null; - } - - /** - * @generated - */ - protected Command getSemanticCommandSwitch(IEditCommandRequest req) { - if (req instanceof CreateRelationshipRequest) { - return getCreateRelationshipCommand((CreateRelationshipRequest) req); - } else if (req instanceof CreateElementRequest) { - return getCreateCommand((CreateElementRequest) req); - } else if (req instanceof ConfigureRequest) { - return getConfigureCommand((ConfigureRequest) req); - } else if (req instanceof DestroyElementRequest) { - return getDestroyElementCommand((DestroyElementRequest) req); - } else if (req instanceof DestroyReferenceRequest) { - return getDestroyReferenceCommand((DestroyReferenceRequest) req); - } else if (req instanceof DuplicateElementsRequest) { - return getDuplicateCommand((DuplicateElementsRequest) req); - } else if (req instanceof GetEditContextRequest) { - return getEditContextCommand((GetEditContextRequest) req); - } else if (req instanceof MoveRequest) { - return getMoveCommand((MoveRequest) req); - } else if (req instanceof ReorientReferenceRelationshipRequest) { - return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req); - } else if (req instanceof ReorientRelationshipRequest) { - return getReorientRelationshipCommand((ReorientRelationshipRequest) req); - } else if (req instanceof SetRequest) { - return getSetCommand((SetRequest) req); - } - return null; - } - - /** - * @generated - */ - protected Command getConfigureCommand(ConfigureRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getCreateCommand(CreateElementRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getSetCommand(SetRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getEditContextCommand(GetEditContextRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getDuplicateCommand(DuplicateElementsRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getMoveCommand(MoveRequest req) { - return null; - } - - /** - * @generated - */ - protected Command getReorientReferenceRelationshipCommand( - ReorientReferenceRelationshipRequest req) { - return UnexecutableCommand.INSTANCE; - } - - /** - * @generated - */ - protected Command getReorientRelationshipCommand( - ReorientRelationshipRequest req) { - return UnexecutableCommand.INSTANCE; - } - - /** - * @generated - */ - protected final Command getGEFWrapper(ICommand cmd) { - return new ICommandProxy(cmd); - } - - /** - * @deprecated use getGEFWrapper() instead - * @generated - */ - @Deprecated - protected final Command getMSLWrapper(ICommand cmd) { - // XXX deprecated: use getGEFWrapper() instead - return getGEFWrapper(cmd); - } - - /** - * @generated - */ - protected EObject getSemanticElement() { - return ViewUtil.resolveSemanticElement((View) getHost().getModel()); - } - - /** - * Returns editing domain from the host edit part. - * - * @generated - */ - protected TransactionalEditingDomain getEditingDomain() { - return ((IGraphicalEditPart) getHost()).getEditingDomain(); - } - - /** - * Creates command to destroy the link. - * - * @generated - */ - protected Command getDestroyElementCommand(View view) { - EditPart editPart = (EditPart) getHost().getViewer() - .getEditPartRegistry().get(view); - DestroyElementRequest request = new DestroyElementRequest( - getEditingDomain(), false); - return editPart.getCommand(new EditCommandRequestWrapper(request, - Collections.EMPTY_MAP)); - } - - /** - * Creates commands to destroy all host incoming and outgoing links. - * - * @generated - */ - protected CompoundCommand getDestroyEdgesCommand() { - CompoundCommand cmd = new CompoundCommand(); - View view = (View) getHost().getModel(); - for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) { - cmd.add(getDestroyElementCommand((Edge) it.next())); - } - for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) { - cmd.add(getDestroyElementCommand((Edge) it.next())); - } - return cmd; - } - - /** - * @generated - */ - protected void addDestroyShortcutsCommand(CompoundCommand command) { - View view = (View) getHost().getModel(); - if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ - return; - } - for (Iterator it = view.getDiagram().getChildren().iterator(); it - .hasNext();) { - View nextView = (View) it.next(); - if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$ - continue; - } - command.add(getDestroyElementCommand(nextView)); - } - } - - /** - * @generated - */ - public static class LinkConstraints { - /** - * @generated - */ - private static final String OPPOSITE_END_VAR = "oppositeEnd"; //$NON-NLS-1$ - - /** - * @generated - */ - private static UMLAbstractExpression Message_3001_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3002_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3003_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3004_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3005_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3006_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression ElementOwnedComment_3007_TargetExpression; - - /** - * @generated - */ - private static UMLAbstractExpression CommentAnnotatedElement_3008_SourceExpression; - - /** - * @generated - */ - public static boolean canCreateMessage_3001(Interaction container, - Element source, Element target) { - return canExistMessage_3001(container, source, target); - } - - /** - * @generated - */ - public static boolean canCreateMessage_3002(Interaction container, - Element source, Element target) { - return canExistMessage_3002(container, source, target); - } - - /** - * @generated - */ - public static boolean canCreateMessage_3003(Interaction container, - Element source, Element target) { - return canExistMessage_3003(container, source, target); - } - - /** - * @generated - */ - public static boolean canCreateMessage_3004(Interaction container, - Element source, Element target) { - return canExistMessage_3004(container, source, target); - } - - /** - * @generated - */ - public static boolean canCreateMessage_3005(Interaction container, - Element source, Element target) { - return canExistMessage_3005(container, source, target); - } - - /** - * @generated - */ - public static boolean canCreateMessage_3006(Interaction container, - Element source, Element target) { - return canExistMessage_3006(container, source, target); - } - - /** - * @generated - */ - public static boolean canCreateElementOwnedComment_3007(Element source, - Comment target) { - if (source != null) { - if (source.getOwnedComments().contains(target)) { - return false; - } - if (source == target) { - return false; - } - } - return canExistElementOwnedComment_3007(source, target); - } - - /** - * @generated - */ - public static boolean canCreateCommentAnnotatedElement_3008( - Comment source, Element target) { - if (source != null) { - if (source.getAnnotatedElements().contains(target)) { - return false; - } - } - return canExistCommentAnnotatedElement_3008(source, target); - } - - /** - * @generated - */ - public static boolean canExistMessage_3001(Interaction container, - Element source, Element target) { - try { - if (target == null) { - return true; - } - if (Message_3001_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - Message_3001_TargetExpression = UMLOCLFactory - .getExpression( - "((self.oclIsKindOf(uml::ExecutionSpecification) or self.oclIsKindOf(uml::Lifeline)) and (oppositeEnd.oclIsKindOf(uml::ExecutionSpecification) or oppositeEnd.oclIsKindOf(uml::Lifeline))) and (self.eContainer() = oppositeEnd.eContainer())", UMLPackage.eINSTANCE.getElement(), env); //$NON-NLS-1$ - } - Object targetVal = Message_3001_TargetExpression.evaluate( - target, Collections.singletonMap(OPPOSITE_END_VAR, - source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistMessage_3002(Interaction container, - Element source, Element target) { - try { - if (target == null) { - return true; - } - if (Message_3002_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - Message_3002_TargetExpression = UMLOCLFactory - .getExpression( - "((self.oclIsKindOf(uml::ExecutionSpecification) or self.oclIsKindOf(uml::Lifeline)) and (oppositeEnd.oclIsKindOf(uml::ExecutionSpecification) or oppositeEnd.oclIsKindOf(uml::Lifeline))) and (self.eContainer() = oppositeEnd.eContainer())", UMLPackage.eINSTANCE.getElement(), env); //$NON-NLS-1$ - } - Object targetVal = Message_3002_TargetExpression.evaluate( - target, Collections.singletonMap(OPPOSITE_END_VAR, - source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistMessage_3003(Interaction container, - Element source, Element target) { - try { - if (target == null) { - return true; - } - if (Message_3003_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - Message_3003_TargetExpression = UMLOCLFactory - .getExpression( - "((self.oclIsKindOf(uml::ExecutionSpecification) or self.oclIsKindOf(uml::Lifeline)) and (oppositeEnd.oclIsKindOf(uml::ExecutionSpecification) or oppositeEnd.oclIsKindOf(uml::Lifeline))) and (self.eContainer() = oppositeEnd.eContainer())", UMLPackage.eINSTANCE.getElement(), env); //$NON-NLS-1$ - } - Object targetVal = Message_3003_TargetExpression.evaluate( - target, Collections.singletonMap(OPPOSITE_END_VAR, - source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistMessage_3004(Interaction container, - Element source, Element target) { - try { - if (target == null) { - return true; - } - if (Message_3004_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - Message_3004_TargetExpression = UMLOCLFactory - .getExpression( - "((self.oclIsKindOf(uml::ExecutionSpecification) or self.oclIsKindOf(uml::Lifeline)) and (oppositeEnd.oclIsKindOf(uml::ExecutionSpecification) or oppositeEnd.oclIsKindOf(uml::Lifeline))) and (self.eContainer() = oppositeEnd.eContainer())", UMLPackage.eINSTANCE.getElement(), env); //$NON-NLS-1$ - } - Object targetVal = Message_3004_TargetExpression.evaluate( - target, Collections.singletonMap(OPPOSITE_END_VAR, - source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistMessage_3005(Interaction container, - Element source, Element target) { - try { - if (target == null) { - return true; - } - if (Message_3005_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - Message_3005_TargetExpression = UMLOCLFactory - .getExpression( - "((self.oclIsKindOf(uml::ExecutionSpecification) or self.oclIsKindOf(uml::Lifeline)) and (oppositeEnd.oclIsKindOf(uml::ExecutionSpecification) or oppositeEnd.oclIsKindOf(uml::Lifeline))) and (self.eContainer() = oppositeEnd.eContainer())", UMLPackage.eINSTANCE.getElement(), env); //$NON-NLS-1$ - } - Object targetVal = Message_3005_TargetExpression.evaluate( - target, Collections.singletonMap(OPPOSITE_END_VAR, - source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistMessage_3006(Interaction container, - Element source, Element target) { - try { - if (target == null) { - return true; - } - if (Message_3006_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - Message_3006_TargetExpression = UMLOCLFactory - .getExpression( - "((self.oclIsKindOf(uml::ExecutionSpecification) or self.oclIsKindOf(uml::Lifeline)) and (oppositeEnd.oclIsKindOf(uml::ExecutionSpecification) or oppositeEnd.oclIsKindOf(uml::Lifeline))) and (self.eContainer() = oppositeEnd.eContainer())", UMLPackage.eINSTANCE.getElement(), env); //$NON-NLS-1$ - } - Object targetVal = Message_3006_TargetExpression.evaluate( - target, Collections.singletonMap(OPPOSITE_END_VAR, - source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistElementOwnedComment_3007(Element source, - Comment target) { - try { - if (target == null) { - return true; - } - if (ElementOwnedComment_3007_TargetExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - ElementOwnedComment_3007_TargetExpression = UMLOCLFactory - .getExpression( - "not(self.annotatedElement->includes(oppositeEnd))", UMLPackage.eINSTANCE.getComment(), env); //$NON-NLS-1$ - } - Object targetVal = ElementOwnedComment_3007_TargetExpression - .evaluate(target, Collections.singletonMap( - OPPOSITE_END_VAR, source)); - if (false == targetVal instanceof Boolean - || !((Boolean) targetVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - /** - * @generated - */ - public static boolean canExistCommentAnnotatedElement_3008( - Comment source, Element target) { - try { - if (source == null) { - return true; - } - if (CommentAnnotatedElement_3008_SourceExpression == null) { - Map env = Collections.singletonMap(OPPOSITE_END_VAR, - UMLPackage.eINSTANCE.getElement()); - CommentAnnotatedElement_3008_SourceExpression = UMLOCLFactory - .getExpression( - "not(self.annotatedElement->includes(oppositeEnd))", UMLPackage.eINSTANCE.getComment(), env); //$NON-NLS-1$ - } - Object sourceVal = CommentAnnotatedElement_3008_SourceExpression - .evaluate(source, Collections.singletonMap( - OPPOSITE_END_VAR, target)); - if (false == sourceVal instanceof Boolean - || !((Boolean) sourceVal).booleanValue()) { - return false; - } // else fall-through - return true; - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Link constraint evaluation error", e); //$NON-NLS-1$ - return false; - } - } - - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLTextNonResizableEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLTextNonResizableEditPolicy.java deleted file mode 100644 index 5b48496d105..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLTextNonResizableEditPolicy.java +++ /dev/null @@ -1,219 +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.policies; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx; -import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; - -/** - * @generated - */ -public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx { - - /** - * @generated - */ - private IFigure selectionFeedbackFigure; - - /** - * @generated - */ - private IFigure focusFeedbackFigure; - - /** - * @generated - */ - @Override - protected void showPrimarySelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - showSelection(); - showFocus(); - } - } - - /** - * @generated - */ - @Override - protected void showSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - hideSelection(); - addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); - refreshSelectionFeedback(); - hideFocus(); - } - } - - /** - * @generated - */ - @Override - protected void hideSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(false); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (selectionFeedbackFigure != null) { - removeFeedback(selectionFeedbackFigure); - selectionFeedbackFigure = null; - } - hideFocus(); - } - } - - /** - * @generated - */ - @Override - protected void showFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - hideFocus(); - addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); - refreshFocusFeedback(); - } - } - - /** - * @generated - */ - @Override - protected void hideFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (focusFeedbackFigure != null) { - removeFeedback(focusFeedbackFigure); - focusFeedbackFigure = null; - } - } - } - - /** - * @generated - */ - protected Rectangle getFeedbackBounds() { - Rectangle bounds; - if (getHostFigure() instanceof Label) { - bounds = ((Label) getHostFigure()).getTextBounds(); - bounds.intersect(getHostFigure().getBounds()); - } else { - bounds = getHostFigure().getBounds().getCopy(); - } - getHostFigure().getParent().translateToAbsolute(bounds); - getFeedbackLayer().translateToRelative(bounds); - return bounds; - } - - /** - * @generated - */ - protected IFigure createSelectionFeedbackFigure() { - if (getHostFigure() instanceof Label) { - Label feedbackFigure = new Label(); - feedbackFigure.setOpaque(true); - feedbackFigure - .setBackgroundColor(ColorConstants.menuBackgroundSelected); - feedbackFigure - .setForegroundColor(ColorConstants.menuForegroundSelected); - return feedbackFigure; - } else { - RectangleFigure feedbackFigure = new RectangleFigure(); - feedbackFigure.setFill(false); - return feedbackFigure; - } - } - - /** - * @generated - */ - protected IFigure createFocusFeedbackFigure() { - return new Figure() { - - protected void paintFigure(Graphics graphics) { - graphics.drawFocus(getBounds().getResized(-1, -1)); - } - }; - } - - /** - * @generated - */ - protected void updateLabel(Label target) { - Label source = (Label) getHostFigure(); - target.setText(source.getText()); - target.setTextAlignment(source.getTextAlignment()); - target.setFont(source.getFont()); - } - - /** - * @generated - */ - protected void refreshSelectionFeedback() { - if (selectionFeedbackFigure != null) { - if (selectionFeedbackFigure instanceof Label) { - updateLabel((Label) selectionFeedbackFigure); - selectionFeedbackFigure.setBounds(getFeedbackBounds()); - } else { - selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, - 5)); - } - } - } - - /** - * @generated - */ - protected void refreshFocusFeedback() { - if (focusFeedbackFigure != null) { - focusFeedbackFigure.setBounds(getFeedbackBounds()); - } - } - - /** - * @generated - */ - public void refreshFeedback() { - refreshSelectionFeedback(); - refreshFocusFeedback(); - } - - /** - * @generated - */ - @Override - protected List createSelectionHandles() { - MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost()); - moveHandle.setBorder(null); - moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost())); - return Collections.singletonList(moveHandle); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLTextSelectionEditPolicy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLTextSelectionEditPolicy.java deleted file mode 100644 index e6df5781e56..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/edit/policies/UMLTextSelectionEditPolicy.java +++ /dev/null @@ -1,202 +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.policies; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.editpolicies.SelectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; - -/** - * @generated - */ -public class UMLTextSelectionEditPolicy extends SelectionEditPolicy { - - /** - * @generated - */ - private IFigure selectionFeedbackFigure; - - /** - * @generated - */ - private IFigure focusFeedbackFigure; - - /** - * @generated - */ - @Override - protected void showPrimarySelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - showSelection(); - showFocus(); - } - } - - /** - * @generated - */ - @Override - protected void showSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - hideSelection(); - addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); - refreshSelectionFeedback(); - hideFocus(); - } - } - - /** - * @generated - */ - @Override - protected void hideSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(false); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (selectionFeedbackFigure != null) { - removeFeedback(selectionFeedbackFigure); - selectionFeedbackFigure = null; - } - hideFocus(); - } - } - - /** - * @generated - */ - @Override - protected void showFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - hideFocus(); - addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); - refreshFocusFeedback(); - } - } - - /** - * @generated - */ - @Override - protected void hideFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (focusFeedbackFigure != null) { - removeFeedback(focusFeedbackFigure); - focusFeedbackFigure = null; - } - } - } - - /** - * @generated - */ - protected Rectangle getFeedbackBounds() { - Rectangle bounds; - if (getHostFigure() instanceof Label) { - bounds = ((Label) getHostFigure()).getTextBounds(); - bounds.intersect(getHostFigure().getBounds()); - } else { - bounds = getHostFigure().getBounds().getCopy(); - } - getHostFigure().getParent().translateToAbsolute(bounds); - getFeedbackLayer().translateToRelative(bounds); - return bounds; - } - - /** - * @generated - */ - protected IFigure createSelectionFeedbackFigure() { - if (getHostFigure() instanceof Label) { - Label feedbackFigure = new Label(); - feedbackFigure.setOpaque(true); - feedbackFigure - .setBackgroundColor(ColorConstants.menuBackgroundSelected); - feedbackFigure - .setForegroundColor(ColorConstants.menuForegroundSelected); - return feedbackFigure; - } else { - RectangleFigure feedbackFigure = new RectangleFigure(); - feedbackFigure.setFill(false); - return feedbackFigure; - } - } - - /** - * @generated - */ - protected IFigure createFocusFeedbackFigure() { - return new Figure() { - - protected void paintFigure(Graphics graphics) { - graphics.drawFocus(getBounds().getResized(-1, -1)); - } - }; - } - - /** - * @generated - */ - protected void updateLabel(Label target) { - Label source = (Label) getHostFigure(); - target.setText(source.getText()); - target.setTextAlignment(source.getTextAlignment()); - target.setFont(source.getFont()); - } - - /** - * @generated - */ - protected void refreshSelectionFeedback() { - if (selectionFeedbackFigure != null) { - if (selectionFeedbackFigure instanceof Label) { - updateLabel((Label) selectionFeedbackFigure); - selectionFeedbackFigure.setBounds(getFeedbackBounds()); - } else { - selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, - 5)); - } - } - } - - /** - * @generated - */ - protected void refreshFocusFeedback() { - if (focusFeedbackFigure != null) { - focusFeedbackFigure.setBounds(getFeedbackBounds()); - } - } - - /** - * @generated - */ - public void refreshFeedback() { - refreshSelectionFeedback(); - refreshFocusFeedback(); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/expressions/UMLAbstractExpression.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/expressions/UMLAbstractExpression.java deleted file mode 100644 index ed9ebb0cbf5..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/expressions/UMLAbstractExpression.java +++ /dev/null @@ -1,165 +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.expressions; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Collections; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EEnumLiteral; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public abstract class UMLAbstractExpression { - - /** - * @generated - */ - private IStatus status = Status.OK_STATUS; - - /** - * @generated - */ - protected UMLAbstractExpression(String body, EClassifier context) { - myBody = body; - myContext = context; - } - - /** - * @generated - */ - protected void setStatus(int severity, String message, Throwable throwable) { - String pluginID = UMLDiagramEditorPlugin.ID; - this.status = new Status(severity, pluginID, -1, - (message != null) ? message : "", throwable); //$NON-NLS-1$ - if (!this.status.isOK()) { - UMLDiagramEditorPlugin - .getInstance() - .logError( - "Expression problem:" + message + "body:" + body(), throwable); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * @generated - */ - protected abstract Object doEvaluate(Object context, Map env); - - /** - * @generated - */ - public Object evaluate(Object context) { - return evaluate(context, Collections.EMPTY_MAP); - } - - /** - * @generated - */ - public Object evaluate(Object context, Map env) { - if (context().isInstance(context)) { - try { - return doEvaluate(context, env); - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Expression evaluation failure: " + body(), e);//$NON-NLS-1$ - } - } - return null; - } - - /** - * Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected - * @generated - */ - public static Object performCast(Object value, EDataType targetType) { - if (targetType instanceof EEnum) { - if (value instanceof EEnumLiteral) { - EEnumLiteral literal = (EEnumLiteral) value; - return (literal.getInstance() != null) ? literal.getInstance() - : literal; - } - } - if (false == value instanceof Number || targetType == null - || targetType.getInstanceClass() == null) { - return value; - } - Class targetClass = targetType.getInstanceClass(); - Number num = (Number) value; - Class valClass = value.getClass(); - Class targetWrapperClass = targetClass; - if (targetClass.isPrimitive()) { - targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass); - } - if (valClass.equals(targetWrapperClass)) { - return value; - } - if (Number.class.isAssignableFrom(targetWrapperClass)) { - if (targetWrapperClass.equals(Byte.class)) - return new Byte(num.byteValue()); - if (targetWrapperClass.equals(Integer.class)) - return new Integer(num.intValue()); - if (targetWrapperClass.equals(Short.class)) - return new Short(num.shortValue()); - if (targetWrapperClass.equals(Long.class)) - return new Long(num.longValue()); - if (targetWrapperClass.equals(BigInteger.class)) - return BigInteger.valueOf(num.longValue()); - if (targetWrapperClass.equals(Float.class)) - return new Float(num.floatValue()); - if (targetWrapperClass.equals(Double.class)) - return new Double(num.doubleValue()); - if (targetWrapperClass.equals(BigDecimal.class)) - return new BigDecimal(num.doubleValue()); - } - return value; - } - - /** - * @generated - */ - public IStatus getStatus() { - return status; - } - - /** - * @generated - */ - private final String myBody; - - /** - * @generated - */ - public String body() { - return myBody; - } - - /** - * @generated - */ - private final EClassifier myContext; - - /** - * @generated - */ - public EClassifier context() { - return myContext; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/expressions/UMLOCLFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/expressions/UMLOCLFactory.java deleted file mode 100644 index 24081025d18..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/expressions/UMLOCLFactory.java +++ /dev/null @@ -1,214 +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.expressions; - -import java.lang.ref.WeakReference; -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.ocl.Environment; -import org.eclipse.ocl.EvaluationEnvironment; -import org.eclipse.ocl.ParserException; -import org.eclipse.ocl.Query; -import org.eclipse.ocl.ecore.EcoreFactory; -import org.eclipse.ocl.expressions.OCLExpression; -import org.eclipse.ocl.expressions.OperationCallExp; -import org.eclipse.ocl.expressions.Variable; -import org.eclipse.ocl.helper.OCLHelper; -import org.eclipse.ocl.utilities.AbstractVisitor; -import org.eclipse.ocl.utilities.PredefinedType; -import org.eclipse.papyrus.diagram.common.parser.lookup.OCLLookup; - - - -/** - * @generated - */ -public class UMLOCLFactory { - - /** - * @generated - */ - private UMLOCLFactory() { - } - - /** - * @generated - */ - public static UMLAbstractExpression getExpression(String body, - EClassifier context, Map environment) { - return new Expression(body, context, environment); - } - - /** - * @generated - */ - public static UMLAbstractExpression getExpression(String body, - EClassifier context) { - return getExpression(body, context, Collections.EMPTY_MAP); - } - - /** - * @generated - */ - private static class Expression extends UMLAbstractExpression { - - /** - * @generated - */ - private WeakReference queryRef; - - /** - * @generated - */ - private final org.eclipse.ocl.ecore.OCL oclInstance; - - /** - * @generated - */ - public Expression(String body, EClassifier context, Map environment) { - super(body, context); - oclInstance = org.eclipse.ocl.ecore.OCL.newInstance(); - initCustomEnv(oclInstance.getEnvironment(), environment); - } - - /** - * @generated - */ - protected Query getQuery() { - Query oclQuery = null; - if (this.queryRef != null) { - oclQuery = (Query) this.queryRef.get(); - } - if (oclQuery == null) { - OCLHelper oclHelper = oclInstance.createOCLHelper(); - oclHelper.setContext(context()); - try { - OCLExpression oclExpression = oclHelper.createQuery(body()); - oclQuery = oclInstance.createQuery(oclExpression); - this.queryRef = new WeakReference(oclQuery); - setStatus(IStatus.OK, null, null); - } catch (ParserException e) { - setStatus(IStatus.ERROR, e.getMessage(), e); - } - } - return oclQuery; - } - - /** - * @generated - */ - @Override - protected Object doEvaluate(Object context, Map env) { - Query oclQuery = getQuery(); - if (oclQuery == null) { - return null; - } - EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment(); - // init environment - for (Iterator it = env.entrySet().iterator(); it.hasNext();) { - Map.Entry nextEntry = (Map.Entry) it.next(); - evalEnv.replace((String) nextEntry.getKey(), nextEntry - .getValue()); - } - try { - initExtentMap(context); - Object result = oclQuery.evaluate(context); - return (result != oclInstance.getEnvironment() - .getOCLStandardLibrary().getOclInvalid()) ? result - : null; - } finally { - evalEnv.clear(); - oclQuery.getExtentMap().clear(); - } - } - - /** - * @generated - */ - private void initExtentMap(Object context) { - if (!getStatus().isOK() || context == null) { - return; - } - final Query queryToInit = getQuery(); - final Object extentContext = context; - queryToInit.getExtentMap().clear(); - if (queryToInit.queryText() != null - && queryToInit.queryText().indexOf( - PredefinedType.ALL_INSTANCES_NAME) >= 0) { - AbstractVisitor visitior = new AbstractVisitor() { - - private boolean usesAllInstances = false; - - public Object visitOperationCallExp(OperationCallExp oc) { - if (!usesAllInstances) { - usesAllInstances = PredefinedType.ALL_INSTANCES == oc - .getOperationCode(); - if (usesAllInstances) { - queryToInit - .getExtentMap() - .putAll( - oclInstance - .getEvaluationEnvironment() - .createExtentMap( - extentContext)); - } - } - return super.visitOperationCallExp(oc); - } - }; - queryToInit.getExpression().accept(visitior); - } - } - - /** - * @generated - */ - private static void initCustomEnv(Environment ecoreEnv, Map environment) { - for (Iterator it = environment.keySet().iterator(); it.hasNext();) { - String varName = (String) it.next(); - EClassifier varType = (EClassifier) environment.get(varName); - ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, - varType), false); - } - } - - /** - * @generated - */ - private static Variable createVar(Environment ecoreEnv, String name, - EClassifier type) { - Variable var = EcoreFactory.eINSTANCE.createVariable(); - var.setName(name); - var.setType(ecoreEnv.getUMLReflection().getOCLType(type)); - return var; - } - } - - /** - * @generated - */ - public static OCLLookup.Expression getOCLLookupExpression(String body, - EClassifier context) { - final UMLAbstractExpression expression = getExpression(body, context); - if (!expression.getStatus().isOK()) { - throw new IllegalArgumentException("Bad OCL:" + body); - } - return new OCLLookup.Expression() { - public Object evaluate(Object context) { - return expression.evaluate(context); - } - }; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLAbstractNavigatorItem.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLAbstractNavigatorItem.java deleted file mode 100644 index 369713b8e77..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLAbstractNavigatorItem.java +++ /dev/null @@ -1,71 +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.navigator; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; - -/** - * @generated - */ -public abstract class UMLAbstractNavigatorItem extends PlatformObject { - - /** - * @generated - */ - static { - final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class }; - final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() { - public String getContributorId() { - return "org.eclipse.papyrus.diagram.sequence"; //$NON-NLS-1$ - } - }; - Platform.getAdapterManager().registerAdapters( - new IAdapterFactory() { - - public Object getAdapter(Object adaptableObject, - Class adapterType) { - if (adaptableObject instanceof org.eclipse.papyrus.diagram.sequence.navigator.UMLAbstractNavigatorItem - && adapterType == ITabbedPropertySheetPageContributor.class) { - return propertySheetPageContributor; - } - return null; - } - - public Class[] getAdapterList() { - return supportedTypes; - } - }, - org.eclipse.papyrus.diagram.sequence.navigator.UMLAbstractNavigatorItem.class); - } - - /** - * @generated - */ - private Object myParent; - - /** - * @generated - */ - protected UMLAbstractNavigatorItem(Object parent) { - myParent = parent; - } - - /** - * @generated - */ - public Object getParent() { - return myParent; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorContentProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorContentProvider.java deleted file mode 100644 index 784e7305b90..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorContentProvider.java +++ /dev/null @@ -1,244 +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.navigator; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonContentProvider; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class UMLDomainNavigatorContentProvider implements - ICommonContentProvider { - - /** - * @generated - */ - private AdapterFactoryContentProvider myAdapterFctoryContentProvier; - - /** - * @generated - */ - private static final Object[] EMPTY_ARRAY = new Object[0]; - - /** - * @generated - */ - private Viewer myViewer; - - /** - * @generated - */ - private AdapterFactoryEditingDomain myEditingDomain; - - /** - * @generated - */ - private WorkspaceSynchronizer myWorkspaceSynchronizer; - - /** - * @generated - */ - private Runnable myViewerRefreshRunnable; - - /** - * @generated - */ - public UMLDomainNavigatorContentProvider() { - myAdapterFctoryContentProvier = new AdapterFactoryContentProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE - .createEditingDomain(); - myEditingDomain = (AdapterFactoryEditingDomain) editingDomain; - myEditingDomain.setResourceToReadOnlyMap(new HashMap() { - public Object get(Object key) { - if (!containsKey(key)) { - put(key, Boolean.TRUE); - } - return super.get(key); - } - }); - myViewerRefreshRunnable = new Runnable() { - public void run() { - if (myViewer != null) { - myViewer.refresh(); - } - } - }; - myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, - new WorkspaceSynchronizer.Delegate() { - public void dispose() { - } - - public boolean handleResourceChanged(final Resource resource) { - for (Iterator it = myEditingDomain.getResourceSet() - .getResources().iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec( - myViewerRefreshRunnable); - } - return true; - } - - public boolean handleResourceDeleted(Resource resource) { - for (Iterator it = myEditingDomain.getResourceSet() - .getResources().iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec( - myViewerRefreshRunnable); - } - return true; - } - - public boolean handleResourceMoved(Resource resource, - final URI newURI) { - for (Iterator it = myEditingDomain.getResourceSet() - .getResources().iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec( - myViewerRefreshRunnable); - } - return true; - } - }); - } - - /** - * @generated - */ - public void dispose() { - myWorkspaceSynchronizer.dispose(); - myWorkspaceSynchronizer = null; - myViewerRefreshRunnable = null; - for (Iterator it = myEditingDomain.getResourceSet().getResources() - .iterator(); it.hasNext();) { - Resource resource = (Resource) it.next(); - resource.unload(); - } - ((TransactionalEditingDomain) myEditingDomain).dispose(); - myEditingDomain = null; - } - - /** - * @generated - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - myViewer = viewer; - } - - /** - * @generated - */ - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - /** - * @generated - */ - public void restoreState(IMemento aMemento) { - } - - /** - * @generated - */ - public void saveState(IMemento aMemento) { - } - - /** - * @generated - */ - public void init(ICommonContentExtensionSite aConfig) { - } - - /** - * @generated - */ - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof IFile) { - IFile file = (IFile) parentElement; - URI fileURI = URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); - Resource resource = myEditingDomain.getResourceSet().getResource( - fileURI, true); - return wrapEObjects(myAdapterFctoryContentProvier - .getChildren(resource), parentElement); - } - - if (parentElement instanceof UMLDomainNavigatorItem) { - return wrapEObjects(myAdapterFctoryContentProvier - .getChildren(((UMLDomainNavigatorItem) parentElement) - .getEObject()), parentElement); - } - return EMPTY_ARRAY; - } - - /** - * @generated - */ - public Object[] wrapEObjects(Object[] objects, Object parentElement) { - Collection result = new ArrayList(); - for (int i = 0; i < objects.length; i++) { - if (objects[i] instanceof EObject) { - result.add(new UMLDomainNavigatorItem((EObject) objects[i], - parentElement, myAdapterFctoryContentProvier)); - } - } - return result.toArray(); - } - - /** - * @generated - */ - public Object getParent(Object element) { - if (element instanceof UMLAbstractNavigatorItem) { - UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element; - return abstractNavigatorItem.getParent(); - } - return null; - } - - /** - * @generated - */ - public boolean hasChildren(Object element) { - return element instanceof IFile || getChildren(element).length > 0; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorItem.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorItem.java deleted file mode 100644 index 29918fe65ef..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorItem.java +++ /dev/null @@ -1,132 +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.navigator; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.common.core.util.IAdaptableSelection; -import org.eclipse.ui.views.properties.IPropertySource; -import org.eclipse.ui.views.properties.IPropertySourceProvider; - -/** - * @generated - */ -public class UMLDomainNavigatorItem extends PlatformObject implements - IAdaptableSelection { - - /** - * @generated - */ - static { - final Class[] supportedTypes = new Class[] { EObject.class, - IPropertySource.class }; - Platform.getAdapterManager().registerAdapters( - new IAdapterFactory() { - - public Object getAdapter(Object adaptableObject, - Class adapterType) { - if (adaptableObject instanceof org.eclipse.papyrus.diagram.sequence.navigator.UMLDomainNavigatorItem) { - org.eclipse.papyrus.diagram.sequence.navigator.UMLDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.diagram.sequence.navigator.UMLDomainNavigatorItem) adaptableObject; - EObject eObject = domainNavigatorItem.getEObject(); - if (adapterType == EObject.class) { - return eObject; - } - if (adapterType == IPropertySource.class) { - return domainNavigatorItem - .getPropertySourceProvider() - .getPropertySource(eObject); - } - } - - return null; - } - - public Class[] getAdapterList() { - return supportedTypes; - } - }, - org.eclipse.papyrus.diagram.sequence.navigator.UMLDomainNavigatorItem.class); - } - - /** - * @generated - */ - private Object myParent; - - /** - * @generated - */ - private EObject myEObject; - - /** - * @generated - */ - private IPropertySourceProvider myPropertySourceProvider; - - /** - * @generated - */ - public UMLDomainNavigatorItem(EObject eObject, Object parent, - IPropertySourceProvider propertySourceProvider) { - myParent = parent; - myEObject = eObject; - myPropertySourceProvider = propertySourceProvider; - } - - /** - * @generated - */ - public Object getParent() { - return myParent; - } - - /** - * @generated - */ - public EObject getEObject() { - return myEObject; - } - - /** - * @generated - */ - public IPropertySourceProvider getPropertySourceProvider() { - return myPropertySourceProvider; - } - - /** - * @generated - */ - @Override - public boolean equals(Object obj) { - if (obj instanceof org.eclipse.papyrus.diagram.sequence.navigator.UMLDomainNavigatorItem) { - return EcoreUtil - .getURI(getEObject()) - .equals( - EcoreUtil - .getURI(((org.eclipse.papyrus.diagram.sequence.navigator.UMLDomainNavigatorItem) obj) - .getEObject())); - } - return super.equals(obj); - } - - /** - * @generated - */ - @Override - public int hashCode() { - return EcoreUtil.getURI(getEObject()).hashCode(); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorLabelProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorLabelProvider.java deleted file mode 100644 index 90ab07e720b..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLDomainNavigatorLabelProvider.java +++ /dev/null @@ -1,109 +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.navigator; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonLabelProvider; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class UMLDomainNavigatorLabelProvider implements ICommonLabelProvider { - - /** - * @generated - */ - private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - - /** - * @generated - */ - public void init(ICommonContentExtensionSite aConfig) { - } - - /** - * @generated - */ - public Image getImage(Object element) { - if (element instanceof UMLDomainNavigatorItem) { - return myAdapterFactoryLabelProvider - .getImage(((UMLDomainNavigatorItem) element).getEObject()); - } - return null; - } - - /** - * @generated - */ - public String getText(Object element) { - if (element instanceof UMLDomainNavigatorItem) { - return myAdapterFactoryLabelProvider - .getText(((UMLDomainNavigatorItem) element).getEObject()); - } - return null; - } - - /** - * @generated - */ - public void addListener(ILabelProviderListener listener) { - myAdapterFactoryLabelProvider.addListener(listener); - } - - /** - * @generated - */ - public void dispose() { - myAdapterFactoryLabelProvider.dispose(); - } - - /** - * @generated - */ - public boolean isLabelProperty(Object element, String property) { - return myAdapterFactoryLabelProvider.isLabelProperty(element, property); - } - - /** - * @generated - */ - public void removeListener(ILabelProviderListener listener) { - myAdapterFactoryLabelProvider.removeListener(listener); - } - - /** - * @generated - */ - public void restoreState(IMemento aMemento) { - } - - /** - * @generated - */ - public void saveState(IMemento aMemento) { - } - - /** - * @generated - */ - public String getDescription(Object anElement) { - return null; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorActionProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorActionProvider.java deleted file mode 100644 index 295285a198a..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorActionProvider.java +++ /dev/null @@ -1,193 +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.navigator; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.navigator.CommonActionProvider; -import org.eclipse.ui.navigator.ICommonActionConstants; -import org.eclipse.ui.navigator.ICommonActionExtensionSite; -import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; -import org.eclipse.ui.part.FileEditorInput; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditor; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLNavigatorActionProvider extends CommonActionProvider { - - /** - * @generated - */ - private boolean myContribute; - - /** - * @generated - */ - private OpenDiagramAction myOpenDiagramAction; - - /** - * @generated - */ - @Override - public void init(ICommonActionExtensionSite aSite) { - super.init(aSite); - if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) { - myContribute = true; - makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite()); - } else { - myContribute = false; - } - } - - /** - * @generated - */ - private void makeActions(ICommonViewerWorkbenchSite viewerSite) { - myOpenDiagramAction = new OpenDiagramAction(viewerSite); - } - - /** - * @generated - */ - @Override - public void fillActionBars(IActionBars actionBars) { - if (!myContribute) { - return; - } - IStructuredSelection selection = (IStructuredSelection) getContext() - .getSelection(); - myOpenDiagramAction.selectionChanged(selection); - if (myOpenDiagramAction.isEnabled()) { - actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, - myOpenDiagramAction); - } - } - - /** - * @generated - */ - @Override - public void fillContextMenu(IMenuManager menu) { - } - - /** - * @generated - */ - private class OpenDiagramAction extends Action { - - /** - * @generated - */ - private Diagram myDiagram; - - /** - * @generated - */ - private ICommonViewerWorkbenchSite myViewerSite; - - /** - * @generated - */ - public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) { - super(Messages.NavigatorActionProvider_OpenDiagramActionName); - myViewerSite = viewerSite; - } - - /** - * @generated - */ - public final void selectionChanged(IStructuredSelection selection) { - myDiagram = null; - if (selection.size() == 1) { - Object selectedElement = selection.getFirstElement(); - if (selectedElement instanceof UMLNavigatorItem) { - selectedElement = ((UMLNavigatorItem) selectedElement) - .getView(); - } else if (selectedElement instanceof IAdaptable) { - selectedElement = ((IAdaptable) selectedElement) - .getAdapter(View.class); - } - if (selectedElement instanceof Diagram) { - Diagram diagram = (Diagram) selectedElement; - if (PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(diagram))) { - myDiagram = diagram; - } - } - } - setEnabled(myDiagram != null); - } - - /** - * @generated - */ - @Override - public void run() { - if (myDiagram == null || myDiagram.eResource() == null) { - return; - } - - IEditorInput editorInput = getEditorInput(); - IWorkbenchPage page = myViewerSite.getPage(); - try { - page.openEditor(editorInput, UMLDiagramEditor.ID); - } catch (PartInitException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Exception while openning diagram", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - private IEditorInput getEditorInput() { - for (Iterator it = myDiagram.eResource().getContents().iterator(); it - .hasNext();) { - EObject nextEObject = (EObject) it.next(); - if (nextEObject == myDiagram) { - return new FileEditorInput(WorkspaceSynchronizer - .getFile(myDiagram.eResource())); - } - if (nextEObject instanceof Diagram) { - break; - } - } - URI uri = EcoreUtil.getURI(myDiagram); - String editorName = uri.lastSegment() - + "#" + myDiagram.eResource().getContents().indexOf(myDiagram); //$NON-NLS-1$ - IEditorInput editorInput = new URIEditorInput(uri, editorName); - return editorInput; - } - - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorContentProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorContentProvider.java deleted file mode 100644 index 3101d727ca4..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorContentProvider.java +++ /dev/null @@ -1,1451 +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.navigator; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonContentProvider; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLNavigatorContentProvider implements ICommonContentProvider { - - /** - * @generated - */ - private static final Object[] EMPTY_ARRAY = new Object[0]; - - /** - * @generated - */ - private Viewer myViewer; - - /** - * @generated - */ - private AdapterFactoryEditingDomain myEditingDomain; - - /** - * @generated - */ - private WorkspaceSynchronizer myWorkspaceSynchronizer; - - /** - * @generated - */ - private Runnable myViewerRefreshRunnable; - - /** - * @generated - */ - public UMLNavigatorContentProvider() { - TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE - .createEditingDomain(); - myEditingDomain = (AdapterFactoryEditingDomain) editingDomain; - myEditingDomain.setResourceToReadOnlyMap(new HashMap() { - public Object get(Object key) { - if (!containsKey(key)) { - put(key, Boolean.TRUE); - } - return super.get(key); - } - }); - myViewerRefreshRunnable = new Runnable() { - public void run() { - if (myViewer != null) { - myViewer.refresh(); - } - } - }; - myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, - new WorkspaceSynchronizer.Delegate() { - public void dispose() { - } - - public boolean handleResourceChanged(final Resource resource) { - for (Iterator it = myEditingDomain.getResourceSet() - .getResources().iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec( - myViewerRefreshRunnable); - } - return true; - } - - public boolean handleResourceDeleted(Resource resource) { - for (Iterator it = myEditingDomain.getResourceSet() - .getResources().iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec( - myViewerRefreshRunnable); - } - return true; - } - - public boolean handleResourceMoved(Resource resource, - final URI newURI) { - for (Iterator it = myEditingDomain.getResourceSet() - .getResources().iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec( - myViewerRefreshRunnable); - } - return true; - } - }); - } - - /** - * @generated - */ - public void dispose() { - myWorkspaceSynchronizer.dispose(); - myWorkspaceSynchronizer = null; - myViewerRefreshRunnable = null; - for (Iterator it = myEditingDomain.getResourceSet().getResources() - .iterator(); it.hasNext();) { - Resource resource = (Resource) it.next(); - resource.unload(); - } - ((TransactionalEditingDomain) myEditingDomain).dispose(); - myEditingDomain = null; - } - - /** - * @generated - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - myViewer = viewer; - } - - /** - * @generated - */ - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - /** - * @generated - */ - public void restoreState(IMemento aMemento) { - } - - /** - * @generated - */ - public void saveState(IMemento aMemento) { - } - - /** - * @generated - */ - public void init(ICommonContentExtensionSite aConfig) { - } - - /** - * @generated - */ - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof IFile) { - IFile file = (IFile) parentElement; - URI fileURI = URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); - Resource resource = myEditingDomain.getResourceSet().getResource( - fileURI, true); - Collection result = new ArrayList(); - result.addAll(createNavigatorItems(selectViewsByType(resource - .getContents(), PackageEditPart.MODEL_ID), file, false)); - return result.toArray(); - } - - if (parentElement instanceof UMLNavigatorGroup) { - UMLNavigatorGroup group = (UMLNavigatorGroup) parentElement; - return group.getChildren(); - } - - if (parentElement instanceof UMLNavigatorItem) { - UMLNavigatorItem navigatorItem = (UMLNavigatorItem) parentElement; - if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) { - return EMPTY_ARRAY; - } - return getViewChildren(navigatorItem.getView(), parentElement); - } - - /* - * Due to plugin.xml restrictions this code will be called only for views representing - * shortcuts to this diagram elements created on other diagrams. - */ - if (parentElement instanceof IAdaptable) { - View view = (View) ((IAdaptable) parentElement) - .getAdapter(View.class); - if (view != null) { - return getViewChildren(view, parentElement); - } - } - - return EMPTY_ARRAY; - } - - /** - * @generated - */ - private Object[] getViewChildren(View view, Object parentElement) { - switch (UMLVisualIDRegistry.getVisualID(view)) { - - case PackageEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - result.addAll(getForeignShortcuts((Diagram) view, parentElement)); - UMLNavigatorGroup links = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Package_79_links, - "icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getChildrenByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getChildrenByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - MessageEditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - Message2EditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - Message3EditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - Message4EditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - Message5EditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - Message6EditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - connectedViews = getDiagramLinksByType(Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - links - .addChildren(createNavigatorItems(connectedViews, links, - false)); - if (!links.isEmpty()) { - result.add(links); - } - return result.toArray(); - } - - case InteractionEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup incominglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Interaction_1001_incominglinks, - "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Interaction_1001_outgoinglinks, - "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getChildrenByType(Collections - .singleton(view), - InteractionInteractionCompartmentEditPart.VISUAL_ID); - connectedViews = getChildrenByType(connectedViews, - Interaction2EditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getChildrenByType(Collections.singleton(view), - InteractionInteractionCompartmentEditPart.VISUAL_ID); - connectedViews = getChildrenByType(connectedViews, - LifelineEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getChildrenByType(Collections.singleton(view), - InteractionInteractionCompartmentEditPart.VISUAL_ID); - connectedViews = getChildrenByType(connectedViews, - CombinedFragmentEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - if (!incominglinks.isEmpty()) { - result.add(incominglinks); - } - if (!outgoinglinks.isEmpty()) { - result.add(outgoinglinks); - } - return result.toArray(); - } - - case CommentEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup incominglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Comment_2005_incominglinks, - "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Comment_2005_outgoinglinks, - "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getIncomingLinksByType(Collections - .singleton(view), MessageEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - if (!incominglinks.isEmpty()) { - result.add(incominglinks); - } - if (!outgoinglinks.isEmpty()) { - result.add(outgoinglinks); - } - return result.toArray(); - } - - case Interaction2EditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup incominglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Interaction_2001_incominglinks, - "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Interaction_2001_outgoinglinks, - "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getChildrenByType(Collections - .singleton(view), - InteractionInteractionCompartment2EditPart.VISUAL_ID); - connectedViews = getChildrenByType(connectedViews, - Interaction2EditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getChildrenByType(Collections.singleton(view), - InteractionInteractionCompartment2EditPart.VISUAL_ID); - connectedViews = getChildrenByType(connectedViews, - LifelineEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getChildrenByType(Collections.singleton(view), - InteractionInteractionCompartment2EditPart.VISUAL_ID); - connectedViews = getChildrenByType(connectedViews, - CombinedFragmentEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - if (!incominglinks.isEmpty()) { - result.add(incominglinks); - } - if (!outgoinglinks.isEmpty()) { - result.add(outgoinglinks); - } - return result.toArray(); - } - - case LifelineEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup incominglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Lifeline_2002_incominglinks, - "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Lifeline_2002_outgoinglinks, - "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getChildrenByType(Collections - .singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - result.addAll(createNavigatorItems(connectedViews, parentElement, - false)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - if (!incominglinks.isEmpty()) { - result.add(incominglinks); - } - if (!outgoinglinks.isEmpty()) { - result.add(outgoinglinks); - } - return result.toArray(); - } - - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup incominglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_BehaviorExecutionSpecification_2003_incominglinks, - "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_BehaviorExecutionSpecification_2003_outgoinglinks, - "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getIncomingLinksByType(Collections - .singleton(view), MessageEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - if (!incominglinks.isEmpty()) { - result.add(incominglinks); - } - if (!outgoinglinks.isEmpty()) { - result.add(outgoinglinks); - } - return result.toArray(); - } - - case CombinedFragmentEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup incominglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_CombinedFragment_2004_incominglinks, - "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup( - Messages.NavigatorGroupName_CombinedFragment_2004_outgoinglinks, - "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getIncomingLinksByType(Collections - .singleton(view), MessageEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), MessageEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message2EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message3EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message4EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message5EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), Message6EditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getOutgoingLinksByType( - Collections.singleton(view), - ElementOwnedCommentEditPart.VISUAL_ID); - outgoinglinks.addChildren(createNavigatorItems(connectedViews, - outgoinglinks, true)); - connectedViews = getIncomingLinksByType( - Collections.singleton(view), - CommentAnnotatedElementEditPart.VISUAL_ID); - incominglinks.addChildren(createNavigatorItems(connectedViews, - incominglinks, true)); - if (!incominglinks.isEmpty()) { - result.add(incominglinks); - } - if (!outgoinglinks.isEmpty()) { - result.add(outgoinglinks); - } - return result.toArray(); - } - - case MessageEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3001_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3001_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case Message2EditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3002_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3002_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case Message3EditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3003_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3003_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case Message4EditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3004_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3004_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case Message5EditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3005_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3005_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case Message6EditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3006_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_Message_3006_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case ElementOwnedCommentEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_ElementOwnedComment_3007_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_ElementOwnedComment_3007_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - InteractionEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - - case CommentAnnotatedElementEditPart.VISUAL_ID: { - Collection result = new ArrayList(); - UMLNavigatorGroup target = new UMLNavigatorGroup( - Messages.NavigatorGroupName_CommentAnnotatedElement_3008_target, - "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - UMLNavigatorGroup source = new UMLNavigatorGroup( - Messages.NavigatorGroupName_CommentAnnotatedElement_3008_source, - "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$ - Collection connectedViews = getLinksTargetByType(Collections - .singleton(view), InteractionEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - Interaction2EditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - LifelineEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - BehaviorExecutionSpecificationEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksTargetByType(Collections.singleton(view), - CombinedFragmentEditPart.VISUAL_ID); - target.addChildren(createNavigatorItems(connectedViews, target, - true)); - connectedViews = getLinksSourceByType(Collections.singleton(view), - CommentEditPart.VISUAL_ID); - source.addChildren(createNavigatorItems(connectedViews, source, - true)); - if (!target.isEmpty()) { - result.add(target); - } - if (!source.isEmpty()) { - result.add(source); - } - return result.toArray(); - } - } - return EMPTY_ARRAY; - } - - /** - * @generated - */ - private Collection getLinksSourceByType(Collection edges, int visualID) { - Collection result = new ArrayList(); - String type = UMLVisualIDRegistry.getType(visualID); - for (Iterator it = edges.iterator(); it.hasNext();) { - Edge nextEdge = (Edge) it.next(); - View nextEdgeSource = nextEdge.getSource(); - if (type.equals(nextEdgeSource.getType()) - && isOwnView(nextEdgeSource)) { - result.add(nextEdgeSource); - } - } - return result; - } - - /** - * @generated - */ - private Collection getLinksTargetByType(Collection edges, int visualID) { - Collection result = new ArrayList(); - String type = UMLVisualIDRegistry.getType(visualID); - for (Iterator it = edges.iterator(); it.hasNext();) { - Edge nextEdge = (Edge) it.next(); - View nextEdgeTarget = nextEdge.getTarget(); - if (type.equals(nextEdgeTarget.getType()) - && isOwnView(nextEdgeTarget)) { - result.add(nextEdgeTarget); - } - } - return result; - } - - /** - * @generated - */ - private Collection getOutgoingLinksByType(Collection nodes, int visualID) { - Collection result = new ArrayList(); - String type = UMLVisualIDRegistry.getType(visualID); - for (Iterator it = nodes.iterator(); it.hasNext();) { - View nextNode = (View) it.next(); - result.addAll(selectViewsByType(nextNode.getSourceEdges(), type)); - } - return result; - } - - /** - * @generated - */ - private Collection getIncomingLinksByType(Collection nodes, int visualID) { - Collection result = new ArrayList(); - String type = UMLVisualIDRegistry.getType(visualID); - for (Iterator it = nodes.iterator(); it.hasNext();) { - View nextNode = (View) it.next(); - result.addAll(selectViewsByType(nextNode.getTargetEdges(), type)); - } - return result; - } - - /** - * @generated - */ - private Collection getChildrenByType(Collection nodes, int visualID) { - Collection result = new ArrayList(); - String type = UMLVisualIDRegistry.getType(visualID); - for (Iterator it = nodes.iterator(); it.hasNext();) { - View nextNode = (View) it.next(); - result.addAll(selectViewsByType(nextNode.getChildren(), type)); - } - return result; - } - - /** - * @generated - */ - private Collection getDiagramLinksByType(Collection diagrams, int visualID) { - Collection result = new ArrayList(); - String type = UMLVisualIDRegistry.getType(visualID); - for (Iterator it = diagrams.iterator(); it.hasNext();) { - Diagram nextDiagram = (Diagram) it.next(); - result.addAll(selectViewsByType(nextDiagram.getEdges(), type)); - } - return result; - } - - /** - * @generated - */ - private Collection selectViewsByType(Collection views, String type) { - Collection result = new ArrayList(); - for (Iterator it = views.iterator(); it.hasNext();) { - View nextView = (View) it.next(); - if (type.equals(nextView.getType()) && isOwnView(nextView)) { - result.add(nextView); - } - } - return result; - } - - /** - * @generated - */ - private boolean isOwnView(View view) { - return PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(view)); - } - - /** - * @generated - */ - private Collection createNavigatorItems(Collection views, Object parent, - boolean isLeafs) { - Collection result = new ArrayList(); - for (Iterator it = views.iterator(); it.hasNext();) { - result.add(new UMLNavigatorItem((View) it.next(), parent, isLeafs)); - } - return result; - } - - /** - * @generated - */ - private Collection getForeignShortcuts(Diagram diagram, Object parent) { - Collection result = new ArrayList(); - for (Iterator it = diagram.getChildren().iterator(); it.hasNext();) { - View nextView = (View) it.next(); - if (!isOwnView(nextView) - && nextView.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ - result.add(nextView); - } - } - return createNavigatorItems(result, parent, false); - } - - /** - * @generated - */ - public Object getParent(Object element) { - if (element instanceof UMLAbstractNavigatorItem) { - UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element; - return abstractNavigatorItem.getParent(); - } - return null; - } - - /** - * @generated - */ - public boolean hasChildren(Object element) { - return element instanceof IFile || getChildren(element).length > 0; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorGroup.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorGroup.java deleted file mode 100644 index 04aa4d1a644..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorGroup.java +++ /dev/null @@ -1,109 +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.navigator; - -import java.util.Collection; -import java.util.LinkedList; - -/** - * @generated - */ -public class UMLNavigatorGroup extends UMLAbstractNavigatorItem { - - /** - * @generated - */ - private String myGroupName; - - /** - * @generated - */ - private String myIcon; - - /** - * @generated - */ - private Collection myChildren = new LinkedList(); - - /** - * @generated - */ - UMLNavigatorGroup(String groupName, String icon, Object parent) { - super(parent); - myGroupName = groupName; - myIcon = icon; - } - - /** - * @generated - */ - public String getGroupName() { - return myGroupName; - } - - /** - * @generated - */ - public String getIcon() { - return myIcon; - } - - /** - * @generated - */ - public Object[] getChildren() { - return myChildren.toArray(); - } - - /** - * @generated - */ - public void addChildren(Collection children) { - myChildren.addAll(children); - } - - /** - * @generated - */ - public void addChild(Object child) { - myChildren.add(child); - } - - /** - * @generated - */ - public boolean isEmpty() { - return myChildren.size() == 0; - } - - /** - * @generated - */ - @Override - public boolean equals(Object obj) { - if (obj instanceof org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorGroup) { - org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorGroup anotherGroup = (org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorGroup) obj; - if (getGroupName().equals(anotherGroup.getGroupName())) { - return getParent().equals(anotherGroup.getParent()); - } - } - return super.equals(obj); - } - - /** - * @generated - */ - @Override - public int hashCode() { - return getGroupName().hashCode(); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorItem.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorItem.java deleted file mode 100644 index f9fa1b2a1fa..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorItem.java +++ /dev/null @@ -1,108 +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.navigator; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.common.core.util.IAdaptableSelection; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class UMLNavigatorItem extends UMLAbstractNavigatorItem implements - IAdaptableSelection { - - /** - * @generated - */ - static { - final Class[] supportedTypes = new Class[] { View.class, EObject.class }; - Platform.getAdapterManager().registerAdapters( - new IAdapterFactory() { - - public Object getAdapter(Object adaptableObject, - Class adapterType) { - if (adaptableObject instanceof org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorItem - && (adapterType == View.class || adapterType == EObject.class)) { - return ((org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorItem) adaptableObject) - .getView(); - } - return null; - } - - public Class[] getAdapterList() { - return supportedTypes; - } - }, - org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorItem.class); - } - - /** - * @generated - */ - private View myView; - - /** - * @generated - */ - private boolean myLeaf = false; - - /** - * @generated - */ - public UMLNavigatorItem(View view, Object parent, boolean isLeaf) { - super(parent); - myView = view; - myLeaf = isLeaf; - } - - /** - * @generated - */ - public View getView() { - return myView; - } - - /** - * @generated - */ - public boolean isLeaf() { - return myLeaf; - } - - /** - * @generated - */ - @Override - public boolean equals(Object obj) { - if (obj instanceof org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorItem) { - return EcoreUtil - .getURI(getView()) - .equals( - EcoreUtil - .getURI(((org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorItem) obj) - .getView())); - } - return super.equals(obj); - } - - /** - * @generated - */ - @Override - public int hashCode() { - return EcoreUtil.getURI(getView()).hashCode(); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorLabelProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorLabelProvider.java deleted file mode 100644 index 3c17d9d4e47..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorLabelProvider.java +++ /dev/null @@ -1,595 +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.navigator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.jface.viewers.ITreePathLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.ViewerLabel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonLabelProvider; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.Package; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentInteractionOperatorEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentBodyEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.providers.UMLParserProvider; - -/** - * @generated - */ -public class UMLNavigatorLabelProvider extends LabelProvider implements - ICommonLabelProvider, ITreePathLabelProvider { - - /** - * @generated - */ - static { - UMLDiagramEditorPlugin - .getInstance() - .getImageRegistry() - .put( - "Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$ - UMLDiagramEditorPlugin - .getInstance() - .getImageRegistry() - .put( - "Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$ - } - - /** - * @generated - */ - public void updateLabel(ViewerLabel label, TreePath elementPath) { - Object element = elementPath.getLastSegment(); - if (element instanceof UMLNavigatorItem - && !isOwnView(((UMLNavigatorItem) element).getView())) { - return; - } - label.setText(getText(element)); - label.setImage(getImage(element)); - } - - /** - * @generated - */ - @Override - public Image getImage(Object element) { - if (element instanceof UMLNavigatorGroup) { - UMLNavigatorGroup group = (UMLNavigatorGroup) element; - return UMLDiagramEditorPlugin.getInstance().getBundledImage( - group.getIcon()); - } - - if (element instanceof UMLNavigatorItem) { - UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element; - if (!isOwnView(navigatorItem.getView())) { - return super.getImage(element); - } - return getImage(navigatorItem.getView()); - } - - // Due to plugin.xml content will be called only for "own" views - if (element instanceof IAdaptable) { - View view = (View) ((IAdaptable) element).getAdapter(View.class); - if (view != null && isOwnView(view)) { - return getImage(view); - } - } - - return super.getImage(element); - } - - /** - * @generated - */ - public Image getImage(View view) { - switch (UMLVisualIDRegistry.getVisualID(view)) { - case PackageEditPart.VISUAL_ID: - return getImage( - "Navigator?Diagram?http://www.eclipse.org/uml2/2.1.0/UML?Package", UMLElementTypes.Package_79); //$NON-NLS-1$ - case InteractionEditPart.VISUAL_ID: - return getImage( - "Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Interaction", UMLElementTypes.Interaction_1001); //$NON-NLS-1$ - case CommentEditPart.VISUAL_ID: - return getImage( - "Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.1.0/UML?Comment", UMLElementTypes.Comment_2005); //$NON-NLS-1$ - case Interaction2EditPart.VISUAL_ID: - return getImage( - "Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Interaction", UMLElementTypes.Interaction_2001); //$NON-NLS-1$ - case LifelineEditPart.VISUAL_ID: - return getImage( - "Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?Lifeline", UMLElementTypes.Lifeline_2002); //$NON-NLS-1$ - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return getImage( - "Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?BehaviorExecutionSpecification", UMLElementTypes.BehaviorExecutionSpecification_2003); //$NON-NLS-1$ - case CombinedFragmentEditPart.VISUAL_ID: - return getImage( - "Navigator?Node?http://www.eclipse.org/uml2/2.1.0/UML?CombinedFragment", UMLElementTypes.CombinedFragment_2004); //$NON-NLS-1$ - case MessageEditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Message", UMLElementTypes.Message_3001); //$NON-NLS-1$ - case Message2EditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Message", UMLElementTypes.Message_3002); //$NON-NLS-1$ - case Message3EditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Message", UMLElementTypes.Message_3003); //$NON-NLS-1$ - case Message4EditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Message", UMLElementTypes.Message_3004); //$NON-NLS-1$ - case Message5EditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Message", UMLElementTypes.Message_3005); //$NON-NLS-1$ - case Message6EditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Message", UMLElementTypes.Message_3006); //$NON-NLS-1$ - case ElementOwnedCommentEditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Element?ownedComment", UMLElementTypes.ElementOwnedComment_3007); //$NON-NLS-1$ - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getImage( - "Navigator?Link?http://www.eclipse.org/uml2/2.1.0/UML?Comment?annotatedElement", UMLElementTypes.CommentAnnotatedElement_3008); //$NON-NLS-1$ - } - return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$ - } - - /** - * @generated - */ - private Image getImage(String key, IElementType elementType) { - ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance() - .getImageRegistry(); - Image image = imageRegistry.get(key); - if (image == null && elementType != null - && UMLElementTypes.isKnownElementType(elementType)) { - image = UMLElementTypes.getImage(elementType); - imageRegistry.put(key, image); - } - - if (image == null) { - image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$ - imageRegistry.put(key, image); - } - return image; - } - - /** - * @generated - */ - @Override - public String getText(Object element) { - if (element instanceof UMLNavigatorGroup) { - UMLNavigatorGroup group = (UMLNavigatorGroup) element; - return group.getGroupName(); - } - - if (element instanceof UMLNavigatorItem) { - UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element; - if (!isOwnView(navigatorItem.getView())) { - return null; - } - return getText(navigatorItem.getView()); - } - - // Due to plugin.xml content will be called only for "own" views - if (element instanceof IAdaptable) { - View view = (View) ((IAdaptable) element).getAdapter(View.class); - if (view != null && isOwnView(view)) { - return getText(view); - } - } - - return super.getText(element); - } - - /** - * @generated - */ - public String getText(View view) { - if (view.getElement() != null && view.getElement().eIsProxy()) { - return getUnresolvedDomainElementProxyText(view); - } - switch (UMLVisualIDRegistry.getVisualID(view)) { - case PackageEditPart.VISUAL_ID: - return getPackage_79Text(view); - case InteractionEditPart.VISUAL_ID: - return getInteraction_1001Text(view); - case CommentEditPart.VISUAL_ID: - return getComment_2005Text(view); - case Interaction2EditPart.VISUAL_ID: - return getInteraction_2001Text(view); - case LifelineEditPart.VISUAL_ID: - return getLifeline_2002Text(view); - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return getBehaviorExecutionSpecification_2003Text(view); - case CombinedFragmentEditPart.VISUAL_ID: - return getCombinedFragment_2004Text(view); - case MessageEditPart.VISUAL_ID: - return getMessage_3001Text(view); - case Message2EditPart.VISUAL_ID: - return getMessage_3002Text(view); - case Message3EditPart.VISUAL_ID: - return getMessage_3003Text(view); - case Message4EditPart.VISUAL_ID: - return getMessage_3004Text(view); - case Message5EditPart.VISUAL_ID: - return getMessage_3005Text(view); - case Message6EditPart.VISUAL_ID: - return getMessage_3006Text(view); - case ElementOwnedCommentEditPart.VISUAL_ID: - return getElementOwnedComment_3007Text(view); - case CommentAnnotatedElementEditPart.VISUAL_ID: - return getCommentAnnotatedElement_3008Text(view); - } - return getUnknownElementText(view); - } - - /** - * @generated - */ - private String getPackage_79Text(View view) { - Package domainModelElement = (Package) view.getElement(); - if (domainModelElement != null) { - return String.valueOf(domainModelElement.getName()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "No domain element for view with visualID = " + 79); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - } - - /** - * @generated - */ - private String getInteraction_1001Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Interaction_1001, - (view.getElement() != null ? view.getElement() : view), - UMLVisualIDRegistry.getType(InteractionNameEditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4004); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getInteraction_2001Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Interaction_2001, - (view.getElement() != null ? view.getElement() : view), - UMLVisualIDRegistry.getType(InteractionName2EditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4003); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getLifeline_2002Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Lifeline_2002, - (view.getElement() != null ? view.getElement() : view), - UMLVisualIDRegistry.getType(LifelineNameEditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4001); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getBehaviorExecutionSpecification_2003Text(View view) { - BehaviorExecutionSpecification domainModelElement = (BehaviorExecutionSpecification) view - .getElement(); - if (domainModelElement != null) { - return String.valueOf(domainModelElement.getName()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "No domain element for view with visualID = " + 2003); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - } - - /** - * @generated - */ - private String getCombinedFragment_2004Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.CombinedFragment_2004, - (view.getElement() != null ? view.getElement() : view), - UMLVisualIDRegistry - .getType(CombinedFragmentInteractionOperatorEditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4002); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getComment_2005Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Comment_2005, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(CommentBodyEditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 5003); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getMessage_3001Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3001, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(MessageNameEditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4005); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getMessage_3002Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3002, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(MessageName2EditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4006); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getMessage_3003Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3003, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(MessageName3EditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4007); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getMessage_3004Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3004, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(MessageName4EditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4008); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getMessage_3005Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3005, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(MessageName5EditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4009); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getMessage_3006Text(View view) { - IAdaptable hintAdapter = new UMLParserProvider.HintAdapter( - UMLElementTypes.Message_3006, (view.getElement() != null ? view - .getElement() : view), UMLVisualIDRegistry - .getType(MessageName6EditPart.VISUAL_ID)); - IParser parser = ParserService.getInstance().getParser(hintAdapter); - - if (parser != null) { - return parser.getPrintString(hintAdapter, ParserOptions.NONE - .intValue()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Parser was not found for label " + 4010); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ - } - - } - - /** - * @generated - */ - private String getElementOwnedComment_3007Text(View view) { - return ""; //$NON-NLS-1$ - } - - /** - * @generated - */ - private String getCommentAnnotatedElement_3008Text(View view) { - return ""; //$NON-NLS-1$ - } - - /** - * @generated - */ - private String getUnknownElementText(View view) { - return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * @generated - */ - private String getUnresolvedDomainElementProxyText(View view) { - return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * @generated - */ - public void init(ICommonContentExtensionSite aConfig) { - } - - /** - * @generated - */ - public void restoreState(IMemento aMemento) { - } - - /** - * @generated - */ - public void saveState(IMemento aMemento) { - } - - /** - * @generated - */ - public String getDescription(Object anElement) { - return null; - } - - /** - * @generated - */ - private boolean isOwnView(View view) { - return PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(view)); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorLinkHelper.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorLinkHelper.java deleted file mode 100644 index bacf6a63223..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorLinkHelper.java +++ /dev/null @@ -1,150 +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.navigator; - -import java.util.Iterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.navigator.ILinkHelper; -import org.eclipse.ui.part.FileEditorInput; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class UMLNavigatorLinkHelper implements ILinkHelper { - - /** - * @generated - */ - private static IEditorInput getEditorInput(Diagram diagram) { - Resource diagramResource = diagram.eResource(); - for (Iterator it = diagramResource.getContents().iterator(); it - .hasNext();) { - EObject nextEObject = (EObject) it.next(); - if (nextEObject == diagram) { - return new FileEditorInput(WorkspaceSynchronizer - .getFile(diagramResource)); - } - if (nextEObject instanceof Diagram) { - break; - } - } - URI uri = EcoreUtil.getURI(diagram); - String editorName = uri.lastSegment() - + "#" + diagram.eResource().getContents().indexOf(diagram); //$NON-NLS-1$ - IEditorInput editorInput = new URIEditorInput(uri, editorName); - return editorInput; - } - - /** - * @generated - */ - public IStructuredSelection findSelection(IEditorInput anInput) { - IDiagramDocument document = UMLDiagramEditorPlugin.getInstance() - .getDocumentProvider(getEditingDomainID(), anInput) - .getDiagramDocument(anInput); - if (document == null) { - return StructuredSelection.EMPTY; - } - Diagram diagram = document.getDiagram(); - IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); - if (file != null) { - UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false); - return new StructuredSelection(item); - } - return StructuredSelection.EMPTY; - } - - /** - * @generated - */ - public void activateEditor(IWorkbenchPage aPage, - IStructuredSelection aSelection) { - if (aSelection == null || aSelection.isEmpty()) { - return; - } - if (false == aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) { - return; - } - - UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) aSelection - .getFirstElement(); - View navigatorView = null; - if (abstractNavigatorItem instanceof UMLNavigatorItem) { - navigatorView = ((UMLNavigatorItem) abstractNavigatorItem) - .getView(); - } else if (abstractNavigatorItem instanceof UMLNavigatorGroup) { - UMLNavigatorGroup navigatorGroup = (UMLNavigatorGroup) abstractNavigatorItem; - if (navigatorGroup.getParent() instanceof UMLNavigatorItem) { - navigatorView = ((UMLNavigatorItem) navigatorGroup.getParent()) - .getView(); - } else if (navigatorGroup.getParent() instanceof IAdaptable) { - navigatorView = (View) ((IAdaptable) navigatorGroup.getParent()) - .getAdapter(View.class); - } - } - if (navigatorView == null) { - return; - } - IEditorInput editorInput = getEditorInput(navigatorView.getDiagram()); - IEditorPart editor = aPage.findEditor(editorInput); - if (editor == null) { - return; - } - aPage.bringToTop(editor); - if (editor instanceof DiagramEditor) { - DiagramEditor diagramEditor = (DiagramEditor) editor; - ResourceSet diagramEditorResourceSet = diagramEditor - .getEditingDomain().getResourceSet(); - EObject selectedView = diagramEditorResourceSet.getEObject( - EcoreUtil.getURI(navigatorView), true); - if (selectedView == null) { - return; - } - GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor - .getAdapter(GraphicalViewer.class); - EditPart selectedEditPart = (EditPart) graphicalViewer - .getEditPartRegistry().get(selectedView); - if (selectedEditPart != null) { - graphicalViewer.select(selectedEditPart); - } - } - } - - /** - * @generated - */ - protected String getEditingDomainID() { - return "es.cv.gvcase.mdt.uml2.diagram.SharedEditingDomainID"; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorSorter.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorSorter.java deleted file mode 100644 index 0a9a1e04f90..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/navigator/UMLNavigatorSorter.java +++ /dev/null @@ -1,47 +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.navigator; - -import org.eclipse.jface.viewers.ViewerSorter; - -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLNavigatorSorter extends ViewerSorter { - - /** - * @generated - */ - private static final int GROUP_CATEGORY = 5004; - - /** - * @generated - */ - private static final int SHORTCUTS_CATEGORY = 5003; - - /** - * @generated - */ - @Override - public int category(Object element) { - if (element instanceof UMLNavigatorItem) { - UMLNavigatorItem item = (UMLNavigatorItem) element; - if (item.getView().getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ - return SHORTCUTS_CATEGORY; - } - return UMLVisualIDRegistry.getVisualID(item.getView()); - } - return GROUP_CATEGORY; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/AbstractParser.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/AbstractParser.java deleted file mode 100644 index 0b2deba8d8e..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/AbstractParser.java +++ /dev/null @@ -1,452 +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.parsers; - -import java.util.Arrays; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EEnumLiteral; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.osgi.util.NLS; - -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public abstract class AbstractParser implements IParser { - - /** - * @generated - */ - protected final EAttribute[] features; - - /** - * @generated - */ - private String viewPattern; - - /** - * @generated - */ - private String editorPattern; - - /** - * @generated - */ - private String editPattern; - - /** - * @generated - */ - public AbstractParser(EAttribute[] features) { - if (features == null || Arrays.asList(features).contains(null)) { - throw new IllegalArgumentException(); - } - this.features = features; - } - - /** - * @generated - */ - public String getViewPattern() { - return viewPattern; - } - - /** - * @generated - */ - public void setViewPattern(String viewPattern) { - this.viewPattern = viewPattern; - } - - /** - * @generated - */ - public String getEditorPattern() { - return editorPattern; - } - - /** - * @generated - */ - public void setEditorPattern(String editorPattern) { - this.editorPattern = editorPattern; - } - - /** - * @generated - */ - public String getEditPattern() { - return editPattern; - } - - /** - * @generated - */ - public void setEditPattern(String editPattern) { - this.editPattern = editPattern; - } - - /** - * @generated - */ - public boolean isAffectingEvent(Object event, int flags) { - if (event instanceof Notification) { - return isAffectingFeature(((Notification) event).getFeature()); - } - return false; - } - - /** - * @generated - */ - protected boolean isAffectingFeature(Object feature) { - for (int i = 0; i < features.length; i++) { - if (features[i] == feature) { - return true; - } - } - return false; - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { - return null; - } - - /** - * @generated - */ - protected Object[] getValues(EObject element) { - Object[] values = new Object[features.length]; - for (int i = 0; i < features.length; i++) { - values[i] = getValue(element, features[i]); - } - return values; - } - - /** - * @generated - */ - protected Object getValue(EObject element, EAttribute feature) { - Object value = element.eGet(feature); - Class iClass = feature.getEAttributeType().getInstanceClass(); - if (String.class.equals(iClass)) { - if (value == null) { - value = ""; //$NON-NLS-1$ - } - } - return value; - } - - /** - * @generated - */ - protected ICommand getParseCommand(IAdaptable adapter, Object[] values, - int flags) { - if (values == null - || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) { - return UnexecutableCommand.INSTANCE; - } - EObject element = (EObject) adapter.getAdapter(EObject.class); - TransactionalEditingDomain editingDomain = TransactionUtil - .getEditingDomain(element); - if (editingDomain == null) { - return UnexecutableCommand.INSTANCE; - } - CompositeTransactionalCommand command = new CompositeTransactionalCommand( - editingDomain, "Set Values"); //$NON-NLS-1$ - for (int i = 0; i < values.length; i++) { - command.compose(getModificationCommand(element, features[i], - values[i])); - } - return command; - } - - /** - * @generated - */ - protected ICommand getModificationCommand(EObject element, - EAttribute feature, Object value) { - value = getValidNewValue(feature, value); - if (value instanceof InvalidValue) { - return UnexecutableCommand.INSTANCE; - } - SetRequest request = new SetRequest(element, feature, value); - return new SetValueCommand(request); - } - - /** - * @generated - */ - protected IParserEditStatus validateNewValues(Object[] values) { - if (values.length != features.length) { - return ParserEditStatus.UNEDITABLE_STATUS; - } - for (int i = 0; i < values.length; i++) { - Object value = getValidNewValue(features[i], values[i]); - if (value instanceof InvalidValue) { - return new ParserEditStatus(UMLDiagramEditorPlugin.ID, - IParserEditStatus.UNEDITABLE, value.toString()); - } - } - return ParserEditStatus.EDITABLE_STATUS; - } - - /** - * @generated - */ - protected Object getValidNewValue(EAttribute feature, Object value) { - EClassifier type = feature.getEType(); - if (type instanceof EDataType) { - Class iClass = type.getInstanceClass(); - if (Boolean.TYPE.equals(iClass)) { - if (value instanceof Boolean) { - // ok - } else if (value instanceof String) { - value = Boolean.valueOf((String) value); - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Character.TYPE.equals(iClass)) { - if (value instanceof Character) { - // ok - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - value = new Character(s.charAt(0)); - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Byte.TYPE.equals(iClass)) { - if (value instanceof Byte) { - // ok - } else if (value instanceof Number) { - value = new Byte(((Number) value).byteValue()); - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - try { - value = Byte.valueOf(s); - } catch (NumberFormatException nfe) { - value = new InvalidValue( - NLS - .bind( - Messages.AbstractParser_WrongStringConversionMessage, - iClass.getName())); - } - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Short.TYPE.equals(iClass)) { - if (value instanceof Short) { - // ok - } else if (value instanceof Number) { - value = new Short(((Number) value).shortValue()); - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - try { - value = Short.valueOf(s); - } catch (NumberFormatException nfe) { - value = new InvalidValue( - NLS - .bind( - Messages.AbstractParser_WrongStringConversionMessage, - iClass.getName())); - } - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Integer.TYPE.equals(iClass)) { - if (value instanceof Integer) { - // ok - } else if (value instanceof Number) { - value = new Integer(((Number) value).intValue()); - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - try { - value = Integer.valueOf(s); - } catch (NumberFormatException nfe) { - value = new InvalidValue( - NLS - .bind( - Messages.AbstractParser_WrongStringConversionMessage, - iClass.getName())); - } - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Long.TYPE.equals(iClass)) { - if (value instanceof Long) { - // ok - } else if (value instanceof Number) { - value = new Long(((Number) value).longValue()); - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - try { - value = Long.valueOf(s); - } catch (NumberFormatException nfe) { - value = new InvalidValue( - NLS - .bind( - Messages.AbstractParser_WrongStringConversionMessage, - iClass.getName())); - } - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Float.TYPE.equals(iClass)) { - if (value instanceof Float) { - // ok - } else if (value instanceof Number) { - value = new Float(((Number) value).floatValue()); - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - try { - value = Float.valueOf(s); - } catch (NumberFormatException nfe) { - value = new InvalidValue( - NLS - .bind( - Messages.AbstractParser_WrongStringConversionMessage, - iClass.getName())); - } - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (Double.TYPE.equals(iClass)) { - if (value instanceof Double) { - // ok - } else if (value instanceof Number) { - value = new Double(((Number) value).doubleValue()); - } else if (value instanceof String) { - String s = (String) value; - if (s.length() == 0) { - value = null; - } else { - try { - value = Double.valueOf(s); - } catch (NumberFormatException nfe) { - value = new InvalidValue( - NLS - .bind( - Messages.AbstractParser_WrongStringConversionMessage, - iClass.getName())); - } - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - iClass.getName())); - } - } else if (type instanceof EEnum) { - if (value instanceof String) { - EEnumLiteral literal = ((EEnum) type) - .getEEnumLiteralByLiteral((String) value); - if (literal == null) { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnknownLiteralMessage, - value)); - } else { - value = literal.getInstance(); - } - } else { - value = new InvalidValue(NLS.bind( - Messages.AbstractParser_UnexpectedValueTypeMessage, - String.class.getName())); - } - } - } - return value; - } - - /** - * @generated - */ - protected class InvalidValue { - - /** - * @generated - */ - private String description; - - /** - * @generated - */ - public InvalidValue(String description) { - this.description = description; - } - - /** - * @generated - */ - @Override - public String toString() { - return description; - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/CompositeParser.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/CompositeParser.java deleted file mode 100644 index 54d459c49cf..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/CompositeParser.java +++ /dev/null @@ -1,85 +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.parsers; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; - -/** - * @generated - */ -public class CompositeParser implements IParser { - - /** - * @generated - */ - private final IParser reader; - - /** - * @generated - */ - private final IParser writer; - - /** - * @generated - */ - public CompositeParser(IParser reader, IParser writer) { - this.reader = reader; - this.writer = writer; - } - - /** - * @generated - */ - public boolean isAffectingEvent(Object event, int flags) { - return reader.isAffectingEvent(event, flags); - } - - /** - * @generated - */ - public String getPrintString(IAdaptable adapter, int flags) { - return reader.getPrintString(adapter, flags); - } - - /** - * @generated - */ - public String getEditString(IAdaptable adapter, int flags) { - return reader.getEditString(adapter, flags); - } - - /** - * @generated - */ - public IParserEditStatus isValidEditString(IAdaptable adapter, - String editString) { - return writer.isValidEditString(adapter, editString); - } - - /** - * @generated - */ - public ICommand getParseCommand(IAdaptable adapter, String newString, - int flags) { - return writer.getParseCommand(adapter, newString, flags); - } - - /** - * @generated - */ - public IContentAssistProcessor getCompletionProcessor(IAdaptable adapter) { - return writer.getCompletionProcessor(adapter); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/MessageFormatParser.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/MessageFormatParser.java deleted file mode 100644 index 49b20b5a72f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/parsers/MessageFormatParser.java +++ /dev/null @@ -1,227 +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.parsers; - -import java.text.FieldPosition; -import java.text.MessageFormat; -import java.text.ParsePosition; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.osgi.util.NLS; - -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class MessageFormatParser extends AbstractParser { - - /** - * @generated - */ - private String defaultPattern; - - /** - * @generated - */ - private MessageFormat viewProcessor; - - /** - * @generated - */ - private MessageFormat editorProcessor; - - /** - * @generated - */ - private MessageFormat editProcessor; - - /** - * @generated - */ - public MessageFormatParser(EAttribute[] features) { - super(features); - } - - /** - * @generated - */ - protected String getDefaultPattern() { - if (defaultPattern == null) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < features.length; i++) { - if (i > 0) { - sb.append(' '); - } - sb.append('{'); - sb.append(i); - sb.append('}'); - } - defaultPattern = sb.toString(); - } - return defaultPattern; - } - - /** - * @generated - */ - @Override - public String getViewPattern() { - String pattern = super.getViewPattern(); - return pattern != null ? pattern : getDefaultPattern(); - } - - /** - * @generated - */ - @Override - public void setViewPattern(String viewPattern) { - super.setViewPattern(viewPattern); - viewProcessor = null; - } - - /** - * @generated - */ - protected MessageFormat createViewProcessor(String viewPattern) { - return new MessageFormat(viewPattern); - } - - /** - * @generated - */ - protected MessageFormat getViewProcessor() { - if (viewProcessor == null) { - viewProcessor = createViewProcessor(getViewPattern()); - } - return viewProcessor; - } - - /** - * @generated - */ - @Override - public String getEditorPattern() { - String pattern = super.getEditorPattern(); - return pattern != null ? pattern : getDefaultPattern(); - } - - /** - * @generated - */ - @Override - public void setEditorPattern(String editorPattern) { - super.setEditorPattern(editorPattern); - editorProcessor = null; - } - - /** - * @generated - */ - protected MessageFormat createEditorProcessor(String editorPattern) { - return new MessageFormat(editorPattern); - } - - /** - * @generated - */ - protected MessageFormat getEditorProcessor() { - if (editorProcessor == null) { - editorProcessor = createEditorProcessor(getEditorPattern()); - } - return editorProcessor; - } - - /** - * @generated - */ - @Override - public String getEditPattern() { - String pattern = super.getEditPattern(); - return pattern != null ? pattern : getDefaultPattern(); - } - - /** - * @generated - */ - @Override - public void setEditPattern(String editPattern) { - super.setEditPattern(editPattern); - editProcessor = null; - } - - /** - * @generated - */ - protected MessageFormat createEditProcessor(String editPattern) { - return new MessageFormat(editPattern); - } - - /** - * @generated - */ - protected MessageFormat getEditProcessor() { - if (editProcessor == null) { - editProcessor = createEditProcessor(getEditPattern()); - } - return editProcessor; - } - - /** - * @generated - */ - public String getPrintString(IAdaptable adapter, int flags) { - EObject element = (EObject) adapter.getAdapter(EObject.class); - return getViewProcessor().format(getValues(element), - new StringBuffer(), new FieldPosition(0)).toString(); - } - - /** - * @generated - */ - public String getEditString(IAdaptable adapter, int flags) { - EObject element = (EObject) adapter.getAdapter(EObject.class); - return getEditorProcessor().format(getValues(element), - new StringBuffer(), new FieldPosition(0)).toString(); - } - - /** - * @generated - */ - public IParserEditStatus isValidEditString(IAdaptable adapter, - String editString) { - ParsePosition pos = new ParsePosition(0); - Object[] values = getEditProcessor().parse(editString, pos); - if (values == null) { - return new ParserEditStatus(UMLDiagramEditorPlugin.ID, - IParserEditStatus.UNEDITABLE, NLS.bind( - Messages.MessageFormatParser_InvalidInputError, - new Integer(pos.getErrorIndex()))); - } - return validateNewValues(values); - } - - /** - * @generated - */ - public ICommand getParseCommand(IAdaptable adapter, String newString, - int flags) { - Object[] values = getEditProcessor().parse(newString, - new ParsePosition(0)); - return getParseCommand(adapter, values, flags); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/DeleteElementAction.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/DeleteElementAction.java deleted file mode 100644 index 351dfdd4332..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/DeleteElementAction.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.part; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDeleteFromAction; -import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds; -import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; - -/** - * @generated - */ - -public class DeleteElementAction extends AbstractDeleteFromAction { - - /** - * @generated - */ - public DeleteElementAction(IWorkbenchPart part) { - super(part); - } - - /** - * @generated - */ - public DeleteElementAction(IWorkbenchPage workbenchPage) { - super(workbenchPage); - } - - /** - * @generated - */ - @Override - public void init() { - super.init(); - setId(ActionIds.ACTION_DELETE_FROM_MODEL); - setText(DiagramUIMessages.DiagramEditor_Delete_from_Model); - setToolTipText(DiagramUIMessages.DiagramEditor_Delete_from_ModelToolTip); - ISharedImages workbenchImages = PlatformUI.getWorkbench() - .getSharedImages(); - setHoverImageDescriptor(workbenchImages - .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); - setImageDescriptor(workbenchImages - .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); - setDisabledImageDescriptor(workbenchImages - .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); - } - - /** - * @generated - */ - @Override - protected String getCommandLabel() { - return DiagramUIMessages.DiagramEditor_Delete_from_Model; - } - - /** - * @generated - */ - @Override - protected Command getCommand(Request request) { - List operationSet = getOperationSet(); - if (operationSet.isEmpty()) { - return UnexecutableCommand.INSTANCE; - } - Iterator editParts = operationSet.iterator(); - CompositeTransactionalCommand command = new CompositeTransactionalCommand( - getEditingDomain(), getCommandLabel()); - while (editParts.hasNext()) { - EditPart editPart = (EditPart) editParts.next(); - Command curCommand = editPart.getCommand(request); - if (curCommand != null) { - command.compose(new CommandProxy(curCommand)); - } - } - if (command.isEmpty() || command.size() != operationSet.size()) { - return UnexecutableCommand.INSTANCE; - } - return new ICommandProxy(command); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/DiagramEditorContextMenuProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/DiagramEditorContextMenuProvider.java deleted file mode 100644 index 47c2ff74940..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/DiagramEditorContextMenuProvider.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.part; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService; -import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds; -import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.ui.IWorkbenchPart; - -/** - * @generated - */ - -public class DiagramEditorContextMenuProvider extends - DiagramContextMenuProvider { - - /** - * @generated - */ - private IWorkbenchPart part; - - /** - * @generated - */ - private DeleteElementAction deleteAction; - - /** - * @generated - */ - public DiagramEditorContextMenuProvider(IWorkbenchPart part, - EditPartViewer viewer) { - super(part, viewer); - this.part = part; - deleteAction = new DeleteElementAction(part); - deleteAction.init(); - } - - /** - * @generated - */ - @Override - public void dispose() { - if (deleteAction != null) { - deleteAction.dispose(); - deleteAction = null; - } - super.dispose(); - } - - /** - * @generated - */ - @Override - public void buildContextMenu(final IMenuManager menu) { - getViewer().flush(); - try { - TransactionUtil.getEditingDomain( - (EObject) getViewer().getContents().getModel()) - .runExclusive(new Runnable() { - - public void run() { - ContributionItemService - .getInstance() - .contributeToPopupMenu( - DiagramEditorContextMenuProvider.this, - part); - menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL); - menu.appendToGroup("editGroup", deleteAction); - } - }); - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Error building context menu", e); - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/Messages.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/Messages.java deleted file mode 100644 index ab1ca4437c1..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/Messages.java +++ /dev/null @@ -1,584 +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.part; - -import org.eclipse.osgi.util.NLS; - -/** - * @generated - */ -public class Messages extends NLS { - - /** - * @generated - */ - static { - NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$ - } - - /** - * @generated - */ - private Messages() { - } - - /** - * @generated - */ - public static String UMLCreationWizardTitle; - - /** - * @generated - */ - public static String UMLCreationWizard_DiagramModelFilePageTitle; - - /** - * @generated - */ - public static String UMLCreationWizard_DiagramModelFilePageDescription; - - /** - * @generated - */ - public static String UMLCreationWizard_DomainModelFilePageTitle; - - /** - * @generated - */ - public static String UMLCreationWizard_DomainModelFilePageDescription; - - /** - * @generated - */ - public static String UMLCreationWizardOpenEditorError; - - /** - * @generated - */ - public static String UMLCreationWizardCreationError; - - /** - * @generated - */ - public static String UMLCreationWizardPageExtensionError; - - /** - * @generated - */ - public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle; - - /** - * @generated - */ - public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage; - - /** - * @generated - */ - public static String UMLDiagramEditorUtil_CreateDiagramProgressTask; - - /** - * @generated - */ - public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel; - - /** - * @generated - */ - public static String UMLDocumentProvider_isModifiable; - - /** - * @generated - */ - public static String UMLDocumentProvider_handleElementContentChanged; - - /** - * @generated - */ - public static String UMLDocumentProvider_IncorrectInputError; - - /** - * @generated - */ - public static String UMLDocumentProvider_NoDiagramInResourceError; - - /** - * @generated - */ - public static String UMLDocumentProvider_DiagramLoadingError; - - /** - * @generated - */ - public static String UMLDocumentProvider_UnsynchronizedFileSaveError; - - /** - * @generated - */ - public static String UMLDocumentProvider_SaveDiagramTask; - - /** - * @generated - */ - public static String UMLDocumentProvider_SaveNextResourceTask; - - /** - * @generated - */ - public static String UMLDocumentProvider_SaveAsOperation; - - /** - * @generated - */ - public static String UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle; - - /** - * @generated - */ - public static String UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage; - - /** - * @generated - */ - public static String UMLInitDiagramFileAction_InitDiagramFileWizardTitle; - - /** - * @generated - */ - public static String UMLInitDiagramFileAction_OpenModelFileDialogTitle; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_CreationPageName; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_CreationPageTitle; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_CreationPageDescription; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_RootSelectionPageName; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_RootSelectionPageTitle; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_RootSelectionPageDescription; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_InitDiagramCommand; - - /** - * @generated - */ - public static String UMLNewDiagramFileWizard_IncorrectRootError; - - /** - * @generated - */ - public static String UMLDiagramEditor_SavingDeletedFile; - - /** - * @generated - */ - public static String UMLDiagramEditor_SaveAsErrorTitle; - - /** - * @generated - */ - public static String UMLDiagramEditor_SaveAsErrorMessage; - - /** - * @generated - */ - public static String UMLDiagramEditor_SaveErrorTitle; - - /** - * @generated - */ - public static String UMLDiagramEditor_SaveErrorMessage; - - /** - * @generated - */ - public static String UMLElementChooserDialog_SelectModelElementTitle; - - /** - * @generated - */ - public static String ModelElementSelectionPageMessage; - - /** - * @generated - */ - public static String ValidateActionMessage; - - /** - * @generated - */ - public static String Interaction1Group_title; - - /** - * @generated - */ - public static String Interaction1Group_desc; - - /** - * @generated - */ - public static String Objects2Group_title; - - /** - * @generated - */ - public static String Objects2Group_desc; - - /** - * @generated - */ - public static String Messages3Group_title; - - /** - * @generated - */ - public static String Comments4Group_title; - - /** - * @generated - */ - public static String Interaction1CreationTool_title; - - /** - * @generated - */ - public static String Interaction1CreationTool_desc; - - /** - * @generated - */ - public static String Lifeline1CreationTool_title; - - /** - * @generated - */ - public static String Lifeline1CreationTool_desc; - - /** - * @generated - */ - public static String ExecutionBehaviour2CreationTool_title; - - /** - * @generated - */ - public static String ExecutionBehaviour2CreationTool_desc; - - /** - * @generated - */ - public static String CombinedFragment3CreationTool_title; - - /** - * @generated - */ - public static String CombinedFragment3CreationTool_desc; - - /** - * @generated - */ - public static String Callsynch1CreationTool_title; - - /** - * @generated - */ - public static String Callsynch1CreationTool_desc; - - /** - * @generated - */ - public static String Callasynch2CreationTool_title; - - /** - * @generated - */ - public static String Callasynch2CreationTool_desc; - - /** - * @generated - */ - public static String Reply3CreationTool_title; - - /** - * @generated - */ - public static String Reply3CreationTool_desc; - - /** - * @generated - */ - public static String SendSignal5CreationTool_title; - - /** - * @generated - */ - public static String CreationEvent6CreationTool_title; - - /** - * @generated - */ - public static String DestructionEvent7CreationTool_title; - - /** - * @generated - */ - public static String Comment1CreationTool_title; - - /** - * @generated - */ - public static String Comment1CreationTool_desc; - - /** - * @generated - */ - public static String CommentLink2CreationTool_title; - - /** - * @generated - */ - public static String CommentLink2CreationTool_desc; - - /** - * @generated - */ - public static String InteractionInteractionCompartmentEditPart_title; - - /** - * @generated - */ - public static String InteractionInteractionCompartment2EditPart_title; - - /** - * @generated - */ - public static String CommandName_OpenDiagram; - - /** - * @generated - */ - public static String NavigatorGroupName_Package_79_links; - - /** - * @generated - */ - public static String NavigatorGroupName_Interaction_1001_incominglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Interaction_1001_outgoinglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Interaction_2001_incominglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Interaction_2001_outgoinglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Lifeline_2002_incominglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Lifeline_2002_outgoinglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_BehaviorExecutionSpecification_2003_incominglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_BehaviorExecutionSpecification_2003_outgoinglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_CombinedFragment_2004_incominglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_CombinedFragment_2004_outgoinglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Comment_2005_incominglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Comment_2005_outgoinglinks; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3001_target; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3001_source; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3002_target; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3002_source; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3003_target; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3003_source; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3004_target; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3004_source; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3005_target; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3005_source; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3006_target; - - /** - * @generated - */ - public static String NavigatorGroupName_Message_3006_source; - - /** - * @generated - */ - public static String NavigatorGroupName_ElementOwnedComment_3007_target; - - /** - * @generated - */ - public static String NavigatorGroupName_ElementOwnedComment_3007_source; - - /** - * @generated - */ - public static String NavigatorGroupName_CommentAnnotatedElement_3008_target; - - /** - * @generated - */ - public static String NavigatorGroupName_CommentAnnotatedElement_3008_source; - - /** - * @generated - */ - public static String NavigatorActionProvider_OpenDiagramActionName; - - /** - * @generated - */ - public static String AbstractParser_UnexpectedValueTypeMessage; - - /** - * @generated - */ - public static String AbstractParser_WrongStringConversionMessage; - - /** - * @generated - */ - public static String AbstractParser_UnknownLiteralMessage; - - /** - * @generated - */ - public static String MessageFormatParser_InvalidInputError; - - /** - * @generated - */ - public static String UMLModelingAssistantProviderTitle; - - /** - * @generated - */ - public static String UMLModelingAssistantProviderMessage; - - // TODO: put accessor fields manually -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/ModelElementSelectionPage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/ModelElementSelectionPage.java deleted file mode 100644 index c109bd07523..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/ModelElementSelectionPage.java +++ /dev/null @@ -1,166 +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.part; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.edit.provider.IWrapperItemProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.papyrus.diagram.common.dialogs.IWizardModelElementProvider; - -/** - * Wizard page that allows to select element from model. - * - * @generated - */ -public class ModelElementSelectionPage extends WizardPage implements - IWizardModelElementProvider { - - /** - * @generated - */ - protected EObject selectedModelElement; - - /** - * @generated - */ - private TreeViewer modelVewer; - - /** - * @generated - */ - public ModelElementSelectionPage(String pageName) { - super(pageName); - } - - /** - * @generated - */ - public EObject getModelElement() { - return selectedModelElement; - } - - /** - * @generated - */ - public void setModelElement(EObject modelElement) { - selectedModelElement = modelElement; - if (modelVewer != null) { - if (selectedModelElement != null) { - modelVewer.setInput(selectedModelElement.eResource()); - modelVewer.setSelection(new StructuredSelection( - selectedModelElement)); - } else { - modelVewer.setInput(null); - } - setPageComplete(validatePage()); - } - } - - /** - * @generated - */ - public void createControl(Composite parent) { - initializeDialogUnits(parent); - - Composite plate = new Composite(parent, SWT.NONE); - plate.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - plate.setLayout(layout); - setControl(plate); - - Label label = new Label(plate, SWT.NONE); - label.setText(getSelectionTitle()); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - - modelVewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL - | SWT.V_SCROLL | SWT.BORDER); - GridData layoutData = new GridData(GridData.FILL_BOTH); - layoutData.heightHint = 300; - layoutData.widthHint = 300; - modelVewer.getTree().setLayoutData(layoutData); - modelVewer.setContentProvider(new AdapterFactoryContentProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory())); - modelVewer.setLabelProvider(new AdapterFactoryLabelProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory())); - if (selectedModelElement != null) { - modelVewer.setInput(selectedModelElement.eResource()); - modelVewer.setSelection(new StructuredSelection( - selectedModelElement)); - } - modelVewer.addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - ModelElementSelectionPage.this - .updateSelection((IStructuredSelection) event - .getSelection()); - } - }); - - setPageComplete(validatePage()); - } - - /** - * Override to provide custom model element description. - * - * @generated - */ - protected String getSelectionTitle() { - return Messages.ModelElementSelectionPageMessage; - } - - /** - * @generated - */ - protected void updateSelection(IStructuredSelection selection) { - selectedModelElement = null; - if (selection.size() == 1) { - Object selectedElement = selection.getFirstElement(); - if (selectedElement instanceof IWrapperItemProvider) { - selectedElement = ((IWrapperItemProvider) selectedElement) - .getValue(); - } - if (selectedElement instanceof FeatureMap.Entry) { - selectedElement = ((FeatureMap.Entry) selectedElement) - .getValue(); - } - if (selectedElement instanceof EObject) { - selectedModelElement = (EObject) selectedElement; - } - } - setPageComplete(validatePage()); - } - - /** - * Override to provide specific validation of the selected model element. - * - * @generated - */ - protected boolean validatePage() { - return true; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/SequenceDiagramEditorFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/SequenceDiagramEditorFactory.java deleted file mode 100644 index daad99e0f58..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/SequenceDiagramEditorFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.part; - -import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorFactory; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * A factory for creating SequenceDiagramEditor objects. - */ -public class SequenceDiagramEditorFactory extends GmfEditorFactory { - - /** - * Instantiates a new sequence diagram editor factory. - */ - public SequenceDiagramEditorFactory() { - super(UMLSequenceDiagramForMultiEditor.class, PackageEditPart.MODEL_ID); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java deleted file mode 100644 index 550739c32e3..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java +++ /dev/null @@ -1,139 +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.part; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.OperationHistoryFactory; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.sequence.edit.commands.UMLCreateShortcutDecorationsCommand; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ -public class UMLCreateShortcutAction implements IObjectActionDelegate { - - /** - * @generated - */ - private GraphicalEditPart mySelectedElement; - - /** - * @generated - */ - private Shell myShell; - - /** - * @generated - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - myShell = targetPart.getSite().getShell(); - } - - /** - * @generated - */ - public void selectionChanged(IAction action, ISelection selection) { - mySelectedElement = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - if (structuredSelection.size() == 1) { - if (structuredSelection.getFirstElement() instanceof PackageEditPart) { - mySelectedElement = (PackageEditPart) structuredSelection - .getFirstElement(); - } - if (structuredSelection.getFirstElement() instanceof InteractionInteractionCompartmentEditPart) { - mySelectedElement = (InteractionInteractionCompartmentEditPart) structuredSelection - .getFirstElement(); - } - if (structuredSelection.getFirstElement() instanceof InteractionInteractionCompartment2EditPart) { - mySelectedElement = (InteractionInteractionCompartment2EditPart) structuredSelection - .getFirstElement(); - } - } - } - action.setEnabled(isEnabled()); - } - - /** - * @generated - */ - private boolean isEnabled() { - return mySelectedElement != null; - } - - /** - * @generated - */ - public void run(IAction action) { - final View view = (View) mySelectedElement.getModel(); - UMLElementChooserDialog elementChooser = new UMLElementChooserDialog( - myShell, view); - int result = elementChooser.open(); - if (result != Window.OK) { - return; - } - URI selectedModelElementURI = elementChooser - .getSelectedModelElementURI(); - final EObject selectedElement; - try { - selectedElement = mySelectedElement.getEditingDomain() - .getResourceSet().getEObject(selectedModelElementURI, true); - } catch (WrappedException e) { - UMLDiagramEditorPlugin - .getInstance() - .logError( - "Exception while loading object: " + selectedModelElementURI.toString(), e); //$NON-NLS-1$ - return; - } - - if (selectedElement == null) { - return; - } - CreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor( - new EObjectAdapter(selectedElement), Node.class, null, - UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); - ICommand command = new CreateCommand(mySelectedElement - .getEditingDomain(), viewDescriptor, view); - command = command.compose(new UMLCreateShortcutDecorationsCommand( - mySelectedElement.getEditingDomain(), view, viewDescriptor)); - try { - OperationHistoryFactory.getOperationHistory().execute(command, - new NullProgressMonitor(), null); - DiagramEditPartsUtil.updateDiagram(mySelectedElement); - } catch (ExecutionException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to create shortcut", e); //$NON-NLS-1$ - } - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreationWizard.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreationWizard.java deleted file mode 100644 index 67c063e22e0..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreationWizard.java +++ /dev/null @@ -1,172 +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.part; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * @generated - */ -public class UMLCreationWizard extends Wizard implements INewWizard { - - /** - * @generated - */ - private IWorkbench workbench; - - /** - * @generated - */ - protected IStructuredSelection selection; - - /** - * @generated - */ - protected UMLCreationWizardPage diagramModelFilePage; - - /** - * @generated - */ - protected UMLCreationWizardPage domainModelFilePage; - - /** - * @generated - */ - protected Resource diagram; - - /** - * @generated - */ - private boolean openNewlyCreatedDiagramEditor = true; - - /** - * @generated - */ - public IWorkbench getWorkbench() { - return workbench; - } - - /** - * @generated - */ - public IStructuredSelection getSelection() { - return selection; - } - - /** - * @generated - */ - public final Resource getDiagram() { - return diagram; - } - - /** - * @generated - */ - public final boolean isOpenNewlyCreatedDiagramEditor() { - return openNewlyCreatedDiagramEditor; - } - - /** - * @generated - */ - public void setOpenNewlyCreatedDiagramEditor( - boolean openNewlyCreatedDiagramEditor) { - this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor; - } - - /** - * @generated - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(Messages.UMLCreationWizardTitle); - setDefaultPageImageDescriptor(UMLDiagramEditorPlugin - .getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$ - setNeedsProgressMonitor(true); - } - - /** - * @generated - */ - @Override - public void addPages() { - diagramModelFilePage = new UMLCreationWizardPage( - "DiagramModelFile", getSelection(), "sequenceuml_diagram"); //$NON-NLS-1$ //$NON-NLS-2$ - diagramModelFilePage - .setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle); - diagramModelFilePage - .setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription); - addPage(diagramModelFilePage); - - domainModelFilePage = new UMLCreationWizardPage( - "DomainModelFile", getSelection(), "uml"); //$NON-NLS-1$ //$NON-NLS-2$ - domainModelFilePage - .setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle); - domainModelFilePage - .setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription); - addPage(domainModelFilePage); - } - - /** - * @generated - */ - @Override - public boolean performFinish() { - IRunnableWithProgress op = new WorkspaceModifyOperation(null) { - - protected void execute(IProgressMonitor monitor) - throws CoreException, InterruptedException { - diagram = UMLDiagramEditorUtil.createDiagram( - diagramModelFilePage.getURI(), domainModelFilePage - .getURI(), monitor); - if (isOpenNewlyCreatedDiagramEditor() && diagram != null) { - try { - UMLDiagramEditorUtil.openDiagram(diagram); - } catch (PartInitException e) { - ErrorDialog.openError(getContainer().getShell(), - Messages.UMLCreationWizardOpenEditorError, - null, e.getStatus()); - } - } - } - }; - try { - getContainer().run(false, true, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - if (e.getTargetException() instanceof CoreException) { - ErrorDialog.openError(getContainer().getShell(), - Messages.UMLCreationWizardCreationError, null, - ((CoreException) e.getTargetException()).getStatus()); - } else { - UMLDiagramEditorPlugin.getInstance().logError( - "Error creating diagram", e.getTargetException()); //$NON-NLS-1$ - } - return false; - } - return diagram != null; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreationWizardPage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreationWizardPage.java deleted file mode 100644 index cbe292a43b7..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreationWizardPage.java +++ /dev/null @@ -1,133 +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.part; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -/** - * @generated - */ -public class UMLCreationWizardPage extends WizardNewFileCreationPage { - - /** - * @generated - */ - private final String fileExtension; - - /** - * @generated - */ - public UMLCreationWizardPage(String pageName, - IStructuredSelection selection, String fileExtension) { - super(pageName, selection); - this.fileExtension = fileExtension; - } - - /** - * Override to create files with this extension. - * - * @generated - */ - protected String getExtension() { - return fileExtension; - } - - /** - * @generated - */ - public URI getURI() { - return URI.createPlatformResourceURI(getFilePath().toString(), false); - } - - /** - * @generated - */ - protected IPath getFilePath() { - IPath path = getContainerFullPath(); - if (path == null) { - path = new Path(""); //$NON-NLS-1$ - } - String fileName = getFileName(); - if (fileName != null) { - path = path.append(fileName); - } - return path; - } - - /** - * @generated - */ - @Override - public void createControl(Composite parent) { - super.createControl(parent); - setFileName(UMLDiagramEditorUtil.getUniqueFileName( - getContainerFullPath(), getFileName(), getExtension())); - setPageComplete(validatePage()); - } - - /** - * @generated - */ - @Override - protected boolean validatePage() { - if (!super.validatePage()) { - return false; - } - String extension = getExtension(); - if (extension != null - && !getFilePath().toString().endsWith("." + extension)) { - setErrorMessage(NLS.bind( - Messages.UMLCreationWizardPageExtensionError, extension)); - return false; - } - return true; - } - - /** - * @generated - */ - /** - * #174315 Automatically set diagram file extension - * @generated - */ - @Override - public IWizardPage getNextPage() { - IWizardPage nextPage = super.getNextPage(); - if ("DiagramModelFile".equals(getName()) - && "DomainModelFile".equals(nextPage.getName())) { - setDomainFileName(nextPage); - } - return nextPage; - } - - /** - * #174315 Automatically set diagram file extension - * @generated - */ - protected void setDomainFileName(IWizardPage nextPage) { - UMLCreationWizardPage nextWizardPage = (UMLCreationWizardPage) nextPage; - String fileName = getFileName(); - String extension = getExtension(); - if (fileName.endsWith(extension)) { - fileName = fileName.substring(0, fileName.length() - - extension.length()); - } - fileName += nextWizardPage.getExtension(); - nextWizardPage.setFileName(fileName); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramActionBarContributor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramActionBarContributor.java deleted file mode 100644 index 9d8fb4c217c..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramActionBarContributor.java +++ /dev/null @@ -1,35 +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.part; - -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor; - -/** - * @generated - */ -public class UMLDiagramActionBarContributor extends DiagramActionBarContributor { - - /** - * @generated - */ - @Override - protected Class getEditorClass() { - return UMLDiagramEditor.class; - } - - /** - * @generated - */ - @Override - protected String getEditorId() { - return UMLDiagramEditor.ID; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditor.java deleted file mode 100644 index f2dc132164a..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditor.java +++ /dev/null @@ -1,494 +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.part; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.transaction.ResourceSetListener; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.palette.PaletteEntry; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider; -import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteService; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.dnd.TransferData; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorMatchingStrategy; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.SaveAsDialog; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.navigator.resources.ProjectExplorer; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.IShowInTargetList; -import org.eclipse.ui.part.ShowInContext; - -import org.eclipse.papyrus.diagram.common.Activator; -import org.eclipse.papyrus.diagram.common.part.CachedResourcesDiagramEditor; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.common.ids.UMLDiagramEditorIDs; -import org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorItem; - -/** - * @generated - */ -public class UMLDiagramEditor extends CachedResourcesDiagramEditor implements - IGotoMarker { - - /** - * @generated NOT - */ - public static final String ID = "org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorID"; //$NON-NLS-1$ - - /** - * @generated - */ - public static final String CONTEXT_ID = "org.eclipse.papyrus.diagram.sequence.ui.diagramContext"; //$NON-NLS-1$ - - /** - * @generated - */ - public UMLDiagramEditor() { - super(true); - } - - /** - * @generated - */ - @Override - protected String getContextID() { - return CONTEXT_ID; - } - - /** - * @generated - */ - @Override - protected String getEditingDomainID() { - return "org.eclipse.uml2.diagram.clazz.EditingDomain"; - } - - /** - * @generated - */ - @Override - protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) { - PaletteRoot root = super.createPaletteRoot(existingPaletteRoot); - new UMLPaletteFactory().fillPalette(root); - return root; - } - - /** - * @generated - */ - @Override - protected PreferencesHint getPreferencesHint() { - return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT; - } - - /** - * @generated - */ - @Override - public String getEditorID() { - return ID; - } - - /** - * @generated - */ - @Override - public String getContributorId() { - return "org.eclipse.papyrustabs"; - } - - /** - * @generated - */ - @Override - public Object getAdapter(Class type) { - if (type == IShowInTargetList.class) { - return new IShowInTargetList() { - public String[] getShowInTargetIds() { - return new String[] { ProjectExplorer.VIEW_ID }; - } - }; - } - return super.getAdapter(type); - } - - /** - * @generated - */ - @Override - protected IDocumentProvider getDocumentProvider(IEditorInput input) { - if (input instanceof IFileEditorInput - || input instanceof URIEditorInput) { - - return UMLDiagramEditorPlugin.getInstance().getDocumentProvider( - getEditingDomainID(), input); - } - return super.getDocumentProvider(input); - } - - /** - * @generated - */ - @Override - public TransactionalEditingDomain getEditingDomain() { - IDocument document = getEditorInput() != null ? getDocumentProvider() - .getDocument(getEditorInput()) : null; - if (document instanceof IDiagramDocument) { - return ((IDiagramDocument) document).getEditingDomain(); - } - return super.getEditingDomain(); - } - - /** - * @generated - */ - @Override - protected void setDocumentProvider(IEditorInput input) { - if (input instanceof IFileEditorInput - || input instanceof URIEditorInput) { - - setDocumentProvider(UMLDiagramEditorPlugin.getInstance() - .getDocumentProvider(getEditingDomainID(), input)); - } else { - super.setDocumentProvider(input); - } - } - - /** - * @generated - */ - public void gotoMarker(IMarker marker) { - MarkerNavigationService.getInstance().gotoMarker(this, marker); - } - - /** - * @generated - */ - @Override - public boolean isSaveAsAllowed() { - return true; - } - - /** - * @generated - */ - @Override - public void doSaveAs() { - performSaveAs(new NullProgressMonitor()); - } - - /** - * @generated - */ - @Override - protected void performSaveAs(IProgressMonitor progressMonitor) { - Shell shell = getSite().getShell(); - IEditorInput input = getEditorInput(); - SaveAsDialog dialog = new SaveAsDialog(shell); - IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input) - .getFile() - : null; - // Store the editor ID that opens this diagram file. - String editorID = null; - if (original != null) { - dialog.setOriginalFile(original); - // Get the editor ID that opens the diagram file. - try { - editorID = original - .getPersistentProperty(org.eclipse.ui.ide.IDE.EDITOR_KEY); - } catch (CoreException ex) { - editorID = null; - } - } - dialog.create(); - IDocumentProvider provider = getDocumentProvider(); - if (provider == null) { - // editor has been programmatically closed while the dialog was open - return; - } - if (provider.isDeleted(input) && original != null) { - String message = NLS.bind( - Messages.UMLDiagramEditor_SavingDeletedFile, original - .getName()); - dialog.setErrorMessage(null); - dialog.setMessage(message, IMessageProvider.WARNING); - } - if (dialog.open() == Window.CANCEL) { - if (progressMonitor != null) { - progressMonitor.setCanceled(true); - } - return; - } - IPath filePath = dialog.getResult(); - if (filePath == null) { - if (progressMonitor != null) { - progressMonitor.setCanceled(true); - } - return; - } - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - IFile file = workspaceRoot.getFile(filePath); - final IEditorInput newInput = new FileEditorInput(file); - // Check if the editor is already open - IEditorMatchingStrategy matchingStrategy = getEditorDescriptor() - .getEditorMatchingStrategy(); - IEditorReference[] editorRefs = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage() - .getEditorReferences(); - for (int i = 0; i < editorRefs.length; i++) { - if (matchingStrategy.matches(editorRefs[i], newInput)) { - MessageDialog.openWarning(shell, - Messages.UMLDiagramEditor_SaveAsErrorTitle, - Messages.UMLDiagramEditor_SaveAsErrorMessage); - return; - } - } - boolean success = false; - try { - provider.aboutToChange(newInput); - getDocumentProvider(newInput).saveDocument(progressMonitor, - newInput, - getDocumentProvider().getDocument(getEditorInput()), true); - success = true; - } catch (CoreException x) { - IStatus status = x.getStatus(); - if (status == null || status.getSeverity() != IStatus.CANCEL) { - ErrorDialog.openError(shell, - Messages.UMLDiagramEditor_SaveErrorTitle, - Messages.UMLDiagramEditor_SaveErrorMessage, x - .getStatus()); - } - } finally { - provider.changed(newInput); - if (success) { - setInput(newInput); - // everything went OK, set the editorID that opens the diagram - // file - if (editorID != null) { - URI uri = URI.createURI(filePath.toString()); - try { - MultiDiagramUtil.setEditorForDiagram(uri, editorID); - } catch (CoreException ex) { - IStatus status = new Status(IStatus.ERROR, "org.eclipse.papyrus.diagram.sequence", "Error setting file property"); - Activator.getDefault().getLog().log(status); - } - } - } - } - if (progressMonitor != null) { - progressMonitor.setCanceled(!success); - } - } - - /** - * @generated - */ - @Override - public ShowInContext getShowInContext() { - return new ShowInContext(getEditorInput(), getNavigatorSelection()); - } - - /** - * @generated - */ - private ISelection getNavigatorSelection() { - IDiagramDocument document = getDiagramDocument(); - if (document == null) { - return StructuredSelection.EMPTY; - } - Diagram diagram = document.getDiagram(); - IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); - if (file != null) { - UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false); - return new StructuredSelection(item); - } - return StructuredSelection.EMPTY; - } - - /* Propiedad para almacenar al escuchador */ - private ResourceSetListener myResourceSetListener; - - /** - * @generated - */ - @Override - protected void initializeGraphicalViewer() { - super.initializeGraphicalViewer(); - getDiagramGraphicalViewer().addDropTargetListener( - new DropTargetListener(getDiagramGraphicalViewer(), - LocalSelectionTransfer.getTransfer()) { - - protected Object getJavaObject(TransferData data) { - return LocalSelectionTransfer.getTransfer() - .nativeToJava(data); - } - - }); - getDiagramGraphicalViewer().addDropTargetListener( - new DropTargetListener(getDiagramGraphicalViewer(), - LocalTransfer.getInstance()) { - - protected Object getJavaObject(TransferData data) { - return LocalTransfer.getInstance().nativeToJava(data); - } - - }); - } - - /** - * @generated - */ - private abstract class DropTargetListener extends DiagramDropTargetListener { - - /** - * @generated - */ - public DropTargetListener(EditPartViewer viewer, Transfer xfer) { - super(viewer, xfer); - } - - /** - * @generated - */ - @Override - protected List getObjectsBeingDropped() { - TransferData data = getCurrentEvent().currentDataType; - Collection uris = new HashSet(); - - Object transferedObject = getJavaObject(data); - if (transferedObject instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection) transferedObject; - for (Iterator it = selection.iterator(); it.hasNext();) { - Object nextSelectedObject = it.next(); - if (nextSelectedObject instanceof UMLNavigatorItem) { - View view = ((UMLNavigatorItem) nextSelectedObject) - .getView(); - nextSelectedObject = view.getElement(); - } else if (nextSelectedObject instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) nextSelectedObject; - nextSelectedObject = adaptable - .getAdapter(EObject.class); - } - - if (nextSelectedObject instanceof EObject) { - EObject modelElement = (EObject) nextSelectedObject; - Resource modelElementResource = modelElement - .eResource(); - uris.add(modelElementResource.getURI().appendFragment( - modelElementResource - .getURIFragment(modelElement))); - } - } - } - - List result = new ArrayList(); - for (Iterator it = uris.iterator(); it.hasNext();) { - URI nextURI = (URI) it.next(); - EObject modelObject = getEditingDomain().getResourceSet() - .getEObject(nextURI, true); - result.add(modelObject); - } - return result; - } - - /** - * @generated - */ - protected abstract Object getJavaObject(TransferData data); - - } - - /** - * @generated - */ - public void refresh() { - refreshPalette(); - refreshDiagram(); - } - - /** - * @generated - */ - private void refreshDiagram() { - getDiagramGraphicalViewer().setContents(getDiagram()); - } - - /** - * @generated - */ - private void refreshPalette() { - PaletteRoot paletteRoot = getEditDomain().getPaletteViewer() - .getPaletteRoot(); - cleanPaletteRoot(paletteRoot); - createPaletteRoot(paletteRoot); - } - - /** - * @generated - */ - private void cleanPaletteRoot(PaletteRoot paletteRoot) { - List<Object> entries = new ArrayList<Object>(); - entries.addAll(paletteRoot.getChildren()); - for (Object entry : entries) { - PaletteEntry paletteEntry = (PaletteEntry) entry; - // we don't repaint standard palette group - if (PaletteService.GROUP_STANDARD.equals(paletteEntry.getId())) { - continue; - } - paletteRoot.remove(paletteEntry); - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditorPlugin.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditorPlugin.java deleted file mode 100644 index 7d0a38379ba..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditorPlugin.java +++ /dev/null @@ -1,309 +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 - * Francisco Javier Cano Muñoz - Expanded functionality - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.part; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.resource.FontRegistry; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; -import org.osgi.framework.BundleContext; - -import org.eclipse.papyrus.diagram.common.part.CachedResourcesDocumentProvider; -import org.eclipse.papyrus.diagram.common.part.DocumentProviderRegistry; -import org.eclipse.papyrus.diagram.common.ids.UMLDiagramEditorIDs; -import org.eclipse.papyrus.diagram.common.providers.AlternativeUMLItemProviderAdapterFactory; - -/** - * @generated - */ -public class UMLDiagramEditorPlugin extends AbstractUIPlugin { - - /** - * @generated NOT - */ - public static final String ID = "org.eclipse.papyrus.diagram.sequence"; - - /** - * @generated - */ - public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID); - - /** - * @generated - */ - private static UMLDiagramEditorPlugin instance; - - /** - * @generated - */ - private ComposedAdapterFactory adapterFactory; - - /** - * @generated - */ - public UMLDiagramEditorPlugin() { - } - - /** - * @generated - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - instance = this; - PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, - getPreferenceStore()); - adapterFactory = createAdapterFactory(); - } - - /** - * @generated - */ - @Override - public void stop(BundleContext context) throws Exception { - adapterFactory.dispose(); - adapterFactory = null; - instance = null; - super.stop(context); - } - - /** - * @generated - */ - public static UMLDiagramEditorPlugin getInstance() { - return instance; - } - - /** - * @generated - */ - protected ComposedAdapterFactory createAdapterFactory() { - List factories = new ArrayList(); - fillItemProviderFactories(factories); - return new ComposedAdapterFactory(factories); - } - - /** - * @generated - */ - protected void fillItemProviderFactories(List factories) { - //custom icons for diagram elements - factories.add(new AlternativeUMLItemProviderAdapterFactory( - getPreferenceStore())); - - factories.add(new UMLItemProviderAdapterFactory()); - factories.add(new EcoreItemProviderAdapterFactory()); - factories.add(new ResourceItemProviderAdapterFactory()); - factories.add(new ReflectiveItemProviderAdapterFactory()); - } - - /** - * @generated - */ - public AdapterFactory getItemProvidersAdapterFactory() { - return adapterFactory; - } - - /** - * @generated - */ - public ImageDescriptor getItemImageDescriptor(Object item) { - IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory - .adapt(item, IItemLabelProvider.class); - if (labelProvider != null) { - return ExtendedImageRegistry.getInstance().getImageDescriptor( - labelProvider.getImage(item)); - } - return null; - } - - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path. - * - * @generated - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getBundledImageDescriptor(String path) { - return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path); - } - - /** - * Respects images residing in any plug-in. If path is relative, then this - * bundle is looked up for the image, otherwise, for absolute path, first - * segment is taken as id of plug-in with image - * - * @generated - * @param path - * the path to image, either absolute (with plug-in id as first - * segment), or relative for bundled images - * @return the image descriptor - */ - public static ImageDescriptor findImageDescriptor(String path) { - final IPath p = new Path(path); - if (p.isAbsolute() && p.segmentCount() > 1) { - return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p - .removeFirstSegments(1).makeAbsolute().toString()); - } else { - return getBundledImageDescriptor(p.makeAbsolute().toString()); - } - } - - /** - * Returns an image for the image file at the given plug-in relative path. - * Client do not need to dispose this image. Images will be disposed - * automatically. - * - * @generated - * @param path - * the path - * @return image instance - */ - public Image getBundledImage(String path) { - Image image = getImageRegistry().get(path); - if (image == null) { - getImageRegistry().put(path, getBundledImageDescriptor(path)); - image = getImageRegistry().get(path); - } - return image; - } - - /** - * Returns string from plug-in's resource bundle - * - * @generated - */ - public static String getString(String key) { - return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$ - } - - /** - * @generated - */ - public CachedResourcesDocumentProvider getDocumentProvider(String domainID, - IEditorInput input) { - return DocumentProviderRegistry.getInstance().get(domainID, input); - } - - /** - * @generated - */ - public void logError(String error) { - logError(error, null); - } - - /** - * @generated - */ - public void logError(String error, Throwable throwable) { - if (error == null && throwable != null) { - error = throwable.getMessage(); - } - getLog().log( - new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, - IStatus.OK, error, throwable)); - debug(error, throwable); - } - - /** - * @generated - */ - public void logInfo(String message) { - logInfo(message, null); - } - - /** - * @generated - */ - public void logInfo(String message, Throwable throwable) { - if (message == null && throwable != null) { - message = throwable.getMessage(); - } - getLog().log( - new Status(IStatus.INFO, UMLDiagramEditorPlugin.ID, IStatus.OK, - message, throwable)); - debug(message, throwable); - } - - /** - * @generated - */ - private void debug(String message, Throwable throwable) { - if (!isDebugging()) { - return; - } - if (message != null) { - System.err.println(message); - } - if (throwable != null) { - throwable.printStackTrace(); - } - } - - /** - * @generated - */ - public FontRegistry getFontRegistry() { - if (myFontRegistry == null) { - myFontRegistry = new FontRegistry(Display.getCurrent()); - myFontRegistry.put(IPreferenceConstants.PREF_DEFAULT_FONT, - PreferenceConverter.getDefaultFontDataArray( - getPreferenceStore(), - IPreferenceConstants.PREF_DEFAULT_FONT)); - } - return myFontRegistry; - } - - /** - * @generated - */ - public Font getDefaultFont() { - return getFontRegistry().get(IPreferenceConstants.PREF_DEFAULT_FONT); - } - - /** - * @generated - */ - public Font getDefaultBoldFont() { - return getFontRegistry() - .getBold(IPreferenceConstants.PREF_DEFAULT_FONT); - } - - /** - * @generated - */ - private FontRegistry myFontRegistry; -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditorUtil.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditorUtil.java deleted file mode 100644 index 7330f31da53..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramEditorUtil.java +++ /dev/null @@ -1,516 +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.part; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.OperationHistoryFactory; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer; -import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; -import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.uml2.uml.ElementImport; -import org.eclipse.uml2.uml.Model; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.UMLFactory; -import org.eclipse.uml2.uml.resource.UMLResource; - -import org.eclipse.papyrus.diagram.common.providers.IMOSKittEditorFactory; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ -public class UMLDiagramEditorUtil implements IMOSKittEditorFactory { - - /** - * @generated - */ - public static Map getSaveOptions() { - Map saveOptions = new HashMap(); - saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$ - saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, - Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - return saveOptions; - } - - /** - * @generated - */ - public static boolean openDiagram(Resource diagram) - throws PartInitException { - String path = diagram.getURI().toPlatformString(true); - IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot() - .findMember(new Path(path)); - if (workspaceResource instanceof IFile) { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - return null != page.openEditor(new FileEditorInput( - (IFile) workspaceResource), UMLDiagramEditor.ID); - } - return false; - } - - /** - * @generated - */ - public static void setCharset(IFile file) { - if (file == null) { - return; - } - try { - file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$ - } catch (CoreException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static String getUniqueFileName(IPath containerFullPath, - String fileName, String extension) { - if (containerFullPath == null) { - containerFullPath = new Path(""); //$NON-NLS-1$ - } - if (fileName == null || fileName.trim().length() == 0) { - fileName = "default"; //$NON-NLS-1$ - } - - extension = "." + extension; - if (fileName.endsWith(extension)) { - fileName = fileName.substring(0, fileName.length() - - extension.length()); - } - int i = 1; - IPath filePath = containerFullPath.append(fileName + extension); - while (ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { - i++; - filePath = containerFullPath.append(fileName + i + extension); - } - return filePath.lastSegment(); - } - - /** - * Runs the wizard in a dialog. - * - * @generated - */ - public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { - IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin - .getInstance().getDialogSettings(); - IDialogSettings wizardDialogSettings = pluginDialogSettings - .getSection(settingsKey); - if (wizardDialogSettings == null) { - wizardDialogSettings = pluginDialogSettings - .addNewSection(settingsKey); - } - wizard.setDialogSettings(wizardDialogSettings); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.create(); - dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), - 500); - dialog.open(); - } - - /** - * This method should be called within a workspace modify operation since it creates resources. - * @generated - */ - public static Resource createDiagram(URI diagramURI, URI modelURI, - IProgressMonitor progressMonitor) { - TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE - .createEditingDomain(); - progressMonitor.beginTask( - Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3); - final Resource diagramResource = editingDomain.getResourceSet() - .createResource(diagramURI); - final Resource modelResource = editingDomain.getResourceSet() - .createResource(modelURI); - final String diagramName = diagramURI.lastSegment(); - AbstractTransactionalCommand command = new AbstractTransactionalCommand( - editingDomain, - Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, - Collections.EMPTY_LIST) { - protected CommandResult doExecuteWithResult( - IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - Package model = createInitialModel(); - - Diagram diagram = ViewService.createDiagram(model, - PackageEditPart.MODEL_ID, - UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); - if (diagram != null) { - attachModelToResource(model, modelResource, diagram); - diagramResource.getContents().add(diagram); - diagram.setName(diagramName); - diagram.setElement(model); - } - - try { - modelResource - .save(org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorUtil - .getSaveOptions()); - diagramResource - .save(org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorUtil - .getSaveOptions()); - } catch (IOException e) { - - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to store model and diagram resources", e); //$NON-NLS-1$ - } - return CommandResult.newOKCommandResult(); - } - }; - try { - OperationHistoryFactory.getOperationHistory().execute(command, - new SubProgressMonitor(progressMonitor, 1), null); - } catch (ExecutionException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to create model and diagram", e); //$NON-NLS-1$ - } - setCharset(WorkspaceSynchronizer.getFile(modelResource)); - setCharset(WorkspaceSynchronizer.getFile(diagramResource)); - return diagramResource; - } - - /** - * Create a new instance of domain element associated with canvas. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static Package createInitialModel() { - return UMLFactory.eINSTANCE.createPackage(); - } - - /** - * Store model element in the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static void attachModelToResource(Package model, Resource resource, - Diagram diagram) { - resource.getContents().add(model); - loadDefaultImports(model, diagram); - - } - - /** - * @generated - */ - public static void selectElementsInDiagram( - IDiagramWorkbenchPart diagramPart, List/*EditPart*/editParts) { - diagramPart.getDiagramGraphicalViewer().deselectAll(); - - EditPart firstPrimary = null; - for (Iterator it = editParts.iterator(); it.hasNext();) { - EditPart nextPart = (EditPart) it.next(); - diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart); - if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) { - firstPrimary = nextPart; - } - } - - if (!editParts.isEmpty()) { - diagramPart.getDiagramGraphicalViewer().reveal( - firstPrimary != null ? firstPrimary : (EditPart) editParts - .get(0)); - } - } - - /** - * @generated - */ - private static int findElementsInDiagramByID(DiagramEditPart diagramPart, - EObject element, List editPartCollector) { - IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart - .getViewer(); - final int intialNumOfEditParts = editPartCollector.size(); - - if (element instanceof View) { // support notation element lookup - EditPart editPart = (EditPart) viewer.getEditPartRegistry().get( - element); - if (editPart != null) { - editPartCollector.add(editPart); - return 1; - } - } - - String elementID = EMFCoreUtil.getProxyID(element); - List associatedParts = viewer.findEditPartsForElement(elementID, - IGraphicalEditPart.class); - // perform the possible hierarchy disjoint -> take the top-most parts only - for (Iterator editPartIt = associatedParts.iterator(); editPartIt - .hasNext();) { - EditPart nextPart = (EditPart) editPartIt.next(); - EditPart parentPart = nextPart.getParent(); - while (parentPart != null && !associatedParts.contains(parentPart)) { - parentPart = parentPart.getParent(); - } - if (parentPart == null) { - editPartCollector.add(nextPart); - } - } - - if (intialNumOfEditParts == editPartCollector.size()) { - if (!associatedParts.isEmpty()) { - editPartCollector.add(associatedParts.iterator().next()); - } else { - if (element.eContainer() != null) { - return findElementsInDiagramByID(diagramPart, element - .eContainer(), editPartCollector); - } - } - } - return editPartCollector.size() - intialNumOfEditParts; - } - - /** - * @generated - */ - public static View findView(DiagramEditPart diagramEditPart, - EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) { - boolean hasStructuralURI = false; - if (targetElement.eResource() instanceof XMLResource) { - hasStructuralURI = ((XMLResource) targetElement.eResource()) - .getID(targetElement) == null; - } - - View view = null; - if (hasStructuralURI - && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { - view = (View) lazyElement2ViewMap.getElement2ViewMap().get( - targetElement); - } else if (findElementsInDiagramByID(diagramEditPart, targetElement, - lazyElement2ViewMap.editPartTmpHolder) > 0) { - EditPart editPart = (EditPart) lazyElement2ViewMap.editPartTmpHolder - .get(0); - lazyElement2ViewMap.editPartTmpHolder.clear(); - view = editPart.getModel() instanceof View ? (View) editPart - .getModel() : null; - } - - return (view == null) ? diagramEditPart.getDiagramView() : view; - } - - /** - * @generated - */ - public static class LazyElement2ViewMap { - /** - * @generated - */ - private Map element2ViewMap; - - /** - * @generated - */ - private View scope; - - /** - * @generated - */ - private Set elementSet; - - /** - * @generated - */ - public final List editPartTmpHolder = new ArrayList(); - - /** - * @generated - */ - public LazyElement2ViewMap(View scope, Set elements) { - this.scope = scope; - this.elementSet = elements; - } - - /** - * @generated - */ - public final Map getElement2ViewMap() { - if (element2ViewMap == null) { - element2ViewMap = new HashMap(); - // map possible notation elements to itself as these can't be found by view.getElement() - for (Iterator it = elementSet.iterator(); it.hasNext();) { - EObject element = (EObject) it.next(); - if (element instanceof View) { - View view = (View) element; - if (view.getDiagram() == scope.getDiagram()) { - element2ViewMap.put(element, element); // take only those that part of our diagram - } - } - } - - buildElement2ViewMap(scope, element2ViewMap, elementSet); - } - return element2ViewMap; - } - - /** - * @generated - */ - static Map buildElement2ViewMap(View parentView, Map element2ViewMap, - Set elements) { - if (elements.size() == element2ViewMap.size()) - return element2ViewMap; - - if (parentView.isSetElement() - && !element2ViewMap.containsKey(parentView.getElement()) - && elements.contains(parentView.getElement())) { - element2ViewMap.put(parentView.getElement(), parentView); - if (elements.size() == element2ViewMap.size()) - return element2ViewMap; - } - - for (Iterator it = parentView.getChildren().iterator(); it - .hasNext();) { - buildElement2ViewMap((View) it.next(), element2ViewMap, - elements); - if (elements.size() == element2ViewMap.size()) - return element2ViewMap; - } - for (Iterator it = parentView.getSourceEdges().iterator(); it - .hasNext();) { - buildElement2ViewMap((View) it.next(), element2ViewMap, - elements); - if (elements.size() == element2ViewMap.size()) - return element2ViewMap; - } - for (Iterator it = parentView.getSourceEdges().iterator(); it - .hasNext();) { - buildElement2ViewMap((View) it.next(), element2ViewMap, - elements); - if (elements.size() == element2ViewMap.size()) - return element2ViewMap; - } - return element2ViewMap; - } - } //LazyElement2ViewMap - - /** - * @generated - */ - public static IFile getFile(URI uri) { - if (uri.toString().startsWith("platform:/resource")) { //$NON-NLS-1$ - String path = uri.toString().substring( - "platform:/resource".length()); //$NON-NLS-1$ - IResource workspaceResource = ResourcesPlugin.getWorkspace() - .getRoot().findMember(new Path(path)); - if (workspaceResource instanceof IFile) { - return (IFile) workspaceResource; - } - } - return null; - } - - /** - * @generated - */ - private static void loadDefaultImports(Package model, Diagram diagram) { - ResourceSet resourceSet = model.eResource().getResourceSet(); - Model umlLibrary = (Model) resourceSet.getResource( - URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI), - true).getContents().get(0); - ElementImport elementImport = null; - elementImport = model.createElementImport(umlLibrary - .getOwnedType("Boolean")); - if (!MultiDiagramUtil.findEObjectReferencedInEAnnotation(diagram, - elementImport)) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - elementImport); - } - elementImport = model.createElementImport(umlLibrary - .getOwnedType("String")); - if (!MultiDiagramUtil.findEObjectReferencedInEAnnotation(diagram, - elementImport)) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - elementImport); - } - elementImport = model.createElementImport(umlLibrary - .getOwnedType("UnlimitedNatural")); - if (!MultiDiagramUtil.findEObjectReferencedInEAnnotation(diagram, - elementImport)) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - elementImport); - } - elementImport = model.createElementImport(umlLibrary - .getOwnedType("Integer")); - if (!MultiDiagramUtil.findEObjectReferencedInEAnnotation(diagram, - elementImport)) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, - elementImport); - } - } - - /** - * @generated - */ - public boolean providesFor(Object object) { - return true; - } - - /** - * @generated - */ - public IEditorPart createEditorFor(Object object) { - return new UMLDiagramEditor(); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramUpdateCommand.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramUpdateCommand.java deleted file mode 100644 index 68456108d48..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramUpdateCommand.java +++ /dev/null @@ -1,96 +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.part; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.PlatformUI; - -/** - * @generated - */ -@SuppressWarnings("unchecked") -public class UMLDiagramUpdateCommand implements IHandler { - - /** - * @generated - */ - public void addHandlerListener(IHandlerListener handlerListener) { - } - - /** - * @generated - */ - public void dispose() { - } - - /** - * @generated - */ - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection selection = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getSelectionService() - .getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - if (structuredSelection.size() != 1) { - return null; - } - if (structuredSelection.getFirstElement() instanceof EditPart - && ((EditPart) structuredSelection.getFirstElement()) - .getModel() instanceof View) { - EObject modelElement = ((View) ((EditPart) structuredSelection - .getFirstElement()).getModel()).getElement(); - List editPolicies = CanonicalEditPolicy - .getRegisteredEditPolicies(modelElement); - for (Iterator it = editPolicies.iterator(); it.hasNext();) { - CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it - .next(); - nextEditPolicy.refresh(); - } - - } - } - return null; - } - - /** - * @generated - */ - public boolean isEnabled() { - return true; - } - - /** - * @generated - */ - public boolean isHandled() { - return true; - } - - /** - * @generated - */ - public void removeHandlerListener(IHandlerListener handlerListener) { - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramUpdater.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramUpdater.java deleted file mode 100644 index e768a818fef..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDiagramUpdater.java +++ /dev/null @@ -1,2086 +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.part; - -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.CombinedFragment; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.InteractionFragment; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.PackageableElement; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLSwitch; - -import org.eclipse.papyrus.diagram.common.util.BasicEcoreSwitch; -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -@SuppressWarnings("unchecked") -public class UMLDiagramUpdater { - - /** - * @generated - */ - public static boolean isShortcutOrphaned(View view) { - return !view.isSetElement() || view.getElement() == null - || view.getElement().eIsProxy(); - } - - /** - * @generated - */ - public static List getSemanticChildren(View view) { - switch (UMLVisualIDRegistry.getVisualID(view)) { - case LifelineEditPart.VISUAL_ID: - return getLifeline_2002SemanticChildren(view); - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - return getInteractionInteractionCompartment_5001SemanticChildren(view); - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - return getInteractionInteractionCompartment_5002SemanticChildren(view); - case PackageEditPart.VISUAL_ID: - return getPackage_79SemanticChildren(view); - } - return Collections.EMPTY_LIST; - } - - /** - * @generated NOT - */ - public static List getLifeline_2002SemanticChildren(View view) { - if (!view.isSetElement()) { - return Collections.EMPTY_LIST; - } - Lifeline modelElement = (Lifeline) view.getElement(); - List result = new LinkedList(); - - // Added code - if (modelElement instanceof Lifeline) { - if ((modelElement).getCoveredBys().size() > 0) { - Interaction interaction = modelElement.getInteraction(); - - for (Iterator values = interaction.getFragments().iterator(); values - .hasNext();) { - EObject nextValue = (EObject) values.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID(view, - nextValue); - if (BehaviorExecutionSpecificationEditPart.VISUAL_ID == visualID) { - BehaviorExecutionSpecification be = (BehaviorExecutionSpecification) nextValue; - if (be.getCovereds().size() > 0 - && be.getCovereds().get(0) == modelElement) { - // result.add(nextValue); - result.add(new UMLNodeDescriptor(nextValue, - visualID)); - } - } - } - } - } - - // Autogenerated code not valid - // for (Iterator it = modelElement.getFragments().iterator(); - // it.hasNext();) { - // InteractionFragment childElement = (InteractionFragment) it.next(); - // int visualID = UMLVisualIDRegistry.getNodeVisualID(view, - // childElement); - // if (visualID == BehaviorExecutionSpecificationEditPart.VISUAL_ID) { - // result.add(new UMLNodeDescriptor(childElement, visualID)); - // continue; - // } - // } - - return result; - } - - /** - * @generated - */ - public static List getInteractionInteractionCompartment_5001SemanticChildren( - View view) { - if (false == view.eContainer() instanceof View) { - return Collections.EMPTY_LIST; - } - View containerView = (View) view.eContainer(); - if (!containerView.isSetElement()) { - return Collections.EMPTY_LIST; - } - Interaction modelElement = (Interaction) containerView.getElement(); - List result = new LinkedList(); - for (Iterator it = modelElement.getFragments().iterator(); it.hasNext();) { - InteractionFragment childElement = (InteractionFragment) it.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID(view, - childElement); - if (visualID == Interaction2EditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - if (visualID == CombinedFragmentEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - } - for (Iterator it = modelElement.getLifelines().iterator(); it.hasNext();) { - Lifeline childElement = (Lifeline) it.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID(view, - childElement); - if (visualID == LifelineEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - } - return result; - } - - /** - * @generated - */ - public static List getInteractionInteractionCompartment_5002SemanticChildren( - View view) { - if (false == view.eContainer() instanceof View) { - return Collections.EMPTY_LIST; - } - View containerView = (View) view.eContainer(); - if (!containerView.isSetElement()) { - return Collections.EMPTY_LIST; - } - Interaction modelElement = (Interaction) containerView.getElement(); - List result = new LinkedList(); - for (Iterator it = modelElement.getFragments().iterator(); it.hasNext();) { - InteractionFragment childElement = (InteractionFragment) it.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID(view, - childElement); - if (visualID == Interaction2EditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - if (visualID == CombinedFragmentEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - } - for (Iterator it = modelElement.getLifelines().iterator(); it.hasNext();) { - Lifeline childElement = (Lifeline) it.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID(view, - childElement); - if (visualID == LifelineEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - } - return result; - } - - /** - * @generated NOT - * - * modified to handle an Interaction as canvas element. - */ - static class ThisDiagramUpdaterSwitch extends - BasicEcoreSwitch<List<UMLNodeDescriptor>, View> { - @Override - public List<UMLNodeDescriptor> doSwitch(EObject modelElement) { - - final View view = getInfo(); - if (view == null) { - return Collections.EMPTY_LIST; - } - - UMLSwitch<List<UMLNodeDescriptor>> aSwitch = new UMLSwitch<List<UMLNodeDescriptor>>() { - - @Override - public List<UMLNodeDescriptor> casePackage(Package modelElement) { - List<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for (Iterator it = modelElement.getPackagedElements() - .iterator(); it.hasNext();) { - PackageableElement childElement = (PackageableElement) it - .next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID( - view, childElement); - if (visualID == InteractionEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, - visualID)); - continue; - } - } - for (Iterator it = modelElement.getOwnedComments() - .iterator(); it.hasNext();) { - Comment childElement = (Comment) it.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID( - view, childElement); - if (visualID == CommentEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, - visualID)); - continue; - } - } - return result; - } - - @Override - public List<UMLNodeDescriptor> caseInteraction( - Interaction modelElement) { - List<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); - for (Iterator it = modelElement.getOwnedComments() - .iterator(); it.hasNext();) { - Comment childElement = (Comment) it.next(); - int visualID = UMLVisualIDRegistry.getNodeVisualID( - view, childElement); - if (visualID == CommentEditPart.VISUAL_ID) { - result.add(new UMLNodeDescriptor(childElement, - visualID)); - continue; - } - } - result.add(new UMLNodeDescriptor(modelElement, - InteractionEditPart.VISUAL_ID)); - return result; - } - - }; - return aSwitch.doSwitch(modelElement); - } - } - - /** - * @generated - */ - private static ThisDiagramUpdaterSwitch aSwitch = new ThisDiagramUpdaterSwitch(); - - /** - * @generated - */ - public static List getPackage_79SemanticChildren(View view) { - if (!view.isSetElement()) { - return Collections.EMPTY_LIST; - } - EObject modelElement = (EObject) view.getElement(); - aSwitch.setInfo(view); - List<UMLNodeDescriptor> result = aSwitch.doSwitch(modelElement); - if (result == null || result.size() <= 0) { - return Collections.EMPTY_LIST; - } - return result; - } - - /** - * @generated - */ - public static List getContainedLinks(View view) { - switch (UMLVisualIDRegistry.getVisualID(view)) { - case PackageEditPart.VISUAL_ID: - return getPackage_79ContainedLinks(view); - case InteractionEditPart.VISUAL_ID: - return getInteraction_1001ContainedLinks(view); - case CommentEditPart.VISUAL_ID: - return getComment_2005ContainedLinks(view); - case Interaction2EditPart.VISUAL_ID: - return getInteraction_2001ContainedLinks(view); - case LifelineEditPart.VISUAL_ID: - return getLifeline_2002ContainedLinks(view); - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return getBehaviorExecutionSpecification_2003ContainedLinks(view); - case CombinedFragmentEditPart.VISUAL_ID: - return getCombinedFragment_2004ContainedLinks(view); - case MessageEditPart.VISUAL_ID: - return getMessage_3001ContainedLinks(view); - case Message2EditPart.VISUAL_ID: - return getMessage_3002ContainedLinks(view); - case Message3EditPart.VISUAL_ID: - return getMessage_3003ContainedLinks(view); - case Message4EditPart.VISUAL_ID: - return getMessage_3004ContainedLinks(view); - case Message5EditPart.VISUAL_ID: - return getMessage_3005ContainedLinks(view); - case Message6EditPart.VISUAL_ID: - return getMessage_3006ContainedLinks(view); - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - public static List getIncomingLinks(View view) { - switch (UMLVisualIDRegistry.getVisualID(view)) { - case InteractionEditPart.VISUAL_ID: - return getInteraction_1001IncomingLinks(view); - case CommentEditPart.VISUAL_ID: - return getComment_2005IncomingLinks(view); - case Interaction2EditPart.VISUAL_ID: - return getInteraction_2001IncomingLinks(view); - case LifelineEditPart.VISUAL_ID: - return getLifeline_2002IncomingLinks(view); - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return getBehaviorExecutionSpecification_2003IncomingLinks(view); - case CombinedFragmentEditPart.VISUAL_ID: - return getCombinedFragment_2004IncomingLinks(view); - case MessageEditPart.VISUAL_ID: - return getMessage_3001IncomingLinks(view); - case Message2EditPart.VISUAL_ID: - return getMessage_3002IncomingLinks(view); - case Message3EditPart.VISUAL_ID: - return getMessage_3003IncomingLinks(view); - case Message4EditPart.VISUAL_ID: - return getMessage_3004IncomingLinks(view); - case Message5EditPart.VISUAL_ID: - return getMessage_3005IncomingLinks(view); - case Message6EditPart.VISUAL_ID: - return getMessage_3006IncomingLinks(view); - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - public static List getOutgoingLinks(View view) { - switch (UMLVisualIDRegistry.getVisualID(view)) { - case InteractionEditPart.VISUAL_ID: - return getInteraction_1001OutgoingLinks(view); - case CommentEditPart.VISUAL_ID: - return getComment_2005OutgoingLinks(view); - case Interaction2EditPart.VISUAL_ID: - return getInteraction_2001OutgoingLinks(view); - case LifelineEditPart.VISUAL_ID: - return getLifeline_2002OutgoingLinks(view); - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return getBehaviorExecutionSpecification_2003OutgoingLinks(view); - case CombinedFragmentEditPart.VISUAL_ID: - return getCombinedFragment_2004OutgoingLinks(view); - case MessageEditPart.VISUAL_ID: - return getMessage_3001OutgoingLinks(view); - case Message2EditPart.VISUAL_ID: - return getMessage_3002OutgoingLinks(view); - case Message3EditPart.VISUAL_ID: - return getMessage_3003OutgoingLinks(view); - case Message4EditPart.VISUAL_ID: - return getMessage_3004OutgoingLinks(view); - case Message5EditPart.VISUAL_ID: - return getMessage_3005OutgoingLinks(view); - case Message6EditPart.VISUAL_ID: - return getMessage_3006OutgoingLinks(view); - } - return Collections.EMPTY_LIST; - } - - /** - * @generated NOT - * - * Modified to handle an Interaction as canvas element. - */ - public static List getPackage_79ContainedLinks(View view) { - EObject eObject = view.getElement(); - if (eObject instanceof Element) { - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007((Element) eObject)); - return result; - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - public static List getInteraction_1001ContainedLinks(View view) { - Interaction modelElement = (Interaction) view.getElement(); - List result = new LinkedList(); - result - .addAll(getContainedTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getInteraction_2001ContainedLinks(View view) { - Interaction modelElement = (Interaction) view.getElement(); - List result = new LinkedList(); - result - .addAll(getContainedTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getContainedTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getLifeline_2002ContainedLinks(View view) { - Lifeline modelElement = (Lifeline) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getBehaviorExecutionSpecification_2003ContainedLinks( - View view) { - BehaviorExecutionSpecification modelElement = (BehaviorExecutionSpecification) view - .getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getCombinedFragment_2004ContainedLinks(View view) { - CombinedFragment modelElement = (CombinedFragment) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getComment_2005ContainedLinks(View view) { - Comment modelElement = (Comment) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_3008(modelElement)); - return result; - } - - /** - * @generated not - */ - public static List getMessage_3001ContainedLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated not - */ - public static List getMessage_3002ContainedLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated not - */ - public static List getMessage_3003ContainedLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated not - */ - public static List getMessage_3004ContainedLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated not - */ - public static List getMessage_3005ContainedLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated not - */ - public static List getMessage_3006ContainedLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getInteraction_1001IncomingLinks(View view) { - Interaction modelElement = (Interaction) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getInteraction_2001IncomingLinks(View view) { - Interaction modelElement = (Interaction) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getLifeline_2002IncomingLinks(View view) { - Lifeline modelElement = (Lifeline) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getBehaviorExecutionSpecification_2003IncomingLinks( - View view) { - BehaviorExecutionSpecification modelElement = (BehaviorExecutionSpecification) view - .getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getCombinedFragment_2004IncomingLinks(View view) { - CombinedFragment modelElement = (CombinedFragment) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getComment_2005IncomingLinks(View view) { - Comment modelElement = (Comment) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Element_OwnedComment_3007( - modelElement, crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3001IncomingLinks(View view) { - Message modelElement = (Message) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3002IncomingLinks(View view) { - Message modelElement = (Message) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3003IncomingLinks(View view) { - Message modelElement = (Message) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3004IncomingLinks(View view) { - Message modelElement = (Message) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3005IncomingLinks(View view) { - Message modelElement = (Message) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3006IncomingLinks(View view) { - Message modelElement = (Message) view.getElement(); - Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource() - .getResourceSet().getResources()); - List result = new LinkedList(); - result.addAll(getIncomingTypeModelFacetLinks_Message_3001(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3002(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3003(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3004(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3005(modelElement, - crossReferences)); - result.addAll(getIncomingTypeModelFacetLinks_Message_3006(modelElement, - crossReferences)); - result - .addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - modelElement, crossReferences)); - return result; - } - - /** - * @generated - */ - public static List getInteraction_1001OutgoingLinks(View view) { - Interaction modelElement = (Interaction) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getInteraction_2001OutgoingLinks(View view) { - Interaction modelElement = (Interaction) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getLifeline_2002OutgoingLinks(View view) { - Lifeline modelElement = (Lifeline) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getBehaviorExecutionSpecification_2003OutgoingLinks( - View view) { - BehaviorExecutionSpecification modelElement = (BehaviorExecutionSpecification) view - .getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getCombinedFragment_2004OutgoingLinks(View view) { - CombinedFragment modelElement = (CombinedFragment) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getComment_2005OutgoingLinks(View view) { - Comment modelElement = (Comment) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_3008(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3001OutgoingLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3002OutgoingLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3003OutgoingLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3004OutgoingLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3005OutgoingLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated - */ - public static List getMessage_3006OutgoingLinks(View view) { - Message modelElement = (Message) view.getElement(); - List result = new LinkedList(); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3001(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3002(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3003(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3004(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3005(modelElement)); - result - .addAll(getOutgoingTypeModelFacetLinks_Message_3006(modelElement)); - result - .addAll(getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007(modelElement)); - return result; - } - - /** - * @generated NOT - */ - private static Collection getContainedTypeModelFacetLinks_Message_3001( - Interaction container) { - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (MessageEditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - if (dst == null || src == null) { - continue; - } - - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3001, MessageEditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getContainedTypeModelFacetLinks_Message_3002( - Interaction container) { - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message2EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - if (dst == null || src == null) { - continue; - } - - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3002, Message2EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getContainedTypeModelFacetLinks_Message_3003( - Interaction container) { - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message3EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - if (dst == null || src == null) { - continue; - } - - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3003, Message3EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getContainedTypeModelFacetLinks_Message_3004( - Interaction container) { - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message4EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - if (dst == null || src == null) { - continue; - } - - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3004, Message4EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getContainedTypeModelFacetLinks_Message_3005( - Interaction container) { - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message5EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - if (dst == null || src == null) { - continue; - } - - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3005, Message5EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getContainedTypeModelFacetLinks_Message_3006( - Interaction container) { - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message6EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - if (dst == null || src == null) { - continue; - } - - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3006, Message6EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getIncomingTypeModelFacetLinks_Message_3001( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE - .getElement_OwnedElement() - || false == setting.getEObject() instanceof Message) { - continue; - } - Message link = (Message) setting.getEObject(); - if (MessageEditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // Element src = link.getOwner(); - - // New code - Element src = MessageCommonUtil.getMessageSrc(link); - - result.add(new UMLLinkDescriptor(src, target, link, - UMLElementTypes.Message_3001, MessageEditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getIncomingTypeModelFacetLinks_Message_3002( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE - .getElement_OwnedElement() - || false == setting.getEObject() instanceof Message) { - continue; - } - Message link = (Message) setting.getEObject(); - if (Message2EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // Element src = link.getOwner(); - - // New code - Element src = MessageCommonUtil.getMessageSrc(link); - - result.add(new UMLLinkDescriptor(src, target, link, - UMLElementTypes.Message_3002, Message2EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getIncomingTypeModelFacetLinks_Message_3003( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE - .getElement_OwnedElement() - || false == setting.getEObject() instanceof Message) { - continue; - } - Message link = (Message) setting.getEObject(); - if (Message3EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // Element src = link.getOwner(); - - // New code - Element src = MessageCommonUtil.getMessageSrc(link); - - result.add(new UMLLinkDescriptor(src, target, link, - UMLElementTypes.Message_3003, Message3EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getIncomingTypeModelFacetLinks_Message_3004( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE - .getElement_OwnedElement() - || false == setting.getEObject() instanceof Message) { - continue; - } - Message link = (Message) setting.getEObject(); - if (Message4EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // Element src = link.getOwner(); - - // New code - Element src = MessageCommonUtil.getMessageSrc(link); - - result.add(new UMLLinkDescriptor(src, target, link, - UMLElementTypes.Message_3004, Message4EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getIncomingTypeModelFacetLinks_Message_3005( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE - .getElement_OwnedElement() - || false == setting.getEObject() instanceof Message) { - continue; - } - Message link = (Message) setting.getEObject(); - if (Message5EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // Element src = link.getOwner(); - - // New code - Element src = MessageCommonUtil.getMessageSrc(link); - - result.add(new UMLLinkDescriptor(src, target, link, - UMLElementTypes.Message_3005, Message5EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getIncomingTypeModelFacetLinks_Message_3006( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE - .getElement_OwnedElement() - || false == setting.getEObject() instanceof Message) { - continue; - } - Message link = (Message) setting.getEObject(); - if (Message6EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Original code - // Element src = link.getOwner(); - - // New code - Element src = MessageCommonUtil.getMessageSrc(link); - - result.add(new UMLLinkDescriptor(src, target, link, - UMLElementTypes.Message_3006, Message6EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated - */ - private static Collection getIncomingFeatureModelFacetLinks_Element_OwnedComment_3007( - Comment target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE - .getElement_OwnedComment()) { - result - .add(new org.eclipse.papyrus.diagram.sequence.part.UMLLinkDescriptor( - setting.getEObject(), target, - UMLElementTypes.ElementOwnedComment_3007, - ElementOwnedCommentEditPart.VISUAL_ID)); - } - } - return result; - } - - /** - * @generated - */ - private static Collection getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - Element target, Map crossReferences) { - Collection result = new LinkedList(); - Collection settings = (Collection) crossReferences.get(target); - for (Iterator it = settings.iterator(); it.hasNext();) { - EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it - .next(); - if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE - .getComment_AnnotatedElement()) { - result - .add(new org.eclipse.papyrus.diagram.sequence.part.UMLLinkDescriptor( - setting.getEObject(), target, - UMLElementTypes.CommentAnnotatedElement_3008, - CommentAnnotatedElementEditPart.VISUAL_ID)); - } - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getOutgoingTypeModelFacetLinks_Message_3001( - Element source) { - Interaction container = null; - // Find container element for the 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 && container == null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - } - } - if (container == null) { - return Collections.EMPTY_LIST; - } - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (MessageEditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Generated code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - - // Generated code - // if (src != source) { - // continue; - // } - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3001, MessageEditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getOutgoingTypeModelFacetLinks_Message_3002( - Element source) { - Interaction container = null; - // Find container element for the 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 && container == null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - } - } - if (container == null) { - return Collections.EMPTY_LIST; - } - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message2EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - // Generated code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - - // Generated code - // if (src != source) { - // continue; - // } - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3002, Message2EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getOutgoingTypeModelFacetLinks_Message_3003( - Element source) { - Interaction container = null; - // Find container element for the 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 && container == null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - } - } - if (container == null) { - return Collections.EMPTY_LIST; - } - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message3EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - List targets = link.getOwnedElements(); - Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if (false == theTarget instanceof Element) { - continue; - } - // Generated code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - - // Generated code - // if (src != source) { - // continue; - // } - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3003, Message3EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getOutgoingTypeModelFacetLinks_Message_3004( - Element source) { - Interaction container = null; - // Find container element for the 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 && container == null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - } - } - if (container == null) { - return Collections.EMPTY_LIST; - } - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message4EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - List targets = link.getOwnedElements(); - Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if (false == theTarget instanceof Element) { - continue; - } - // Generated code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - - // Generated code - // if (src != source) { - // continue; - // } - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3004, Message4EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getOutgoingTypeModelFacetLinks_Message_3005( - Element source) { - Interaction container = null; - // Find container element for the 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 && container == null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - } - } - if (container == null) { - return Collections.EMPTY_LIST; - } - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message5EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - List targets = link.getOwnedElements(); - Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if (false == theTarget instanceof Element) { - continue; - } - // Generated code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - - // Generated code - // if (src != source) { - // continue; - // } - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3005, Message5EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - private static Collection getOutgoingTypeModelFacetLinks_Message_3006( - Element source) { - Interaction container = null; - // Find container element for the 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 && container == null; element = element - .eContainer()) { - if (element instanceof Interaction) { - container = (Interaction) element; - } - } - if (container == null) { - return Collections.EMPTY_LIST; - } - Collection result = new LinkedList(); - for (Iterator links = container.getMessages().iterator(); links - .hasNext();) { - Object linkObject = links.next(); - if (false == linkObject instanceof Message) { - continue; - } - Message link = (Message) linkObject; - if (Message6EditPart.VISUAL_ID != UMLVisualIDRegistry - .getLinkWithClassVisualID(link)) { - continue; - } - List targets = link.getOwnedElements(); - Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if (false == theTarget instanceof Element) { - continue; - } - // Generated code - // List targets = link.getOwnedElements(); - // Object theTarget = targets.size() == 1 ? targets.get(0) : null; - // if (false == theTarget instanceof Element) { - // continue; - // } - // Element dst = (Element) theTarget; - // Element src = link.getOwner(); - - // New code - Element dst = MessageCommonUtil.getMessageDst(link); - Element src = MessageCommonUtil.getMessageSrc(link); - - // Generated code - // if (src != source) { - // continue; - // } - result.add(new UMLLinkDescriptor(src, dst, link, - UMLElementTypes.Message_3006, Message6EditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated not - */ - private static Collection getOutgoingFeatureModelFacetLinks_Element_OwnedComment_3007( - Element source) { - return new LinkedList(); - } - - /** - * @generated - */ - private static Collection getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_3008( - Comment source) { - Collection result = new LinkedList(); - for (Iterator destinations = source.getAnnotatedElements().iterator(); destinations - .hasNext();) { - Element destination = (Element) destinations.next(); - result - .add(new org.eclipse.papyrus.diagram.sequence.part.UMLLinkDescriptor( - source, destination, - UMLElementTypes.CommentAnnotatedElement_3008, - CommentAnnotatedElementEditPart.VISUAL_ID)); - } - return result; - } - - /** - * @generated NOT - */ - public static UMLLinkDescriptor createLinkDescriptorFromModelElement( - EObject eObject) { - int linkID = UMLVisualIDRegistry.getLinkWithClassVisualID(eObject); - switch (linkID) { - case MessageEditPart.VISUAL_ID: - return createLinkDescriptorFromMessage((Message) eObject); - case Message2EditPart.VISUAL_ID: - return createLinkDescriptorFromMessage2((Message) eObject); - case Message3EditPart.VISUAL_ID: - return createLinkDescriptorFromMessage3((Message) eObject); - case Message4EditPart.VISUAL_ID: - return createLinkDescriptorFromMessage4((Message) eObject); - case Message5EditPart.VISUAL_ID: - return createLinkDescriptorFromMessage5((Message) eObject); - case Message6EditPart.VISUAL_ID: - return createLinkDescriptorFromMessage6((Message) eObject); - default: - return null; - } - } - - private static UMLLinkDescriptor createLinkDescriptorFromMessage( - Message message) { - Element src = MessageCommonUtil.getMessageSrc(message); - Element target = MessageCommonUtil.getMessageDst(message); - return new UMLLinkDescriptor(src, target, message, - UMLElementTypes.Message_3001, MessageEditPart.VISUAL_ID); - } - - private static UMLLinkDescriptor createLinkDescriptorFromMessage2( - Message message) { - Element src = MessageCommonUtil.getMessageSrc(message); - Element target = MessageCommonUtil.getMessageDst(message); - return new UMLLinkDescriptor(src, target, message, - UMLElementTypes.Message_3002, Message2EditPart.VISUAL_ID); - } - - private static UMLLinkDescriptor createLinkDescriptorFromMessage3( - Message message) { - Element src = MessageCommonUtil.getMessageSrc(message); - Element target = MessageCommonUtil.getMessageDst(message); - return new UMLLinkDescriptor(src, target, message, - UMLElementTypes.Message_3003, Message3EditPart.VISUAL_ID); - } - - private static UMLLinkDescriptor createLinkDescriptorFromMessage4( - Message message) { - Element src = MessageCommonUtil.getMessageSrc(message); - Element target = MessageCommonUtil.getMessageDst(message); - return new UMLLinkDescriptor(src, target, message, - UMLElementTypes.Message_3004, Message4EditPart.VISUAL_ID); - } - - private static UMLLinkDescriptor createLinkDescriptorFromMessage5( - Message message) { - Element src = MessageCommonUtil.getMessageSrc(message); - Element target = MessageCommonUtil.getMessageDst(message); - return new UMLLinkDescriptor(src, target, message, - UMLElementTypes.Message_3005, Message5EditPart.VISUAL_ID); - } - - private static UMLLinkDescriptor createLinkDescriptorFromMessage6( - Message message) { - Element src = MessageCommonUtil.getMessageSrc(message); - Element target = MessageCommonUtil.getMessageDst(message); - return new UMLLinkDescriptor(src, target, message, - UMLElementTypes.Message_3006, Message6EditPart.VISUAL_ID); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDocumentProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDocumentProvider.java deleted file mode 100644 index 4311228331d..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDocumentProvider.java +++ /dev/null @@ -1,714 +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.part; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.MultiRule; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.part.FileEditorInput; - -import org.eclipse.papyrus.diagram.common.part.CachedResourcesDocumentProvider; - -/** - * @generated - */ -public class UMLDocumentProvider extends CachedResourcesDocumentProvider - implements IDiagramDocumentProvider { - - /** - * @generated - */ - @Override - protected ElementInfo createElementInfo(Object element) - throws CoreException { - if (false == element instanceof FileEditorInput - && false == element instanceof URIEditorInput) { - throw new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - 0, - NLS - .bind( - Messages.UMLDocumentProvider_IncorrectInputError, - new Object[] { - element, - "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); - } - IEditorInput editorInput = (IEditorInput) element; - IDiagramDocument document = (IDiagramDocument) createDocument(editorInput); - - CachedResourceSetInfo info = new CachedResourceSetInfo(document, - editorInput); - info.setModificationStamp(computeModificationStamp(info)); - info.fStatus = null; - return info; - } - - /** - * @generated - */ - @Override - protected IDocument createDocument(Object element) throws CoreException { - if (false == element instanceof FileEditorInput - && false == element instanceof URIEditorInput) { - throw new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - 0, - NLS - .bind( - Messages.UMLDocumentProvider_IncorrectInputError, - new Object[] { - element, - "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); - } - IDocument document = createEmptyDocument((IEditorInput) element); - setDocumentContent(document, (IEditorInput) element); - setupDocument(element, document); - return document; - } - - /** - * Sets up the given document as it would be provided for the given element. The - * content of the document is not changed. This default implementation is empty. - * Subclasses may reimplement. - * - * @param element the blue-print element - * @param document the document to set up - * @generated - */ - protected void setupDocument(Object element, IDocument document) { - // for subclasses - } - - /** - * @generated - */ - protected void setDocumentContent(IDocument document, IEditorInput element) - throws CoreException { - IDiagramDocument diagramDocument = (IDiagramDocument) document; - TransactionalEditingDomain domain = diagramDocument.getEditingDomain(); - if (element instanceof FileEditorInput) { - IStorage storage = ((FileEditorInput) element).getStorage(); - Diagram diagram = DiagramIOUtil.load(domain, storage, true, - getProgressMonitor()); - document.setContent(diagram); - } else if (element instanceof URIEditorInput) { - URI uri = ((URIEditorInput) element).getURI(); - Resource resource = null; - try { - resource = domain.getResourceSet().getResource( - uri.trimFragment(), false); - if (resource == null) { - resource = domain.getResourceSet().createResource( - uri.trimFragment()); - } - if (!resource.isLoaded()) { - try { - Map options = new HashMap(GMFResourceFactory - .getDefaultLoadOptions()); - // @see 171060 - // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); - resource.load(options); - } catch (IOException e) { - resource.unload(); - throw e; - } - } - if (uri.fragment() != null) { - EObject rootElement = resource.getEObject(uri.fragment()); - if (rootElement instanceof Diagram) { - document.setContent((Diagram) rootElement); - return; - } - } else { - for (Iterator it = resource.getContents().iterator(); it - .hasNext();) { - Object rootElement = it.next(); - if (rootElement instanceof Diagram) { - document.setContent((Diagram) rootElement); - return; - } - } - } - throw new RuntimeException( - Messages.UMLDocumentProvider_NoDiagramInResourceError); - } catch (Exception e) { - CoreException thrownExcp = null; - if (e instanceof CoreException) { - thrownExcp = (CoreException) e; - } else { - String msg = e.getLocalizedMessage(); - thrownExcp = new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - 0, - msg != null ? msg - : Messages.UMLDocumentProvider_DiagramLoadingError, - e)); - } - throw thrownExcp; - } - } else { - throw new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - 0, - NLS - .bind( - Messages.UMLDocumentProvider_IncorrectInputError, - new Object[] { - element, - "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); - } - } - - /** - * @generated - */ - @Override - public long getModificationStamp(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - return computeModificationStamp(info); - } - return super.getModificationStamp(element); - } - - /** - * @generated - */ - @Override - public boolean isDeleted(Object element) { - IDiagramDocument document = getDiagramDocument(element); - if (document != null) { - Resource diagramResource = document.getDiagram().eResource(); - if (diagramResource != null) { - IFile file = WorkspaceSynchronizer.getFile(diagramResource); - return file == null || file.getLocation() == null - || !file.getLocation().toFile().exists(); - } - } - return super.isDeleted(element); - } - - /** - * @generated - */ - public CachedResourceSetInfo getResourceSetInfo(Object editorInput) { - return (CachedResourceSetInfo) super.getElementInfo(editorInput); - } - - /** - * @generated - */ - @Override - protected void doValidateState(Object element, Object computationContext) - throws CoreException { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - Collection files2Validate = new ArrayList(); - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - IFile file = WorkspaceSynchronizer.getFile(nextResource); - if (file != null && file.isReadOnly()) { - files2Validate.add(file); - } - } - ResourcesPlugin.getWorkspace().validateEdit( - (IFile[]) files2Validate.toArray(new IFile[files2Validate - .size()]), computationContext); - } - - super.doValidateState(element, computationContext); - } - - /** - * @generated - */ - @Override - public boolean isReadOnly(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - if (info.isUpdateCache()) { - try { - updateCache(element); - } catch (CoreException ex) { - UMLDiagramEditorPlugin.getInstance().logError( - Messages.UMLDocumentProvider_isModifiable, ex); - // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable - } - } - return info.isReadOnly(); - } - return super.isReadOnly(element); - } - - /** - * @generated - */ - @Override - public boolean isModifiable(Object element) { - if (!isStateValidated(element)) { - if (element instanceof FileEditorInput - || element instanceof URIEditorInput) { - return true; - } - } - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - if (info.isUpdateCache()) { - try { - updateCache(element); - } catch (CoreException ex) { - UMLDiagramEditorPlugin.getInstance().logError( - Messages.UMLDocumentProvider_isModifiable, ex); - // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable - } - } - return info.isModifiable(); - } - return super.isModifiable(element); - } - - /** - * @generated - */ - protected void updateCache(Object element) throws CoreException { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - IFile file = WorkspaceSynchronizer.getFile(nextResource); - if (file != null && file.isReadOnly()) { - info.setReadOnly(true); - info.setModifiable(false); - return; - } - } - info.setReadOnly(false); - info.setModifiable(true); - return; - } - } - - /** - * @generated - */ - @Override - protected void doUpdateStateCache(Object element) throws CoreException { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - info.setUpdateCache(true); - } - super.doUpdateStateCache(element); - } - - /** - * @generated - */ - @Override - public boolean isSynchronized(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - return info.isSynchronized(); - } - return super.isSynchronized(element); - } - - /** - * @generated - */ - @Override - protected ISchedulingRule getResetRule(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - Collection rules = new ArrayList(); - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - IFile file = WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - rules.add(ResourcesPlugin.getWorkspace().getRuleFactory() - .modifyRule(file)); - } - } - return new MultiRule((ISchedulingRule[]) rules - .toArray(new ISchedulingRule[rules.size()])); - } - return null; - } - - /** - * @generated - */ - @Override - protected ISchedulingRule getSaveRule(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - Collection rules = new ArrayList(); - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - IFile file = WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - rules.add(computeSchedulingRule(file)); - } - } - return new MultiRule((ISchedulingRule[]) rules - .toArray(new ISchedulingRule[rules.size()])); - } - return null; - } - - /** - * @generated - */ - @Override - protected ISchedulingRule getSynchronizeRule(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - Collection rules = new ArrayList(); - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - IFile file = WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - rules.add(ResourcesPlugin.getWorkspace().getRuleFactory() - .refreshRule(file)); - } - } - return new MultiRule((ISchedulingRule[]) rules - .toArray(new ISchedulingRule[rules.size()])); - } - return null; - } - - /** - * @generated - */ - @Override - protected ISchedulingRule getValidateStateRule(Object element) { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - Collection files = new ArrayList(); - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - IFile file = WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - files.add(file); - } - } - return ResourcesPlugin.getWorkspace().getRuleFactory() - .validateEditRule( - (IFile[]) files.toArray(new IFile[files.size()])); - } - return null; - } - - /** - * @generated - */ - private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) { - if (toCreateOrModify.exists()) - return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule( - toCreateOrModify); - - IResource parent = toCreateOrModify; - do { - /* - * XXX This is a workaround for - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601 - * IResourceRuleFactory.createRule should iterate the hierarchy - * itself. - */ - toCreateOrModify = parent; - parent = toCreateOrModify.getParent(); - } while (parent != null && !parent.exists()); - - return ResourcesPlugin.getWorkspace().getRuleFactory().createRule( - toCreateOrModify); - } - - /** - * @generated - */ - @Override - protected void doSynchronize(Object element, IProgressMonitor monitor) - throws CoreException { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - for (Iterator it = info.getResourceSet().getResources().iterator(); it - .hasNext();) { - Resource nextResource = (Resource) it.next(); - handleElementChanged(info, nextResource, monitor); - } - return; - } - super.doSynchronize(element, monitor); - } - - /** - * @generated - */ - @Override - protected void doSaveDocument(IProgressMonitor monitor, Object element, - IDocument document, boolean overwrite) throws CoreException { - CachedResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - if (!overwrite && !info.isSynchronized()) { - throw new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - IResourceStatus.OUT_OF_SYNC_LOCAL, - Messages.UMLDocumentProvider_UnsynchronizedFileSaveError, - null)); - } - info.stopResourceListening(); - fireElementStateChanging(element); - List resources = info.getResourceSet().getResources(); - try { - monitor.beginTask(Messages.UMLDocumentProvider_SaveDiagramTask, - resources.size() + 1); //"Saving diagram" - for (Iterator it = resources.iterator(); it.hasNext();) { - Resource nextResource = (Resource) it.next(); - monitor.setTaskName(NLS.bind( - Messages.UMLDocumentProvider_SaveNextResourceTask, - nextResource.getURI())); - if (nextResource.isLoaded() - && !info.getEditingDomain() - .isReadOnly(nextResource)) { - try { - nextResource.save(UMLDiagramEditorUtil - .getSaveOptions()); - } catch (IOException e) { - fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - EditorStatusCodes.RESOURCE_FAILURE, e - .getLocalizedMessage(), null)); - } - } - monitor.worked(1); - } - monitor.done(); - info.setModificationStamp(computeModificationStamp(info)); - } catch (RuntimeException x) { - fireElementStateChangeFailed(element); - throw x; - } finally { - info.startResourceListening(); - } - } else { - URI newResoruceURI; - List affectedFiles = null; - if (element instanceof FileEditorInput) { - IFile newFile = ((FileEditorInput) element).getFile(); - affectedFiles = Collections.singletonList(newFile); - newResoruceURI = URI.createPlatformResourceURI(newFile - .getFullPath().toString(), true); - } else if (element instanceof URIEditorInput) { - newResoruceURI = ((URIEditorInput) element).getURI(); - } else { - fireElementStateChangeFailed(element); - throw new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - 0, - NLS - .bind( - Messages.UMLDocumentProvider_IncorrectInputError, - new Object[] { - element, - "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); - } - if (false == document instanceof IDiagramDocument) { - fireElementStateChangeFailed(element); - throw new CoreException( - new Status( - IStatus.ERROR, - UMLDiagramEditorPlugin.ID, - 0, - "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$ - } - IDiagramDocument diagramDocument = (IDiagramDocument) document; - final Resource newResource = diagramDocument.getEditingDomain() - .getResourceSet().createResource(newResoruceURI); - final Diagram diagramCopy = (Diagram) EcoreUtil - .copy(diagramDocument.getDiagram()); - try { - new AbstractTransactionalCommand(diagramDocument - .getEditingDomain(), NLS.bind( - Messages.UMLDocumentProvider_SaveAsOperation, - diagramCopy.getName()), affectedFiles) { - protected CommandResult doExecuteWithResult( - IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - newResource.getContents().add(diagramCopy); - return CommandResult.newOKCommandResult(); - } - }.execute(monitor, null); - newResource.save(UMLDiagramEditorUtil.getSaveOptions()); - } catch (ExecutionException e) { - fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, - UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), - null)); - } catch (IOException e) { - fireElementStateChangeFailed(element); - throw new CoreException(new Status(IStatus.ERROR, - UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), - null)); - } - newResource.unload(); - } - } - - /** - * @generated - */ - @Override - protected void handleElementChanged(CachedResourceSetInfo info, - Resource changedResource, IProgressMonitor monitor) { - IFile file = WorkspaceSynchronizer.getFile(changedResource); - if (file != null) { - try { - file.refreshLocal(IResource.DEPTH_INFINITE, monitor); - } catch (CoreException ex) { - UMLDiagramEditorPlugin - .getInstance() - .logError( - Messages.UMLDocumentProvider_handleElementContentChanged, - ex); - // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged - } - } - changedResource.unload(); - - fireElementContentAboutToBeReplaced(info.getEditorInput()); - removeUnchangedElementListeners(info.getEditorInput(), info); - info.fStatus = null; - try { - setDocumentContent(info.fDocument, info.getEditorInput()); - } catch (CoreException e) { - info.fStatus = e.getStatus(); - } - if (!info.fCanBeSaved) { - info.setModificationStamp(computeModificationStamp(info)); - } - addUnchangedElementListeners(info.getEditorInput(), info); - fireElementContentReplaced(info.getEditorInput()); - } - - /** - * @generated - */ - @Override - protected void handleElementMoved(IEditorInput input, URI uri) { - if (input instanceof FileEditorInput) { - IFile newFile = ResourcesPlugin.getWorkspace().getRoot().getFile( - new Path(URI.decode(uri.path())).removeFirstSegments(1)); - fireElementMoved(input, newFile == null ? null - : new FileEditorInput(newFile)); - return; - } - // TODO: append suffix to the URI! (use diagram as a parameter) - fireElementMoved(input, new URIEditorInput(uri)); - } - - /** - * @generated - */ - public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, - TransactionalEditingDomain domain) { - return editorInput; - } - - /** - * @generated - */ - public IDiagramDocument getDiagramDocument(Object element) { - IDocument doc = getDocument(element); - if (doc instanceof IDiagramDocument) { - return (IDiagramDocument) doc; - } - return null; - } - - /** - * @generated - */ - @Override - protected IRunnableContext getOperationRunner(IProgressMonitor monitor) { - return null; - } - - /** - * @generated - */ - @Override - protected String getEditingDomainID() { - return "es.cv.gvcase.mdt.uml2.diagram.SharedEditingDomainID"; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDomainModelElementTester.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDomainModelElementTester.java deleted file mode 100644 index a5c5ddc9d0a..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLDomainModelElementTester.java +++ /dev/null @@ -1,778 +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.part; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * @generated - */ -public class UMLDomainModelElementTester extends PropertyTester { - - /** - * @generated - */ - public boolean test(Object receiver, String method, Object[] args, - Object expectedValue) { - if (false == receiver instanceof EObject) { - return false; - } - EObject eObject = (EObject) receiver; - EClass eClass = eObject.eClass(); - if (eClass == UMLPackage.eINSTANCE.getComment()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPackage()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPackageableElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getNamedElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDependency()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDirectedRelationship()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRelationship()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getNamespace()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getElementImport()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPackageImport()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConstraint()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getValueSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTypedElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getType()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAssociation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClassifier()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRedefinableElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTemplateableElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTemplateBinding()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTemplateSignature()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTemplateParameter()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getParameterableElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTemplateParameterSubstitution()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getGeneralization()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getGeneralizationSet()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getFeature()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSubstitution()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRealization()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAbstraction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOpaqueExpression()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getParameter()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getMultiplicityElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConnectableElement()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE - .getConnectableElementTemplateParameter()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConnectorEnd()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getProperty()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDeploymentTarget()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDeployment()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDeployedArtifact()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDeploymentSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getArtifact()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getManifestation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOperation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getBehavioralFeature()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getBehavior()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClass_()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getBehavioredClassifier()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInterfaceRealization()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInterface()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReception()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSignal()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getProtocolStateMachine()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStateMachine()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRegion()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getVertex()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTransition()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTrigger()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPort()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getState()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConnectionPointReference()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPseudostate()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getProtocolConformance()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getEncapsulatedClassifier()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStructuredClassifier()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConnector()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExtension()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExtensionEnd()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStereotype()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getImage()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getProfile()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getModel()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getParameterSet()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDataType()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOperationTemplateParameter()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStructuralFeature()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCollaborationUse()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCollaboration()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getUseCase()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInclude()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExtend()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExtensionPoint()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRedefinableTemplateSignature()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClassifierTemplateParameter()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStringExpression()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExpression()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getUsage()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPackageMerge()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getProfileApplication()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getEnumeration()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getEnumerationLiteral()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInstanceSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSlot()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPrimitiveType()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLiteralSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLiteralInteger()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLiteralString()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLiteralBoolean()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLiteralNull()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInstanceValue()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLiteralUnlimitedNatural()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOpaqueBehavior()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getFunctionBehavior()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOpaqueAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExecutableNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivityNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStructuredActivityNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivityGroup()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivity()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getVariable()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivityEdge()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivityPartition()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInterruptibleActivityRegion()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExceptionHandler()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getObjectNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOutputPin()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPin()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInputPin()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCallAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInvocationAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSendSignalAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCallOperationAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCallBehaviorAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSequenceNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getControlNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getControlFlow()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInitialNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivityParameterNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getValuePin()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getMessage()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getMessageEnd()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInteraction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInteractionFragment()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLifeline()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getPartDecomposition()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInteractionUse()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getGate()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getGeneralOrdering()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getOccurrenceSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInteractionOperand()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInteractionConstraint()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExecutionSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStateInvariant()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActionExecutionSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getBehaviorExecutionSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExecutionEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCreationEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDestructionEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSendOperationEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getMessageEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSendSignalEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getMessageOccurrenceSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE - .getExecutionOccurrenceSpecification()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReceiveOperationEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReceiveSignalEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActor()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCallEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getChangeEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSignalEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAnyReceiveEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getForkNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getFlowFinalNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getFinalNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCentralBufferNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getMergeNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDecisionNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActivityFinalNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getComponentRealization()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getComponent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCommunicationPath()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDevice()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExecutionEnvironment()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCombinedFragment()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getContinuation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConsiderIgnoreFragment()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCreateObjectAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDestroyObjectAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTestIdentityAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadSelfAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStructuralFeatureAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadStructuralFeatureAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getWriteStructuralFeatureAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClearStructuralFeatureAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE - .getRemoveStructuralFeatureValueAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLinkAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLinkEndData()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getQualifierValue()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadLinkAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLinkEndCreationData()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCreateLinkAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getWriteLinkAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDestroyLinkAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLinkEndDestructionData()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClearAssociationAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getBroadcastSignalAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getSendObjectAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getValueSpecificationAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTimeExpression()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getObservation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDuration()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDurationInterval()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInterval()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTimeConstraint()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getIntervalConstraint()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTimeInterval()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDurationConstraint()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTimeObservation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDurationObservation()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getFinalState()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getTimeEvent()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getVariableAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadVariableAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getWriteVariableAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClearVariableAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAddVariableValueAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRemoveVariableValueAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getRaiseExceptionAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getActionInputPin()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInformationItem()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getInformationFlow()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadExtentAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReclassifyObjectAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadIsClassifiedObjectAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getStartClassifierBehaviorAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReadLinkObjectEndAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE - .getReadLinkObjectEndQualifierAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getCreateLinkObjectAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAcceptEventAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAcceptCallAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReplyAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getUnmarshallAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getReduceAction()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getJoinNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getDataStoreNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getObjectFlow()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getConditionalNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getClause()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getLoopNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExpansionNode()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getExpansionRegion()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getProtocolTransition()) { - return true; - } - if (eClass == UMLPackage.eINSTANCE.getAssociationClass()) { - return true; - } - return false; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLElementChooserDialog.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLElementChooserDialog.java deleted file mode 100644 index 414b2c19004..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLElementChooserDialog.java +++ /dev/null @@ -1,416 +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.part; - -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.edit.provider.IWrapperItemProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * @generated - */ -public class UMLElementChooserDialog extends Dialog { - - /** - * @generated - */ - private TreeViewer myTreeViewer; - - /** - * @generated - */ - private URI mySelectedModelElementURI; - - /** - * @generated - */ - private View myView; - - /** - * @generated - */ - private TransactionalEditingDomain myEditingDomain = GMFEditingDomainFactory.INSTANCE - .createEditingDomain(); - - /** - * @generated - */ - public UMLElementChooserDialog(Shell parentShell, View view) { - super(parentShell); - setShellStyle(getShellStyle() | SWT.RESIZE); - myView = view; - } - - /** - * @generated - */ - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText( - Messages.UMLElementChooserDialog_SelectModelElementTitle); - createModelBrowser(composite); - return composite; - } - - /** - * @generated - */ - @Override - protected Control createButtonBar(Composite parent) { - Control buttonBar = super.createButtonBar(parent); - setOkButtonEnabled(false); - return buttonBar; - } - - /** - * @generated - */ - private void createModelBrowser(Composite composite) { - myTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL - | SWT.V_SCROLL | SWT.BORDER); - GridData layoutData = new GridData(GridData.FILL_BOTH); - layoutData.heightHint = 300; - layoutData.widthHint = 300; - myTreeViewer.getTree().setLayoutData(layoutData); - myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider()); - myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider()); - myTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); - myTreeViewer.addFilter(new ModelFilesFilter()); - myTreeViewer.addSelectionChangedListener(new OkButtonEnabler()); - } - - /** - * @generated - */ - private void setOkButtonEnabled(boolean enabled) { - getButton(IDialogConstants.OK_ID).setEnabled(enabled); - } - - /** - * @generated - */ - private boolean isValidModelFile(IFile file) { - String fileExtension = file.getFullPath().getFileExtension(); - return "uml".equals(fileExtension); //$NON-NLS-1$ - } - - /** - * @generated - */ - public URI getSelectedModelElementURI() { - return mySelectedModelElementURI; - } - - /** - * @generated - */ - @Override - public int open() { - int result = super.open(); - for (Iterator it = myEditingDomain.getResourceSet().getResources() - .iterator(); it.hasNext();) { - Resource resource = (Resource) it.next(); - resource.unload(); - } - myEditingDomain.dispose(); - return result; - } - - /** - * @generated - */ - private class ModelElementsTreeContentProvider implements - ITreeContentProvider { - - /** - * @generated - */ - private ITreeContentProvider myWorkbenchContentProvider = new WorkbenchContentProvider(); - - /** - * @generated - */ - private AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - - /** - * @generated - */ - public Object[] getChildren(Object parentElement) { - Object[] result = myWorkbenchContentProvider - .getChildren(parentElement); - if (result != null && result.length > 0) { - return result; - } - if (parentElement instanceof IFile) { - IFile modelFile = (IFile) parentElement; - IPath resourcePath = modelFile.getFullPath(); - ResourceSet resourceSet = myEditingDomain.getResourceSet(); - try { - Resource modelResource = resourceSet.getResource(URI - .createPlatformResourceURI(resourcePath.toString(), - true), true); - return myAdapterFctoryContentProvier - .getChildren(modelResource); - } catch (WrappedException e) { - UMLDiagramEditorPlugin - .getInstance() - .logError( - "Unable to load resource: " + resourcePath.toString(), e); //$NON-NLS-1$ - } - return Collections.EMPTY_LIST.toArray(); - } - return myAdapterFctoryContentProvier.getChildren(parentElement); - } - - /** - * @generated - */ - public Object getParent(Object element) { - Object parent = myWorkbenchContentProvider.getParent(element); - if (parent != null) { - return parent; - } - if (element instanceof EObject) { - EObject eObject = (EObject) element; - if (eObject.eContainer() == null - && eObject.eResource().getURI().isFile()) { - String path = eObject.eResource().getURI().path(); - return ResourcesPlugin.getWorkspace().getRoot() - .getFileForLocation(new Path(path)); - } - return myAdapterFctoryContentProvier.getParent(eObject); - } - return null; - } - - /** - * @generated - */ - public boolean hasChildren(Object element) { - if (element instanceof IFile) { - return isValidModelFile((IFile) element); - } - return myWorkbenchContentProvider.hasChildren(element) - || myAdapterFctoryContentProvier.hasChildren(element); - } - - /** - * @generated - */ - public Object[] getElements(Object inputElement) { - Object[] elements = myWorkbenchContentProvider - .getElements(inputElement); - return elements; - } - - /** - * @generated - */ - public void dispose() { - myWorkbenchContentProvider.dispose(); - myAdapterFctoryContentProvier.dispose(); - } - - /** - * @generated - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput); - myAdapterFctoryContentProvier.inputChanged(viewer, oldInput, - newInput); - } - - } - - /** - * @generated - */ - private class ModelElementsTreeLabelProvider implements ILabelProvider { - - /** - * @generated - */ - private WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider(); - - /** - * @generated - */ - private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - - /** - * @generated - */ - public Image getImage(Object element) { - Image result = myWorkbenchLabelProvider.getImage(element); - return result != null ? result : myAdapterFactoryLabelProvider - .getImage(element); - } - - /** - * @generated - */ - public String getText(Object element) { - String result = myWorkbenchLabelProvider.getText(element); - return result != null && result.length() > 0 ? result - : myAdapterFactoryLabelProvider.getText(element); - } - - /** - * @generated - */ - public void addListener(ILabelProviderListener listener) { - myWorkbenchLabelProvider.addListener(listener); - myAdapterFactoryLabelProvider.addListener(listener); - } - - /** - * @generated - */ - public void dispose() { - myWorkbenchLabelProvider.dispose(); - myAdapterFactoryLabelProvider.dispose(); - } - - /** - * @generated - */ - public boolean isLabelProperty(Object element, String property) { - return myWorkbenchLabelProvider.isLabelProperty(element, property) - || myAdapterFactoryLabelProvider.isLabelProperty(element, - property); - } - - /** - * @generated - */ - public void removeListener(ILabelProviderListener listener) { - myWorkbenchLabelProvider.removeListener(listener); - myAdapterFactoryLabelProvider.removeListener(listener); - } - - } - - /** - * @generated - */ - private class ModelFilesFilter extends ViewerFilter { - - /** - * @generated - */ - @Override - public boolean select(Viewer viewer, Object parentElement, - Object element) { - if (element instanceof IContainer) { - return true; - } - if (element instanceof IFile) { - IFile file = (IFile) element; - return isValidModelFile(file); - } - return true; - } - - } - - /** - * @generated - */ - private class OkButtonEnabler implements ISelectionChangedListener { - - /** - * @generated - */ - public void selectionChanged(SelectionChangedEvent event) { - if (event.getSelection() instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection) event - .getSelection(); - if (selection.size() == 1) { - Object selectedElement = selection.getFirstElement(); - if (selectedElement instanceof IWrapperItemProvider) { - selectedElement = ((IWrapperItemProvider) selectedElement) - .getValue(); - } - if (selectedElement instanceof FeatureMap.Entry) { - selectedElement = ((FeatureMap.Entry) selectedElement) - .getValue(); - } - if (selectedElement instanceof EObject) { - EObject selectedModelElement = (EObject) selectedElement; - setOkButtonEnabled(ViewService - .getInstance() - .provides( - Node.class, - new EObjectAdapter(selectedModelElement), - myView, - null, - ViewUtil.APPEND, - true, - UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT)); - mySelectedModelElementURI = EcoreUtil - .getURI(selectedModelElement); - return; - } - } - } - mySelectedModelElementURI = null; - setOkButtonEnabled(false); - } - - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLInitDiagramFileAction.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLInitDiagramFileAction.java deleted file mode 100644 index c91711a7faa..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLInitDiagramFileAction.java +++ /dev/null @@ -1,109 +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.part; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ -public class UMLInitDiagramFileAction implements IObjectActionDelegate { - - /** - * @generated - */ - private IWorkbenchPart targetPart; - - /** - * @generated - */ - private URI domainModelURI; - - /** - * @generated - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - this.targetPart = targetPart; - } - - /** - * @generated - */ - public void selectionChanged(IAction action, ISelection selection) { - domainModelURI = null; - action.setEnabled(false); - if (selection instanceof IStructuredSelection == false - || selection.isEmpty()) { - return; - } - IFile file = (IFile) ((IStructuredSelection) selection) - .getFirstElement(); - domainModelURI = URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); - action.setEnabled(true); - } - - /** - * @generated - */ - private Shell getShell() { - return targetPart.getSite().getShell(); - } - - /** - * @generated - */ - public void run(IAction action) { - TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE - .createEditingDomain(); - ResourceSet resourceSet = editingDomain.getResourceSet(); - EObject diagramRoot = null; - try { - Resource resource = resourceSet.getResource(domainModelURI, true); - diagramRoot = (EObject) resource.getContents().get(0); - } catch (WrappedException ex) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$ - } - if (diagramRoot == null) { - MessageDialog - .openError( - getShell(), - Messages.UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle, - Messages.UMLInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage); - return; - } - Wizard wizard = new UMLNewDiagramFileWizard(domainModelURI, - diagramRoot, editingDomain); - wizard.setWindowTitle(NLS.bind( - Messages.UMLInitDiagramFileAction_InitDiagramFileWizardTitle, - PackageEditPart.MODEL_ID)); - UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$ - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLLinkDescriptor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLLinkDescriptor.java deleted file mode 100644 index c91672a69e0..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLLinkDescriptor.java +++ /dev/null @@ -1,104 +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.part; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; - -/** - * @generated - */ -@SuppressWarnings("unchecked") -public class UMLLinkDescriptor extends UMLNodeDescriptor { - - /** - * @generated - */ - private EObject mySource; - - /** - * @generated - */ - private EObject myDestination; - - /** - * @generated - */ - private IAdaptable mySemanticAdapter; - - /** - * @generated - */ - private UMLLinkDescriptor(EObject source, EObject destination, - EObject linkElement, int linkVID) { - super(linkElement, linkVID); - mySource = source; - myDestination = destination; - } - - /** - * @generated - */ - public UMLLinkDescriptor(EObject source, EObject destination, - IElementType elementType, int linkVID) { - this(source, destination, (EObject) null, linkVID); - final IElementType elementTypeCopy = elementType; - mySemanticAdapter = new IAdaptable() { - public Object getAdapter(Class adapter) { - if (IElementType.class.equals(adapter)) { - return elementTypeCopy; - } - return null; - } - }; - } - - /** - * @generated - */ - public UMLLinkDescriptor(EObject source, EObject destination, - EObject linkElement, IElementType elementType, int linkVID) { - this(source, destination, linkElement, linkVID); - final IElementType elementTypeCopy = elementType; - mySemanticAdapter = new EObjectAdapter(linkElement) { - public Object getAdapter(Class adapter) { - if (IElementType.class.equals(adapter)) { - return elementTypeCopy; - } - return super.getAdapter(adapter); - } - }; - } - - /** - * @generated - */ - public EObject getSource() { - return mySource; - } - - /** - * @generated - */ - public EObject getDestination() { - return myDestination; - } - - /** - * @generated - */ - public IAdaptable getSemanticAdapter() { - return mySemanticAdapter; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLLoadResourceAction.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLLoadResourceAction.java deleted file mode 100644 index 29cadb90c65..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLLoadResourceAction.java +++ /dev/null @@ -1,77 +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.part; - -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ -public class UMLLoadResourceAction implements IObjectActionDelegate { - - /** - * @generated - */ - private PackageEditPart mySelectedElement; - - /** - * @generated - */ - private Shell myShell; - - /** - * @generated - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - myShell = targetPart.getSite().getShell(); - } - - /** - * @generated - */ - public void run(IAction action) { - LoadResourceAction.LoadResourceDialog loadResourceDialog = new LoadResourceAction.LoadResourceDialog( - myShell, mySelectedElement.getEditingDomain()); - loadResourceDialog.open(); - } - - /** - * @generated - */ - public void selectionChanged(IAction action, ISelection selection) { - mySelectedElement = null; - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - if (structuredSelection.size() == 1 - && structuredSelection.getFirstElement() instanceof PackageEditPart) { - mySelectedElement = (PackageEditPart) structuredSelection - .getFirstElement(); - } - } - action.setEnabled(isEnabled()); - } - - /** - * @generated - */ - private boolean isEnabled() { - return mySelectedElement != null; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLMatchingStrategy.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLMatchingStrategy.java deleted file mode 100644 index 371ab79cc04..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLMatchingStrategy.java +++ /dev/null @@ -1,75 +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.part; - -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorMatchingStrategy; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.PartInitException; - -import org.eclipse.papyrus.diagram.common.part.CachedResourcesDiagramEditor; -import org.eclipse.papyrus.diagram.common.part.CachedResourcesEditorInput; -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.util.URIUtil; - -/** - * @generated - */ -public class UMLMatchingStrategy implements IEditorMatchingStrategy { - - /** - * @generated - */ - public boolean matches(IEditorReference editorRef, IEditorInput newInput) { - IEditorInput oldInput; - try { - oldInput = editorRef.getEditorInput(); - } catch (PartInitException e) { - return false; - } - - boolean openInNewEditor = false; - - CachedResourcesEditorInput newCachedEditorInput = null; - if (newInput instanceof CachedResourcesEditorInput) { - newCachedEditorInput = (CachedResourcesEditorInput) newInput; - openInNewEditor = newCachedEditorInput.isOpenInNewEditor(); - } - - if (openInNewEditor) { - // we want to open in a new editor, alas if the IEditorInput is - // exactly the same (the same resource AND diagram) we can reuse - // this editor - if (CachedResourcesEditorInput.checkSameEditorInputWithFragment( - oldInput, newCachedEditorInput)) { - return true; - } - return false; - } - - // get real URIs for both the old input ant the new input - CachedResourcesDiagramEditor editor = MDTUtil - .getCachedResourcesDiagramEditorFromEditorRef(editorRef); - String editorID = editor != null ? editor.getEditorID() : null; - URI oldUri = URIUtil.getUri(oldInput, editorID); - URI newUri = URIUtil.getUri(newInput, editorID); - - if (oldUri != null && newUri != null) { - return oldUri.equals(newUri); - } - - return false; - - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLNewDiagramFileWizard.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLNewDiagramFileWizard.java deleted file mode 100644 index 88bb517afad..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLNewDiagramFileWizard.java +++ /dev/null @@ -1,242 +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.part; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.OperationHistoryFactory; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.papyrus.diagram.common.dialogs.SelectModelElementsForDiagramDialog; -import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ -public class UMLNewDiagramFileWizard extends Wizard { - - /** - * @generated - */ - private WizardNewFileCreationPage myFileCreationPage; - - /** - * @generated - */ - private ModelElementSelectionPage diagramRootElementSelectionPage; - - /** - * @generated - */ - private SelectModelElementsForDiagramDialog diagramElementsSelectionPage; - - /** - * @generated - */ - private TransactionalEditingDomain myEditingDomain; - - /** - * @generated - */ - public UMLNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, - TransactionalEditingDomain editingDomain) { - assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$ - assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$ - assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$ - - myFileCreationPage = new WizardNewFileCreationPage( - Messages.UMLNewDiagramFileWizard_CreationPageName, - StructuredSelection.EMPTY); - myFileCreationPage - .setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle); - myFileCreationPage.setDescription(NLS.bind( - Messages.UMLNewDiagramFileWizard_CreationPageDescription, - PackageEditPart.MODEL_ID)); - IPath filePath; - String fileName = domainModelURI.trimFileExtension().lastSegment(); - if (domainModelURI.isPlatformResource()) { - filePath = new Path(domainModelURI.trimSegments(1) - .toPlatformString(true)); - } else if (domainModelURI.isFile()) { - filePath = new Path(domainModelURI.trimSegments(1).toFileString()); - } else { - // TODO : use some default path - throw new IllegalArgumentException( - "Unsupported URI: " + domainModelURI); //$NON-NLS-1$ - } - myFileCreationPage.setContainerFullPath(filePath); - myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName( - filePath, fileName, "sequenceuml_diagram")); //$NON-NLS-1$ - - diagramRootElementSelectionPage = new DiagramRootElementSelectionPage( - Messages.UMLNewDiagramFileWizard_RootSelectionPageName); - diagramRootElementSelectionPage - .setTitle(Messages.UMLNewDiagramFileWizard_RootSelectionPageTitle); - diagramRootElementSelectionPage - .setDescription(Messages.UMLNewDiagramFileWizard_RootSelectionPageDescription); - diagramRootElementSelectionPage.setModelElement(diagramRoot); - - IBaseLabelProvider labelProvider = new AdapterFactoryLabelProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - IContentProvider contentProvider = new AdapterFactoryContentProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - diagramElementsSelectionPage = new SelectModelElementsForDiagramDialog( - diagramRootElementSelectionPage, contentProvider, labelProvider); - - myEditingDomain = editingDomain; - } - - /** - * @generated - */ - @Override - public void addPages() { - addPage(myFileCreationPage); - addPage(diagramRootElementSelectionPage); - addPage(diagramElementsSelectionPage); - } - - /** - * @generated - */ - @Override - public boolean performFinish() { - List affectedFiles = new LinkedList(); - IFile diagramFile = myFileCreationPage.createNewFile(); - UMLDiagramEditorUtil.setCharset(diagramFile); - affectedFiles.add(diagramFile); - URI diagramModelURI = URI.createPlatformResourceURI(diagramFile - .getFullPath().toString(), true); - ResourceSet resourceSet = myEditingDomain.getResourceSet(); - final Resource diagramResource = resourceSet - .createResource(diagramModelURI); - AbstractTransactionalCommand command = new AbstractTransactionalCommand( - myEditingDomain, - Messages.UMLNewDiagramFileWizard_InitDiagramCommand, - affectedFiles) { - - protected CommandResult doExecuteWithResult( - IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - int diagramVID = UMLVisualIDRegistry - .getDiagramVisualID(diagramRootElementSelectionPage - .getModelElement()); - if (diagramVID != PackageEditPart.VISUAL_ID) { - return CommandResult - .newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError); - } - Diagram diagram = ViewService.createDiagram( - diagramRootElementSelectionPage.getModelElement(), - PackageEditPart.MODEL_ID, - UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); - diagramResource.getContents().add(diagram); - addReferencedEObjectsToDiagram(diagram); - return CommandResult.newOKCommandResult(); - } - - private void addReferencedEObjectsToDiagram(Diagram diagram) { - for (EObject eObject : diagramElementsSelectionPage - .getSelectedEObjects()) { - MultiDiagramUtil.AddEAnnotationReferenceToDiagram( - diagram, eObject); - } - } - }; - try { - OperationHistoryFactory.getOperationHistory().execute(command, - new NullProgressMonitor(), null); - diagramResource.save(UMLDiagramEditorUtil.getSaveOptions()); - UMLDiagramEditorUtil.openDiagram(diagramResource); - } catch (ExecutionException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to create model and diagram", e); //$NON-NLS-1$ - } catch (IOException ex) { - UMLDiagramEditorPlugin.getInstance().logError( - "Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$ - } catch (PartInitException ex) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to open editor", ex); //$NON-NLS-1$ - } - return true; - } - - /** - * @generated - */ - private static class DiagramRootElementSelectionPage extends - ModelElementSelectionPage { - - /** - * @generated - */ - protected DiagramRootElementSelectionPage(String pageName) { - super(pageName); - } - - /** - * @generated - */ - @Override - protected String getSelectionTitle() { - return Messages.UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle; - } - - /** - * @generated - */ - @Override - protected boolean validatePage() { - if (selectedModelElement == null) { - setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage); - return false; - } - boolean result = ViewService.getInstance().provides( - new CreateDiagramViewOperation(new EObjectAdapter( - selectedModelElement), PackageEditPart.MODEL_ID, - UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT)); - setErrorMessage(result ? null - : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage); - return result; - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLNodeDescriptor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLNodeDescriptor.java deleted file mode 100644 index efb72ef2c57..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLNodeDescriptor.java +++ /dev/null @@ -1,68 +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.part; - -import org.eclipse.emf.ecore.EObject; - -/** - * @generated - */ -@SuppressWarnings("unchecked") -public class UMLNodeDescriptor { - - /** - * @generated - */ - private EObject myModelElement; - - /** - * @generated - */ - private int myVisualID; - - /** - * @generated - */ - private String myType; - - /** - * @generated - */ - public UMLNodeDescriptor(EObject modelElement, int visualID) { - myModelElement = modelElement; - myVisualID = visualID; - } - - /** - * @generated - */ - public EObject getModelElement() { - return myModelElement; - } - - /** - * @generated - */ - public int getVisualID() { - return myVisualID; - } - - /** - * @generated - */ - public String getType() { - if (myType == null) { - myType = UMLVisualIDRegistry.getType(getVisualID()); - } - return myType; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLPaletteFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLPaletteFactory.java deleted file mode 100644 index f6ceab469db..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLPaletteFactory.java +++ /dev/null @@ -1,336 +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.part; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gef.Tool; -import org.eclipse.gef.palette.PaletteContainer; -import org.eclipse.gef.palette.PaletteDrawer; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.palette.PaletteSeparator; -import org.eclipse.gef.palette.ToolEntry; -import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool; -import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool; - -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ -public class UMLPaletteFactory { - - /** - * @generated - */ - public void fillPalette(PaletteRoot paletteRoot) { - paletteRoot.add(createInteraction1Group()); - paletteRoot.add(createObjects2Group()); - paletteRoot.add(createMessages3Group()); - paletteRoot.add(createComments4Group()); - } - - /** - * Creates "Interaction" palette tool group - * @generated - */ - private PaletteContainer createInteraction1Group() { - PaletteDrawer paletteContainer = new PaletteDrawer( - Messages.Interaction1Group_title); - paletteContainer.setDescription(Messages.Interaction1Group_desc); - paletteContainer.add(createInteraction1CreationTool()); - return paletteContainer; - } - - /** - * Creates "Objects" palette tool group - * @generated - */ - private PaletteContainer createObjects2Group() { - PaletteDrawer paletteContainer = new PaletteDrawer( - Messages.Objects2Group_title); - paletteContainer.setDescription(Messages.Objects2Group_desc); - paletteContainer.add(createLifeline1CreationTool()); - paletteContainer.add(createExecutionBehaviour2CreationTool()); - paletteContainer.add(createCombinedFragment3CreationTool()); - return paletteContainer; - } - - /** - * Creates "Messages" palette tool group - * @generated - */ - private PaletteContainer createMessages3Group() { - PaletteDrawer paletteContainer = new PaletteDrawer( - Messages.Messages3Group_title); - paletteContainer.add(createCallsynch1CreationTool()); - paletteContainer.add(createCallasynch2CreationTool()); - paletteContainer.add(createReply3CreationTool()); - paletteContainer.add(new PaletteSeparator()); - paletteContainer.add(createSendSignal5CreationTool()); - paletteContainer.add(createCreationEvent6CreationTool()); - paletteContainer.add(createDestructionEvent7CreationTool()); - return paletteContainer; - } - - /** - * Creates "Comments" palette tool group - * @generated - */ - private PaletteContainer createComments4Group() { - PaletteDrawer paletteContainer = new PaletteDrawer( - Messages.Comments4Group_title); - paletteContainer.add(createComment1CreationTool()); - paletteContainer.add(createCommentLink2CreationTool()); - return paletteContainer; - } - - /** - * @generated - */ - private ToolEntry createInteraction1CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2); - types.add(UMLElementTypes.Interaction_1001); - types.add(UMLElementTypes.Interaction_2001); - NodeToolEntry entry = new NodeToolEntry( - Messages.Interaction1CreationTool_title, - Messages.Interaction1CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Interaction_1001)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createLifeline1CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Lifeline_2002); - NodeToolEntry entry = new NodeToolEntry( - Messages.Lifeline1CreationTool_title, - Messages.Lifeline1CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Lifeline_2002)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createExecutionBehaviour2CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.BehaviorExecutionSpecification_2003); - NodeToolEntry entry = new NodeToolEntry( - Messages.ExecutionBehaviour2CreationTool_title, - Messages.ExecutionBehaviour2CreationTool_desc, types); - entry - .setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.BehaviorExecutionSpecification_2003)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createCombinedFragment3CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.CombinedFragment_2004); - NodeToolEntry entry = new NodeToolEntry( - Messages.CombinedFragment3CreationTool_title, - Messages.CombinedFragment3CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.CombinedFragment_2004)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createCallsynch1CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Message_3001); - LinkToolEntry entry = new LinkToolEntry( - Messages.Callsynch1CreationTool_title, - Messages.Callsynch1CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Message_3001)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createCallasynch2CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Message_3002); - LinkToolEntry entry = new LinkToolEntry( - Messages.Callasynch2CreationTool_title, - Messages.Callasynch2CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Message_3002)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createReply3CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Message_3003); - LinkToolEntry entry = new LinkToolEntry( - Messages.Reply3CreationTool_title, - Messages.Reply3CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Message_3003)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createSendSignal5CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Message_3004); - LinkToolEntry entry = new LinkToolEntry( - Messages.SendSignal5CreationTool_title, null, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Message_3004)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createCreationEvent6CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Message_3005); - LinkToolEntry entry = new LinkToolEntry( - Messages.CreationEvent6CreationTool_title, null, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Message_3005)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createDestructionEvent7CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Message_3006); - LinkToolEntry entry = new LinkToolEntry( - Messages.DestructionEvent7CreationTool_title, null, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Message_3006)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createComment1CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); - types.add(UMLElementTypes.Comment_2005); - NodeToolEntry entry = new NodeToolEntry( - Messages.Comment1CreationTool_title, - Messages.Comment1CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.Comment_2005)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private ToolEntry createCommentLink2CreationTool() { - List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(2); - types.add(UMLElementTypes.ElementOwnedComment_3007); - types.add(UMLElementTypes.CommentAnnotatedElement_3008); - LinkToolEntry entry = new LinkToolEntry( - Messages.CommentLink2CreationTool_title, - Messages.CommentLink2CreationTool_desc, types); - entry.setSmallIcon(UMLElementTypes - .getImageDescriptor(UMLElementTypes.ElementOwnedComment_3007)); - entry.setLargeIcon(entry.getSmallIcon()); - return entry; - } - - /** - * @generated - */ - private static class NodeToolEntry extends ToolEntry { - - /** - * @generated - */ - private final List elementTypes; - - /** - * @generated - */ - private NodeToolEntry(String title, String description, - List elementTypes) { - super(title, description, null, null); - this.elementTypes = elementTypes; - } - - /** - * @generated - */ - @Override - public Tool createTool() { - Tool tool = new UnspecifiedTypeCreationTool(elementTypes); - tool.setProperties(getToolProperties()); - return tool; - } - } - - /** - * @generated - */ - private static class LinkToolEntry extends ToolEntry { - - /** - * @generated - */ - private final List relationshipTypes; - - /** - * @generated - */ - private LinkToolEntry(String title, String description, - List relationshipTypes) { - super(title, description, null, null); - this.relationshipTypes = relationshipTypes; - } - - /** - * @generated - */ - @Override - public Tool createTool() { - Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes); - tool.setProperties(getToolProperties()); - return tool; - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLSequenceDiagramForMultiEditor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLSequenceDiagramForMultiEditor.java deleted file mode 100644 index 6f76e1480b5..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLSequenceDiagramForMultiEditor.java +++ /dev/null @@ -1,246 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2008 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: Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation
- *
- ******************************************************************************/
-package org.eclipse.papyrus.diagram.sequence.part;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.l10n.EditorMessages;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorContext;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContext;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContextRegistry;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PartInitException;
-
-/**
- * The Class UMLSequenceDiagramForMultiEditor.
- */
-public class UMLSequenceDiagramForMultiEditor extends UMLDiagramEditor {
-
- /** The diagram. */
- private Diagram diagram = null;
-
- /** The context. */
- private GmfEditorContext context = null;
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/SequenceDiagram.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UMLSequenceDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- * @generated NOT
- */
- public UMLSequenceDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super();
- this.diagram = diagram;
-// ServicesRegistry servicesRegistry = EditorUtils.getServiceRegistry();
- IEditorContextRegistry contextRegistry;
- contextRegistry = (IEditorContextRegistry) servicesRegistry.getService(IEditorContextRegistry.class);
-
- // Get the context by its ID
- this.context = (GmfEditorContext) contextRegistry.getContext(GmfEditorContext.GMF_CONTEXT_ID);
-
- // overrides editing domain created by super constructor
-
- setDocumentProvider(context.getDocumentProvider());
- System.err.println(this.getClass().getName());
- }
-
- /**
- * Instantiates a new uML sequence diagram for multi editor.
- *
- * @param diagram
- * the diagram
- * @param context
- * the context
- */
- public UMLSequenceDiagramForMultiEditor(Object diagram, IEditorContext context) {
- this((Diagram) diagram, (GmfEditorContext) context);
- }
-
- /**
- * Instantiates a new uML sequence diagram for multi editor.
- *
- * @param diagram
- * the diagram
- * @param context
- * the context
- */
- public UMLSequenceDiagramForMultiEditor(Diagram diagram, GmfEditorContext context) {
- super();
- this.diagram = diagram;
- this.context = context;
- setDocumentProvider(context.getDocumentProvider());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Diagram getDiagram() {
- return diagram;
- }
-
- /**
- * Sets the diagram.
- *
- * @param diagram
- * the new diagram
- */
- public void setDiagram(Diagram diagram) {
- this.diagram = diagram;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- final protected IDocumentProvider getDocumentProvider(IEditorInput input) {
- if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
- return context.getDocumentProvider();
- }
- return super.getDocumentProvider(input);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setDocumentProvider(IEditorInput input) {
- if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
- setDocumentProvider(context.getDocumentProvider());
- } else {
- super.setDocumentProvider(input);
- }
- }
-
- /**
- * Configures the diagram with the parent Multi editor shared command stack
- */
- @Override
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- DiagramEditDomain editDomain = (DiagramEditDomain) getDiagramEditDomain();
-
- if (editDomain != null) {
- editDomain.setCommandStack(context.getDiagramEditDomain().getDiagramCommandStack());
- editDomain.setActionManager(editDomain.getActionManager());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // We are in a nested editor.
- // Provide an URI with fragment in order to reuse the same Resource
- // and to
- // set the diagram to the fragment.
- // First, compute the URI
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(diagram));
- System.err.println(this.getClass().getSimpleName() + ".setInput(" + uriInput.toString() + ")");
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = EditorMessages.Editor_error_setinput_title;
- String msg = EditorMessages.Editor_error_setinput_message;
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
-
- }
-
- /**
- * Gets the shared objects.
- *
- * @return the shared objects
- */
- public GmfEditorContext getSharedObjects() {
- return context;
- }
-
- /**
- * Sets the shared object.
- *
- * @param parentEditor
- * the new shared object
- */
- public void setSharedObject(GmfEditorContext parentEditor) {
- this.context = parentEditor;
- }
-
- /** The splitter. */
- Composite splitter;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- System.out.println("store Composite " + parent);
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLShortcutPropertyTester.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLShortcutPropertyTester.java deleted file mode 100644 index e37113bfa5b..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLShortcutPropertyTester.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.part; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; - -/** - * @generated - */ - -public class UMLShortcutPropertyTester extends PropertyTester { - - /** - * @generated - */ - protected static final String SHORTCUT_PROPERTY = "isShortcut"; //$NON-NLS-1$ - - /** - * @generated - */ - public boolean test(Object receiver, String method, Object[] args, - Object expectedValue) { - if (false == receiver instanceof View) { - return false; - } - View view = (View) receiver; - if (SHORTCUT_PROPERTY.equals(method)) { - EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if (annotation != null) { - return PackageEditPart.MODEL_ID.equals(annotation.getDetails() - .get("modelID")); //$NON-NLS-1$ - } - } - return false; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLUriEditorInputTester.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLUriEditorInputTester.java deleted file mode 100644 index 82aab8e1c08..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLUriEditorInputTester.java +++ /dev/null @@ -1,34 +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.part; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.emf.common.ui.URIEditorInput; - -/** - * @generated - */ -public class UMLUriEditorInputTester extends PropertyTester { - - /** - * @generated - */ - public boolean test(Object receiver, String method, Object[] args, - Object expectedValue) { - if (false == receiver instanceof URIEditorInput) { - return false; - } - URIEditorInput editorInput = (URIEditorInput) receiver; - return "sequenceuml_diagram".equals(editorInput.getURI().fileExtension())//$NON-NLS-1$ - ; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLVisualIDRegistry.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLVisualIDRegistry.java deleted file mode 100644 index 3c2b434768f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLVisualIDRegistry.java +++ /dev/null @@ -1,617 +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.part; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.providers.ViewInfo; -import org.eclipse.papyrus.diagram.common.providers.ViewInfoRegistry; -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentInteractionOperatorEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentBodyEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.expressions.UMLAbstractExpression; -import org.eclipse.papyrus.diagram.sequence.expressions.UMLOCLFactory; - -/** - * This registry is used to determine which type of visual object should be - * created for the corresponding Diagram, Node, ChildNode or Link represented - * by a domain model object. - * - * @generated - */ -public class UMLVisualIDRegistry { - - /** - * @generated - */ - private static final String DEBUG_KEY = "org.eclipse.papyrus.diagram.sequence/debug/visualID"; //$NON-NLS-1$ - - /** - * @generated - */ - private static UMLAbstractExpression Message_3001_Constraint; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3002_Constraint; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3003_Constraint; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3004_Constraint; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3005_Constraint; - - /** - * @generated - */ - private static UMLAbstractExpression Message_3006_Constraint; - - /** - * @generated - */ - public static int getVisualID(View view) { - if (view instanceof Diagram) { - if (PackageEditPart.MODEL_ID.equals(view.getType())) { - return PackageEditPart.VISUAL_ID; - } else { - return -1; - } - } - return org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry - .getVisualID(view.getType()); - } - - /** - * @generated - */ - public static String getModelID(View view) { - View diagram = view.getDiagram(); - while (view != diagram) { - EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if (annotation != null) { - return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$ - } - view = (View) view.eContainer(); - } - return diagram != null ? diagram.getType() : null; - } - - /** - * @generated - */ - public static int getVisualID(String type) { - try { - return Integer.parseInt(type); - } catch (NumberFormatException e) { - if (Boolean.TRUE.toString().equalsIgnoreCase( - Platform.getDebugOption(DEBUG_KEY))) { - UMLDiagramEditorPlugin.getInstance().logError( - "Unable to parse view type as a visualID number: " - + type); - } - } - return -1; - } - - /** - * @generated - */ - public static String getType(int visualID) { - return String.valueOf(visualID); - } - - /** - * @generated - */ - public static int getDiagramVisualID(EObject domainElement) { - if (domainElement == null) { - return -1; - } - if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf( - domainElement.eClass()) - && isDiagram((Package) domainElement)) { - return PackageEditPart.VISUAL_ID; - } - - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass()) - && isDiagram((Interaction) domainElement)) { - return PackageEditPart.VISUAL_ID; - } - - return -1; - } - - /** - * @generated - */ - public static int getNodeVisualID(View containerView, EObject domainElement) { - if (domainElement == null) { - return -1; - } - String containerModelID = org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry - .getModelID(containerView); - if (!PackageEditPart.MODEL_ID.equals(containerModelID) - && !"UMLSequence".equals(containerModelID)) { //$NON-NLS-1$ - return -1; - } - int containerVisualID; - if (PackageEditPart.MODEL_ID.equals(containerModelID)) { - containerVisualID = org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry - .getVisualID(containerView); - } else { - if (containerView instanceof Diagram) { - containerVisualID = PackageEditPart.VISUAL_ID; - } else { - return -1; - } - } - switch (containerVisualID) { - case LifelineEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getBehaviorExecutionSpecification() - .isSuperTypeOf(domainElement.eClass())) { - return BehaviorExecutionSpecificationEditPart.VISUAL_ID; - } - break; - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return Interaction2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf( - domainElement.eClass())) { - return LifelineEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getCombinedFragment().isSuperTypeOf( - domainElement.eClass())) { - return CombinedFragmentEditPart.VISUAL_ID; - } - break; - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return Interaction2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf( - domainElement.eClass())) { - return LifelineEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getCombinedFragment().isSuperTypeOf( - domainElement.eClass())) { - return CombinedFragmentEditPart.VISUAL_ID; - } - break; - case PackageEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return InteractionEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf( - domainElement.eClass())) { - return CommentEditPart.VISUAL_ID; - } - break; - } - return -1; - } - - /** - * @generated - */ - public static boolean canCreateNode(View containerView, int nodeVisualID) { - String containerModelID = org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry - .getModelID(containerView); - if (!PackageEditPart.MODEL_ID.equals(containerModelID) - && !"UMLSequence".equals(containerModelID)) { //$NON-NLS-1$ - return false; - } - int containerVisualID; - if (PackageEditPart.MODEL_ID.equals(containerModelID)) { - containerVisualID = org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry - .getVisualID(containerView); - } else { - if (containerView instanceof Diagram) { - containerVisualID = PackageEditPart.VISUAL_ID; - } else { - return false; - } - } - switch (containerVisualID) { - case InteractionEditPart.VISUAL_ID: - if (InteractionNameEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (InteractionInteractionCompartmentEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case CommentEditPart.VISUAL_ID: - if (CommentBodyEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case Interaction2EditPart.VISUAL_ID: - if (InteractionName2EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (InteractionInteractionCompartment2EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case LifelineEditPart.VISUAL_ID: - if (LifelineNameEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (BehaviorExecutionSpecificationEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case CombinedFragmentEditPart.VISUAL_ID: - if (CombinedFragmentInteractionOperatorEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - if (Interaction2EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (LifelineEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (CombinedFragmentEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - if (Interaction2EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (LifelineEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (CombinedFragmentEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case PackageEditPart.VISUAL_ID: - if (InteractionEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - if (CommentEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case MessageEditPart.VISUAL_ID: - if (MessageNameEditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case Message2EditPart.VISUAL_ID: - if (MessageName2EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case Message3EditPart.VISUAL_ID: - if (MessageName3EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case Message4EditPart.VISUAL_ID: - if (MessageName4EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case Message5EditPart.VISUAL_ID: - if (MessageName5EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - case Message6EditPart.VISUAL_ID: - if (MessageName6EditPart.VISUAL_ID == nodeVisualID) { - return true; - } - break; - } - return false; - } - - /** - * @generated - */ - public static int getLinkWithClassVisualID(EObject domainElement) { - if (domainElement == null) { - return -1; - } - if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf( - domainElement.eClass()) - && isMessage_3001((Message) domainElement)) { - return MessageEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf( - domainElement.eClass()) - && isMessage_3002((Message) domainElement)) { - return Message2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf( - domainElement.eClass()) - && isMessage_3003((Message) domainElement)) { - return Message3EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf( - domainElement.eClass()) - && isMessage_3004((Message) domainElement)) { - return Message4EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf( - domainElement.eClass()) - && isMessage_3005((Message) domainElement)) { - return Message5EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf( - domainElement.eClass()) - && isMessage_3006((Message) domainElement)) { - return Message6EditPart.VISUAL_ID; - } - return -1; - } - - /** - * User can change implementation of this method to handle some specific - * situations not covered by default logic. - * - * @generated - */ - private static boolean isDiagram(Package element) { - return true; - } - - /** - * @generated - */ - private static boolean isDiagram(Interaction element) { - return true; - } - - /** - * @generated - */ - private static boolean isMessage_3001(Message domainElement) { - if (Message_3001_Constraint == null) { // lazy initialization - Message_3001_Constraint = UMLOCLFactory - .getExpression( - "self.messageSort=MessageSort::synchCall", UMLPackage.eINSTANCE.getMessage()); //$NON-NLS-1$ - } - Object result = Message_3001_Constraint.evaluate(domainElement); - return result instanceof Boolean && ((Boolean) result).booleanValue(); - } - - /** - * @generated - */ - private static boolean isMessage_3002(Message domainElement) { - if (Message_3002_Constraint == null) { // lazy initialization - Message_3002_Constraint = UMLOCLFactory - .getExpression( - "self.messageSort=MessageSort::asynchCall", UMLPackage.eINSTANCE.getMessage()); //$NON-NLS-1$ - } - Object result = Message_3002_Constraint.evaluate(domainElement); - return result instanceof Boolean && ((Boolean) result).booleanValue(); - } - - /** - * @generated - */ - private static boolean isMessage_3003(Message domainElement) { - if (Message_3003_Constraint == null) { // lazy initialization - Message_3003_Constraint = UMLOCLFactory - .getExpression( - "self.messageSort=MessageSort::reply", UMLPackage.eINSTANCE.getMessage()); //$NON-NLS-1$ - } - Object result = Message_3003_Constraint.evaluate(domainElement); - return result instanceof Boolean && ((Boolean) result).booleanValue(); - } - - /** - * @generated - */ - private static boolean isMessage_3004(Message domainElement) { - if (Message_3004_Constraint == null) { // lazy initialization - Message_3004_Constraint = UMLOCLFactory - .getExpression( - "self.messageSort=MessageSort::asynchSignal", UMLPackage.eINSTANCE.getMessage()); //$NON-NLS-1$ - } - Object result = Message_3004_Constraint.evaluate(domainElement); - return result instanceof Boolean && ((Boolean) result).booleanValue(); - } - - /** - * @generated - */ - private static boolean isMessage_3005(Message domainElement) { - if (Message_3005_Constraint == null) { // lazy initialization - Message_3005_Constraint = UMLOCLFactory - .getExpression( - "self.messageSort=MessageSort::createMessage", UMLPackage.eINSTANCE.getMessage()); //$NON-NLS-1$ - } - Object result = Message_3005_Constraint.evaluate(domainElement); - return result instanceof Boolean && ((Boolean) result).booleanValue(); - } - - /** - * @generated - */ - private static boolean isMessage_3006(Message domainElement) { - if (Message_3006_Constraint == null) { // lazy initialization - Message_3006_Constraint = UMLOCLFactory - .getExpression( - "self.messageSort=MessageSort::deleteMessage", UMLPackage.eINSTANCE.getMessage()); //$NON-NLS-1$ - } - Object result = Message_3006_Constraint.evaluate(domainElement); - return result instanceof Boolean && ((Boolean) result).booleanValue(); - } - - /** - * @generated - */ - protected static boolean hasViewChild(View containerView, - EObject domainElement, int visualId) { - if (domainElement == null) { - return false; - } - for (Object next : containerView.getChildren()) { - View nextView = (View) next; - if (domainElement.equals(nextView.getElement()) - && getType(visualId).equals(nextView.getType())) { - return true; - } - } - return false; - } - - /** - * @generated - */ - public static int getChildDescriptorVisualID(UMLNodeDescriptor container, - EObject domainElement) { - if (domainElement == null) { - return -1; - } - switch (container.getVisualID()) { - case InteractionEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return Interaction2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf( - domainElement.eClass())) { - return LifelineEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getCombinedFragment().isSuperTypeOf( - domainElement.eClass())) { - return CombinedFragmentEditPart.VISUAL_ID; - } - break; - case Interaction2EditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return Interaction2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf( - domainElement.eClass())) { - return LifelineEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getCombinedFragment().isSuperTypeOf( - domainElement.eClass())) { - return CombinedFragmentEditPart.VISUAL_ID; - } - break; - case LifelineEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getBehaviorExecutionSpecification() - .isSuperTypeOf(domainElement.eClass())) { - return BehaviorExecutionSpecificationEditPart.VISUAL_ID; - } - break; - case PackageEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return InteractionEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf( - domainElement.eClass())) { - return CommentEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return Interaction2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf( - domainElement.eClass())) { - return LifelineEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getCombinedFragment().isSuperTypeOf( - domainElement.eClass())) { - return CombinedFragmentEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf( - domainElement.eClass())) { - return Interaction2EditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf( - domainElement.eClass())) { - return LifelineEditPart.VISUAL_ID; - } - if (UMLPackage.eINSTANCE.getCombinedFragment().isSuperTypeOf( - domainElement.eClass())) { - return CombinedFragmentEditPart.VISUAL_ID; - } - break; - } - return -1; - } - - /** - * @generated - */ - private static ViewInfo diagramViewInfo = null; - - /** - * @generated - */ - public static ViewInfo getDiagramViewInfo() { - if (diagramViewInfo == null) { - diagramViewInfo = ViewInfoRegistry.getInstance() - .getHeadViewInfoForEditor(UMLDiagramEditor.ID); - } - return diagramViewInfo; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/ValidateAction.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/ValidateAction.java deleted file mode 100644 index 492791d06f3..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/ValidateAction.java +++ /dev/null @@ -1,303 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.part; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.Diagnostician; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.emf.validation.model.EvaluationMode; -import org.eclipse.emf.validation.model.IConstraintStatus; -import org.eclipse.emf.validation.service.IBatchValidator; -import org.eclipse.emf.validation.service.ModelValidationService; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; -import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; - -import org.eclipse.papyrus.diagram.sequence.providers.UMLMarkerNavigationProvider; -import org.eclipse.papyrus.diagram.sequence.providers.UMLValidationProvider; - -/** - * @generated - */ - -public class ValidateAction extends Action { - - /** - * @generated - */ - public static final String VALIDATE_ACTION_KEY = "validateAction"; //$NON-NLS-1$ - - /** - * @generated - */ - private IWorkbenchPartDescriptor workbenchPartDescriptor; - - /** - * @generated - */ - public ValidateAction(IWorkbenchPartDescriptor workbenchPartDescriptor) { - setId(VALIDATE_ACTION_KEY); - setText(Messages.ValidateActionMessage); - this.workbenchPartDescriptor = workbenchPartDescriptor; - } - - /** - * @generated - */ - public void run() { - IWorkbenchPart workbenchPart = workbenchPartDescriptor.getPartPage() - .getActivePart(); - if (workbenchPart instanceof IDiagramWorkbenchPart) { - final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart; - try { - new WorkspaceModifyDelegatingOperation( - new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) - throws InterruptedException, - InvocationTargetException { - runValidation(part.getDiagramEditPart(), part - .getDiagram()); - } - }).run(new NullProgressMonitor()); - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Validation action failed", e); //$NON-NLS-1$ - } - } - } - - /** - * @generated - */ - public static void runValidation(View view) { - try { - if (UMLDiagramEditorUtil.openDiagram(view.eResource())) { - IEditorPart editorPart = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage() - .getActiveEditor(); - if (editorPart instanceof IDiagramWorkbenchPart) { - runValidation(((IDiagramWorkbenchPart) editorPart) - .getDiagramEditPart(), view); - } else { - runNonUIValidation(view); - } - } - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Validation action failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void runNonUIValidation(View view) { - DiagramEditPart diagramEditPart = OffscreenEditPartFactory - .getInstance().createDiagramEditPart(view.getDiagram()); - runValidation(diagramEditPart, view); - } - - /** - * @generated - */ - public static void runValidation(DiagramEditPart diagramEditPart, View view) { - final DiagramEditPart fpart = diagramEditPart; - final View fview = view; - TransactionalEditingDomain txDomain = TransactionUtil - .getEditingDomain(view); - UMLValidationProvider.runWithConstraints(txDomain, new Runnable() { - - public void run() { - validate(fpart, fview); - } - }); - } - - /** - * @generated - */ - private static Diagnostic runEMFValidator(View target) { - if (target.isSetElement() && target.getElement() != null) { - return new Diagnostician() { - - public String getObjectLabel(EObject eObject) { - return EMFCoreUtil.getQualifiedName(eObject, true); - } - }.validate(target.getElement()); - } - return Diagnostic.OK_INSTANCE; - } - - /** - * @generated - */ - private static void validate(DiagramEditPart diagramEditPart, View view) { - IFile target = view.eResource() != null ? WorkspaceSynchronizer - .getFile(view.eResource()) : null; - if (target != null) { - UMLMarkerNavigationProvider.deleteMarkers(target); - } - Diagnostic diagnostic = runEMFValidator(view); - createMarkers(target, diagnostic, diagramEditPart); - IBatchValidator validator = (IBatchValidator) ModelValidationService - .getInstance().newValidator(EvaluationMode.BATCH); - validator.setIncludeLiveConstraints(true); - if (view.isSetElement() && view.getElement() != null) { - IStatus status = validator.validate(view.getElement()); - createMarkers(target, status, diagramEditPart); - } - } - - /** - * @generated - */ - private static void createMarkers(IFile target, IStatus validationStatus, - DiagramEditPart diagramEditPart) { - if (validationStatus.isOK()) { - return; - } - final IStatus rootStatus = validationStatus; - List allStatuses = new ArrayList(); - UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap( - diagramEditPart.getDiagramView(), collectTargetElements( - rootStatus, new HashSet(), allStatuses)); - for (Iterator it = allStatuses.iterator(); it.hasNext();) { - IConstraintStatus nextStatus = (IConstraintStatus) it.next(); - View view = UMLDiagramEditorUtil.findView(diagramEditPart, - nextStatus.getTarget(), element2ViewMap); - addMarker(diagramEditPart.getViewer(), target, view.eResource() - .getURIFragment(view), EMFCoreUtil.getQualifiedName( - nextStatus.getTarget(), true), nextStatus.getMessage(), - nextStatus.getSeverity()); - } - } - - /** - * @generated - */ - private static void createMarkers(IFile target, - Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) { - if (emfValidationStatus.getSeverity() == Diagnostic.OK) { - return; - } - final Diagnostic rootStatus = emfValidationStatus; - List allDiagnostics = new ArrayList(); - UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap( - diagramEditPart.getDiagramView(), collectTargetElements( - rootStatus, new HashSet(), allDiagnostics)); - for (Iterator it = emfValidationStatus.getChildren().iterator(); it - .hasNext();) { - Diagnostic nextDiagnostic = (Diagnostic) it.next(); - List data = nextDiagnostic.getData(); - if (data != null && !data.isEmpty() - && data.get(0) instanceof EObject) { - EObject element = (EObject) data.get(0); - View view = UMLDiagramEditorUtil.findView(diagramEditPart, - element, element2ViewMap); - addMarker( - diagramEditPart.getViewer(), - target, - view.eResource().getURIFragment(view), - EMFCoreUtil.getQualifiedName(element, true), - nextDiagnostic.getMessage(), - diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); - } - } - } - - /** - * @generated - */ - private static void addMarker(EditPartViewer viewer, IFile target, - String elementId, String location, String message, - int statusSeverity) { - if (target == null) { - return; - } - UMLMarkerNavigationProvider.addMarker(target, elementId, location, - message, statusSeverity); - } - - /** - * @generated - */ - private static int diagnosticToStatusSeverity(int diagnosticSeverity) { - if (diagnosticSeverity == Diagnostic.OK) { - return IStatus.OK; - } else if (diagnosticSeverity == Diagnostic.INFO) { - return IStatus.INFO; - } else if (diagnosticSeverity == Diagnostic.WARNING) { - return IStatus.WARNING; - } else if (diagnosticSeverity == Diagnostic.ERROR - || diagnosticSeverity == Diagnostic.CANCEL) { - return IStatus.ERROR; - } - return IStatus.INFO; - } - - /** - * @generated - */ - private static Set collectTargetElements(IStatus status, - Set targetElementCollector, List allConstraintStatuses) { - if (status instanceof IConstraintStatus) { - targetElementCollector - .add(((IConstraintStatus) status).getTarget()); - allConstraintStatuses.add(status); - } - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - collectTargetElements(children[i], targetElementCollector, - allConstraintStatuses); - } - } - return targetElementCollector; - } - - /** - * @generated - */ - private static Set collectTargetElements(Diagnostic diagnostic, - Set targetElementCollector, List allDiagnostics) { - List data = diagnostic.getData(); - EObject target = null; - if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { - target = (EObject) data.get(0); - targetElementCollector.add(target); - allDiagnostics.add(diagnostic); - } - if (diagnostic.getChildren() != null - && !diagnostic.getChildren().isEmpty()) { - for (Iterator it = diagnostic.getChildren().iterator(); it - .hasNext();) { - collectTargetElements((Diagnostic) it.next(), - targetElementCollector, allDiagnostics); - } - } - return targetElementCollector; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramAppearancePreferencePage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramAppearancePreferencePage.java deleted file mode 100644 index 1f4bf8ac724..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramAppearancePreferencePage.java +++ /dev/null @@ -1,29 +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.preferences; - -import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class DiagramAppearancePreferencePage extends AppearancePreferencePage { - - /** - * @generated - */ - public DiagramAppearancePreferencePage() { - setPreferenceStore(UMLDiagramEditorPlugin.getInstance() - .getPreferenceStore()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramConnectionsPreferencePage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramConnectionsPreferencePage.java deleted file mode 100644 index 24c12f94cdf..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramConnectionsPreferencePage.java +++ /dev/null @@ -1,29 +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.preferences; - -import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage { - - /** - * @generated - */ - public DiagramConnectionsPreferencePage() { - setPreferenceStore(UMLDiagramEditorPlugin.getInstance() - .getPreferenceStore()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramGeneralPreferencePage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramGeneralPreferencePage.java deleted file mode 100644 index 0ff98d8f525..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramGeneralPreferencePage.java +++ /dev/null @@ -1,29 +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.preferences; - -import org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class DiagramGeneralPreferencePage extends DiagramsPreferencePage { - - /** - * @generated - */ - public DiagramGeneralPreferencePage() { - setPreferenceStore(UMLDiagramEditorPlugin.getInstance() - .getPreferenceStore()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramIconStylePreferencePage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramIconStylePreferencePage.java deleted file mode 100644 index 313395e3ee8..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramIconStylePreferencePage.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.preferences; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IWorkbench; - -import org.eclipse.papyrus.diagram.common.preferences.IconStylePreferencePage; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditor; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.providers.UMLElementTypes; - -/** - * @generated - */ - -public class DiagramIconStylePreferencePage extends IconStylePreferencePage { - /** - * @generated - */ - private IWorkbench myWorkbench; - - /** - * @generated - */ - public DiagramIconStylePreferencePage() { - setPreferenceStore(UMLDiagramEditorPlugin.getInstance() - .getPreferenceStore()); - } - - /** - * @generated - */ - @Override - public void init(IWorkbench workbench) { - super.init(workbench); - myWorkbench = workbench; - } - - /** - * @generated - */ - @Override - public boolean performOk() { - super.performOk(); - UMLElementTypes.refreshImageRegistry(); - refreshDiagramEditors(); - return true; - } - - /** - * @generated - */ - private void refreshDiagramEditors() { - IEditorReference[] editors = myWorkbench.getActiveWorkbenchWindow() - .getActivePage().getEditorReferences(); - for (int i = 0; i < editors.length; i++) { - IEditorPart editor = editors[i].getEditor(false); - if (editor != null && editor instanceof UMLDiagramEditor) { - ((UMLDiagramEditor) editor).refresh(); - } - } - } - - /** - * @generated - */ - @Override - protected void initHelp() { - // TODO Auto-generated method stub - - }; - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramPreferenceInitializer.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramPreferenceInitializer.java deleted file mode 100644 index 8ee141e0f3d..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramPreferenceInitializer.java +++ /dev/null @@ -1,45 +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.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer { - - /** - * @generated - */ - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = getPreferenceStore(); - DiagramPrintingPreferencePage.initDefaults(store); - DiagramGeneralPreferencePage.initDefaults(store); - DiagramAppearancePreferencePage.initDefaults(store); - DiagramConnectionsPreferencePage.initDefaults(store); - DiagramRulersAndGridPreferencePage.initDefaults(store); - - DiagramIconStylePreferencePage.initDefaults(store); - - } - - /** - * @generated - */ - protected IPreferenceStore getPreferenceStore() { - return UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramPrintingPreferencePage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramPrintingPreferencePage.java deleted file mode 100644 index 7e1a70dbf78..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramPrintingPreferencePage.java +++ /dev/null @@ -1,29 +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.preferences; - -import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class DiagramPrintingPreferencePage extends PrintingPreferencePage { - - /** - * @generated - */ - public DiagramPrintingPreferencePage() { - setPreferenceStore(UMLDiagramEditorPlugin.getInstance() - .getPreferenceStore()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramRulersAndGridPreferencePage.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramRulersAndGridPreferencePage.java deleted file mode 100644 index 8d0a377bf85..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/preferences/DiagramRulersAndGridPreferencePage.java +++ /dev/null @@ -1,29 +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.preferences; - -import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage { - - /** - * @generated - */ - public DiagramRulersAndGridPreferencePage() { - setPreferenceStore(UMLDiagramEditorPlugin.getInstance() - .getPreferenceStore()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/ElementInitializers.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/ElementInitializers.java deleted file mode 100644 index 3e0e0d3e4e9..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/ElementInitializers.java +++ /dev/null @@ -1,341 +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.providers; - -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.CombinedFragment; -import org.eclipse.uml2.uml.Interaction; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageSort; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.actions.LabelHelper; -import org.eclipse.papyrus.diagram.sequence.expressions.UMLAbstractExpression; -import org.eclipse.papyrus.diagram.sequence.expressions.UMLOCLFactory; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class ElementInitializers { - - /** - * @generated - */ - public static void init_Interaction_1001(Interaction instance) { - try { - Object value0 = name_Interaction_1001(instance); - instance.setName((String) value0); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Interaction_2001(Interaction instance) { - try { - Object value0 = name_Interaction_2001(instance); - instance.setName((String) value0); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Lifeline_2002(Lifeline instance) { - try { - Object value0 = name_Lifeline_2002(instance); - instance.setName((String) value0); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_BehaviorExecutionSpecification_2003( - BehaviorExecutionSpecification instance) { - try { - Object value0 = name_BehaviorExecutionSpecification_2003(instance); - instance.setName((String) value0); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_CombinedFragment_2004(CombinedFragment instance) { - try { - Object value0 = name_CombinedFragment_2004(instance); - instance.setName((String) value0); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Message_3001(Message instance) { - try { - Object value0 = name_Message_3001(instance); - instance.setName((String) value0); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Message_3002(Message instance) { - try { - Object value0 = UMLOCLFactory.getExpression( - "MessageSort::asynchCall", - UMLPackage.eINSTANCE.getMessage()).evaluate(instance); - - value0 = UMLAbstractExpression.performCast(value0, - UMLPackage.eINSTANCE.getMessageSort()); - instance.setMessageSort((MessageSort) value0); - Object value1 = name_Message_3002(instance); - instance.setName((String) value1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Message_3003(Message instance) { - try { - Object value0 = UMLOCLFactory.getExpression("MessageSort::reply", - UMLPackage.eINSTANCE.getMessage()).evaluate(instance); - - value0 = UMLAbstractExpression.performCast(value0, - UMLPackage.eINSTANCE.getMessageSort()); - instance.setMessageSort((MessageSort) value0); - Object value1 = name_Message_3003(instance); - instance.setName((String) value1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Message_3004(Message instance) { - try { - Object value0 = UMLOCLFactory.getExpression( - "MessageSort::asynchSignal", - UMLPackage.eINSTANCE.getMessage()).evaluate(instance); - - value0 = UMLAbstractExpression.performCast(value0, - UMLPackage.eINSTANCE.getMessageSort()); - instance.setMessageSort((MessageSort) value0); - Object value1 = name_Message_3004(instance); - instance.setName((String) value1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Message_3005(Message instance) { - try { - Object value0 = UMLOCLFactory.getExpression( - "MessageSort::createMessage", - UMLPackage.eINSTANCE.getMessage()).evaluate(instance); - - value0 = UMLAbstractExpression.performCast(value0, - UMLPackage.eINSTANCE.getMessageSort()); - instance.setMessageSort((MessageSort) value0); - Object value1 = name_Message_3005(instance); - instance.setName((String) value1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static void init_Message_3006(Message instance) { - try { - Object value0 = UMLOCLFactory.getExpression( - "MessageSort::deleteMessage", - UMLPackage.eINSTANCE.getMessage()).evaluate(instance); - - value0 = UMLAbstractExpression.performCast(value0, - UMLPackage.eINSTANCE.getMessageSort()); - instance.setMessageSort((MessageSort) value0); - Object value1 = name_Message_3006(instance); - instance.setName((String) value1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Interaction_1001(Interaction self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Interaction_2001(Interaction self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Lifeline_2002(Lifeline self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_BehaviorExecutionSpecification_2003( - BehaviorExecutionSpecification self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_CombinedFragment_2004(CombinedFragment self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Message_3001(Message self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Message_3002(Message self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Message_3003(Message self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Message_3004(Message self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Message_3005(Message self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } - - /** - * @generated NOT - * - * implementation provided - */ - private static String name_Message_3006(Message self) { - if (self != null && self.eContainer() != null) { - return LabelHelper.INSTANCE.findName(self.eContainer(), self); - } - return ""; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLContributionItemProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLContributionItemProvider.java deleted file mode 100644 index 1293a83493f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLContributionItemProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.providers; - -import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider; -import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.printing.actions.PrintPreviewAction; -import org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.EnhancedPrintActionHelper; -import org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.RenderedPrintPreviewAction; -import org.eclipse.jface.action.IAction; - -/** - * @generated - */ - -public class UMLContributionItemProvider extends - AbstractContributionItemProvider { - - /** - * @generated - */ - protected IAction createAction(String actionId, - IWorkbenchPartDescriptor partDescriptor) { - if (actionId.equals(PrintPreviewAction.ID)) { - return new RenderedPrintPreviewAction( - new EnhancedPrintActionHelper()); - } - return super.createAction(actionId, partDescriptor); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLEditPartProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLEditPartProvider.java deleted file mode 100644 index d092ea9e23c..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLEditPartProvider.java +++ /dev/null @@ -1,155 +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.providers; - -import java.lang.ref.WeakReference; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.UMLEditPartFactory; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLEditPartProvider extends AbstractEditPartProvider { - - /** - * @generated - */ - private EditPartFactory factory; - - /** - * @generated - */ - private boolean allowCaching; - - /** - * @generated - */ - private WeakReference cachedPart; - - /** - * @generated - */ - private WeakReference cachedView; - - /** - * @generated - */ - public UMLEditPartProvider() { - setFactory(new UMLEditPartFactory()); - setAllowCaching(true); - } - - /** - * @generated - */ - public final EditPartFactory getFactory() { - return factory; - } - - /** - * @generated - */ - protected void setFactory(EditPartFactory factory) { - this.factory = factory; - } - - /** - * @generated - */ - public final boolean isAllowCaching() { - return allowCaching; - } - - /** - * @generated - */ - protected synchronized void setAllowCaching(boolean allowCaching) { - this.allowCaching = allowCaching; - if (!allowCaching) { - cachedPart = null; - cachedView = null; - } - } - - /** - * @generated - */ - protected IGraphicalEditPart createEditPart(View view) { - EditPart part = factory.createEditPart(null, view); - if (part instanceof IGraphicalEditPart) { - return (IGraphicalEditPart) part; - } - return null; - } - - /** - * @generated - */ - protected IGraphicalEditPart getCachedPart(View view) { - if (cachedView != null && cachedView.get() == view) { - return (IGraphicalEditPart) cachedPart.get(); - } - return null; - } - - /** - * @generated - */ - @Override - public synchronized IGraphicalEditPart createGraphicEditPart(View view) { - if (isAllowCaching()) { - IGraphicalEditPart part = getCachedPart(view); - cachedPart = null; - cachedView = null; - if (part != null) { - return part; - } - } - return createEditPart(view); - } - - /** - * @generated - */ - @Override - public synchronized boolean provides(IOperation operation) { - if (operation instanceof CreateGraphicEditPartOperation) { - View view = ((IEditPartOperation) operation).getView(); - if (!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(view))) { - return false; - } - if (isAllowCaching() && getCachedPart(view) != null) { - return true; - } - IGraphicalEditPart part = createEditPart(view); - if (part != null) { - if (isAllowCaching()) { - cachedPart = new WeakReference(part); - cachedView = new WeakReference(view); - } - return true; - } - } - return false; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLElementTypes.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLElementTypes.java deleted file mode 100644 index 5e013524c1a..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLElementTypes.java +++ /dev/null @@ -1,334 +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.providers; - -import java.util.HashSet; -import java.util.IdentityHashMap; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.UMLPackage; - -import org.eclipse.papyrus.diagram.common.providers.BaseModelTypeProvider; -import org.eclipse.papyrus.diagram.common.providers.ModelTypesProviderFactory; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditor; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class UMLElementTypes extends ElementInitializers { - - /** - * @generated - */ - private UMLElementTypes() { - } - - /** - * @generated - */ - private static Map elements; - - /** - * @generated - */ - private static ImageRegistry imageRegistry; - - /** - * @generated - */ - private static Set KNOWN_ELEMENT_TYPES; - - /** - * @generated - */ - public static final IHintedType Package_79 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Package_79"); //$NON-NLS-1$ - - /** - * @generated - */ - public static final IHintedType Interaction_1001 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Interaction_1001"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Interaction_2001 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Interaction_2001"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Lifeline_2002 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Lifeline_2002"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType BehaviorExecutionSpecification_2003 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.BehaviorExecutionSpecification_2003"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType CombinedFragment_2004 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.CombinedFragment_2004"); //$NON-NLS-1$ - - /** - * @generated - */ - public static final IHintedType Comment_2005 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Comment_2005"); //$NON-NLS-1$ - - /** - * @generated - */ - public static final IHintedType Message_3001 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Message_3001"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Message_3002 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Message_3002"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Message_3003 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Message_3003"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Message_3004 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Message_3004"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Message_3005 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Message_3005"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IHintedType Message_3006 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.Message_3006"); //$NON-NLS-1$ - - /** - * @generated - */ - public static final IHintedType ElementOwnedComment_3007 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.ElementOwnedComment_3007"); //$NON-NLS-1$ - - /** - * @generated - */ - public static final IHintedType CommentAnnotatedElement_3008 = (IHintedType) getElementType("org.eclipse.papyrus.diagram.sequence.CommentAnnotatedElement_3008"); //$NON-NLS-1$ - - /** - * @generated - */ - private static ImageRegistry getImageRegistry() { - if (imageRegistry == null) { - imageRegistry = new ImageRegistry(); - } - return imageRegistry; - } - - /** - * @generated - */ - private static String getImageRegistryKey(ENamedElement element) { - return element.getName(); - } - - /** - * @generated - */ - private static ImageDescriptor getProvidedImageDescriptor( - ENamedElement element) { - if (element instanceof EStructuralFeature) { - EStructuralFeature feature = ((EStructuralFeature) element); - EClass eContainingClass = feature.getEContainingClass(); - EClassifier eType = feature.getEType(); - if (eContainingClass != null && !eContainingClass.isAbstract()) { - element = eContainingClass; - } else if (eType instanceof EClass - && !((EClass) eType).isAbstract()) { - element = eType; - } - } - if (element instanceof EClass) { - EClass eClass = (EClass) element; - if (!eClass.isAbstract()) { - return UMLDiagramEditorPlugin.getInstance() - .getItemImageDescriptor( - eClass.getEPackage().getEFactoryInstance() - .create(eClass)); - } - } - // TODO : support structural features - return null; - } - - /** - * @generated - */ - public static ImageDescriptor getImageDescriptor(ENamedElement element) { - String key = getImageRegistryKey(element); - ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key); - if (imageDescriptor == null) { - imageDescriptor = getProvidedImageDescriptor(element); - if (imageDescriptor == null) { - imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); - } - getImageRegistry().put(key, imageDescriptor); - } - return imageDescriptor; - } - - /** - * @generated - */ - public static Image getImage(ENamedElement element) { - String key = getImageRegistryKey(element); - Image image = getImageRegistry().get(key); - if (image == null) { - ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element); - if (imageDescriptor == null) { - imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); - } - getImageRegistry().put(key, imageDescriptor); - image = getImageRegistry().get(key); - } - return image; - } - - /** - * @generated - */ - public static ImageDescriptor getImageDescriptor(IAdaptable hint) { - ENamedElement element = getElement(hint); - if (element == null) { - return null; - } - return getImageDescriptor(element); - } - - /** - * @generated - */ - public static Image getImage(IAdaptable hint) { - ENamedElement element = getElement(hint); - if (element == null) { - return null; - } - return getImage(element); - } - - /** - * Returns 'type' of the ecore object associated with the hint. - * - * @generated - */ - public static ENamedElement getElement(IAdaptable hint) { - Object type = hint.getAdapter(IElementType.class); - if (elements == null) { - elements = new IdentityHashMap(); - - elements.put(Package_79, UMLPackage.eINSTANCE.getPackage()); - - elements.put(Interaction_1001, UMLPackage.eINSTANCE - .getInteraction()); - - elements.put(Comment_2005, UMLPackage.eINSTANCE.getComment()); - - elements.put(Interaction_2001, UMLPackage.eINSTANCE - .getInteraction()); - - elements.put(Lifeline_2002, UMLPackage.eINSTANCE.getLifeline()); - - elements.put(BehaviorExecutionSpecification_2003, - UMLPackage.eINSTANCE.getBehaviorExecutionSpecification()); - - elements.put(CombinedFragment_2004, UMLPackage.eINSTANCE - .getCombinedFragment()); - - elements.put(Message_3001, UMLPackage.eINSTANCE.getMessage()); - - elements.put(Message_3002, UMLPackage.eINSTANCE.getMessage()); - - elements.put(Message_3003, UMLPackage.eINSTANCE.getMessage()); - - elements.put(Message_3004, UMLPackage.eINSTANCE.getMessage()); - - elements.put(Message_3005, UMLPackage.eINSTANCE.getMessage()); - - elements.put(Message_3006, UMLPackage.eINSTANCE.getMessage()); - - elements.put(ElementOwnedComment_3007, UMLPackage.eINSTANCE - .getElement_OwnedComment()); - - elements.put(CommentAnnotatedElement_3008, UMLPackage.eINSTANCE - .getComment_AnnotatedElement()); - } - return (ENamedElement) elements.get(type); - } - - /** - * @generated - */ - private static IElementType getElementType(String id) { - return ElementTypeRegistry.getInstance().getType(id); - } - - /** - * @generated - */ - public static boolean isKnownElementType(IElementType elementType) { - if (KNOWN_ELEMENT_TYPES == null) { - KNOWN_ELEMENT_TYPES = new HashSet(); - KNOWN_ELEMENT_TYPES.add(Package_79); - KNOWN_ELEMENT_TYPES.add(Interaction_1001); - KNOWN_ELEMENT_TYPES.add(Comment_2005); - KNOWN_ELEMENT_TYPES.add(Interaction_2001); - KNOWN_ELEMENT_TYPES.add(Lifeline_2002); - KNOWN_ELEMENT_TYPES.add(BehaviorExecutionSpecification_2003); - KNOWN_ELEMENT_TYPES.add(CombinedFragment_2004); - KNOWN_ELEMENT_TYPES.add(Message_3001); - KNOWN_ELEMENT_TYPES.add(Message_3002); - KNOWN_ELEMENT_TYPES.add(Message_3003); - KNOWN_ELEMENT_TYPES.add(Message_3004); - KNOWN_ELEMENT_TYPES.add(Message_3005); - KNOWN_ELEMENT_TYPES.add(Message_3006); - KNOWN_ELEMENT_TYPES.add(ElementOwnedComment_3007); - KNOWN_ELEMENT_TYPES.add(CommentAnnotatedElement_3008); - } - return KNOWN_ELEMENT_TYPES.contains(elementType); - } - - /** - * @generated - */ - public static void refreshImageRegistry() { - if (imageRegistry != null) { - imageRegistry.dispose(); - imageRegistry = null; - } - imageRegistry = new ImageRegistry(); - } - - /** - * @generated - */ - static { - ModelTypesProviderFactory.registerModelTypesProvider( - UMLDiagramEditor.ID, new BaseModelTypeProvider() { - @Override - public Image getImageHelper(IAdaptable hint) { - return getImage(hint); - } - }); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLIconProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLIconProvider.java deleted file mode 100644 index b244240b1cc..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLIconProvider.java +++ /dev/null @@ -1,41 +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.providers; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation; -import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider; -import org.eclipse.swt.graphics.Image; - -/** - * @generated - */ -public class UMLIconProvider extends AbstractProvider implements IIconProvider { - - /** - * @generated - */ - public Image getIcon(IAdaptable hint, int flags) { - return UMLElementTypes.getImage(hint); - } - - /** - * @generated - */ - public boolean provides(IOperation operation) { - if (operation instanceof GetIconOperation) { - return ((GetIconOperation) operation).execute(this) != null; - } - return false; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLMarkerNavigationProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLMarkerNavigationProvider.java deleted file mode 100644 index ba078e09acb..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLMarkerNavigationProvider.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.providers; - -import java.util.Arrays; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; -import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider; - -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorUtil; - -/** - * @generated - */ - -public class UMLMarkerNavigationProvider extends - AbstractModelMarkerNavigationProvider { - - /** - * @generated - */ - public static final String MARKER_TYPE = UMLDiagramEditorPlugin.ID - + ".diagnostic"; //$NON-NLS-1$ - - /** - * @generated - */ - protected void doGotoMarker(IMarker marker) { - String elementId = marker - .getAttribute( - org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, - null); - if (elementId == null || !(getEditor() instanceof DiagramEditor)) { - return; - } - DiagramEditor editor = (DiagramEditor) getEditor(); - Map editPartRegistry = editor.getDiagramGraphicalViewer() - .getEditPartRegistry(); - EObject targetView = editor.getDiagram().eResource().getEObject( - elementId); - if (targetView == null) { - return; - } - EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView); - if (targetEditPart != null) { - UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays - .asList(new EditPart[] { targetEditPart })); - } - } - - /** - * @generated - */ - public static void deleteMarkers(IResource resource) { - try { - resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO); - } catch (CoreException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Failed to delete validation markers", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public static IMarker addMarker(IFile file, String elementId, - String location, String message, int statusSeverity) { - IMarker marker = null; - try { - marker = file.createMarker(MARKER_TYPE); - marker.setAttribute(IMarker.MESSAGE, message); - marker.setAttribute(IMarker.LOCATION, location); - marker - .setAttribute( - org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, - elementId); - int markerSeverity = IMarker.SEVERITY_INFO; - if (statusSeverity == IStatus.WARNING) { - markerSeverity = IMarker.SEVERITY_WARNING; - } else if (statusSeverity == IStatus.ERROR - || statusSeverity == IStatus.CANCEL) { - markerSeverity = IMarker.SEVERITY_ERROR; - } - marker.setAttribute(IMarker.SEVERITY, markerSeverity); - } catch (CoreException e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Failed to create validation marker", e); //$NON-NLS-1$ - } - return marker; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLModelingAssistantProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLModelingAssistantProvider.java deleted file mode 100644 index 2fd74428adc..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLModelingAssistantProvider.java +++ /dev/null @@ -1,234 +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.providers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; - -import org.eclipse.papyrus.diagram.common.providers.assistant.ModelingAssistantRegistry; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.Messages; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditor; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class UMLModelingAssistantProvider extends ModelingAssistantProvider { - - /** - * @generated - */ - @Override - public List getTypesForPopupBar(IAdaptable host) { - IGraphicalEditPart editPart = (IGraphicalEditPart) host - .getAdapter(IGraphicalEditPart.class); - List types = new ArrayList(); - if (editPart instanceof LifelineEditPart) { - types.add(UMLElementTypes.BehaviorExecutionSpecification_2003); - } - if (editPart instanceof InteractionInteractionCompartmentEditPart) { - types.add(UMLElementTypes.Interaction_2001); - types.add(UMLElementTypes.Lifeline_2002); - types.add(UMLElementTypes.CombinedFragment_2004); - } - if (editPart instanceof InteractionInteractionCompartment2EditPart) { - types.add(UMLElementTypes.Interaction_2001); - types.add(UMLElementTypes.Lifeline_2002); - types.add(UMLElementTypes.CombinedFragment_2004); - } - if (editPart instanceof PackageEditPart) { - types.add(UMLElementTypes.Interaction_1001); - types.add(UMLElementTypes.Comment_2005); - } - - types = ModelingAssistantRegistry - .getInstance() - .customizeTypesForEditPart(UMLDiagramEditor.ID, editPart, types); - return types; - } - - /** - * @generated - */ - @Override - public List getRelTypesOnSource(IAdaptable source) { - IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source - .getAdapter(IGraphicalEditPart.class); - if (sourceEditPart instanceof CommentEditPart) { - List types = new ArrayList(); - types.add(UMLElementTypes.CommentAnnotatedElement_3008); - return types; - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public List getRelTypesOnTarget(IAdaptable target) { - IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target - .getAdapter(IGraphicalEditPart.class); - if (targetEditPart instanceof CommentEditPart) { - List types = new ArrayList(); - types.add(UMLElementTypes.ElementOwnedComment_3007); - return types; - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public List getRelTypesOnSourceAndTarget(IAdaptable source, - IAdaptable target) { - IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source - .getAdapter(IGraphicalEditPart.class); - IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target - .getAdapter(IGraphicalEditPart.class); - if (sourceEditPart instanceof CommentEditPart) { - List types = new ArrayList(); - return types; - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public List getTypesForSource(IAdaptable target, - IElementType relationshipType) { - IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target - .getAdapter(IGraphicalEditPart.class); - if (targetEditPart instanceof CommentEditPart) { - List types = new ArrayList(); - return types; - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public List getTypesForTarget(IAdaptable source, - IElementType relationshipType) { - IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source - .getAdapter(IGraphicalEditPart.class); - if (sourceEditPart instanceof CommentEditPart) { - List types = new ArrayList(); - return types; - } - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public EObject selectExistingElementForSource(IAdaptable target, - IElementType relationshipType) { - return selectExistingElement(target, getTypesForSource(target, - relationshipType)); - } - - /** - * @generated - */ - @Override - public EObject selectExistingElementForTarget(IAdaptable source, - IElementType relationshipType) { - return selectExistingElement(source, getTypesForTarget(source, - relationshipType)); - } - - /** - * @generated - */ - protected EObject selectExistingElement(IAdaptable host, Collection types) { - if (types.isEmpty()) { - return null; - } - IGraphicalEditPart editPart = (IGraphicalEditPart) host - .getAdapter(IGraphicalEditPart.class); - if (editPart == null) { - return null; - } - Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel(); - Collection elements = new HashSet(); - for (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) { - EObject element = (EObject) it.next(); - if (isApplicableElement(element, types)) { - elements.add(element); - } - } - if (elements.isEmpty()) { - return null; - } - return selectElement((EObject[]) elements.toArray(new EObject[elements - .size()])); - } - - /** - * @generated - */ - protected boolean isApplicableElement(EObject element, Collection types) { - IElementType type = ElementTypeRegistry.getInstance().getElementType( - element); - return types.contains(type); - } - - /** - * @generated - */ - protected EObject selectElement(EObject[] elements) { - Shell shell = Display.getCurrent().getActiveShell(); - ILabelProvider labelProvider = new AdapterFactoryLabelProvider( - UMLDiagramEditorPlugin.getInstance() - .getItemProvidersAdapterFactory()); - ElementListSelectionDialog dialog = new ElementListSelectionDialog( - shell, labelProvider); - dialog.setMessage(Messages.UMLModelingAssistantProviderMessage); - dialog.setTitle(Messages.UMLModelingAssistantProviderTitle); - dialog.setMultipleSelection(false); - dialog.setElements(elements); - EObject selected = null; - if (dialog.open() == Window.OK) { - selected = (EObject) dialog.getFirstResult(); - } - return selected; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLParserProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLParserProvider.java deleted file mode 100644 index 729dc053719..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLParserProvider.java +++ /dev/null @@ -1,685 +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 - * Javier Muñoz (Prodevelop) - Messages are updated when properties changes - * - ******************************************************************************/ -package org.eclipse.papyrus.diagram.sequence.providers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.ConnectableElement; -import org.eclipse.uml2.uml.Event; -import org.eclipse.uml2.uml.Lifeline; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.ValueSpecification; - - -import org.eclipse.papyrus.diagram.common.parser.TagsAdderParser; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentInteractionOperatorEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentBodyEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageNameEditPart; -import org.eclipse.papyrus.diagram.sequence.parsers.MessageFormatParser; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.util.MessageCommonUtil; - -/** - * @generated - */ -public class UMLParserProvider extends AbstractProvider implements - IParserProvider { - - /** - * @generated - */ - private IParser interactionName_4004Parser; - - /** - * @generated - */ - private IParser getInteractionName_4004Parser() { - if (interactionName_4004Parser == null) { - interactionName_4004Parser = createInteractionName_4004Parser(); - } - return interactionName_4004Parser; - } - - /** - * @generated - */ - protected IParser createInteractionName_4004Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - - MessageFormatParser parser = new MessageFormatParser(features); - parser.setViewPattern("sd: {0} "); - parser.setEditorPattern("{0}"); - parser.setEditPattern("{0}"); - return parser; - } - - /** - * @generated - */ - private IParser commentBody_5003Parser; - - /** - * @generated - */ - private IParser getCommentBody_5003Parser() { - if (commentBody_5003Parser == null) { - commentBody_5003Parser = createCommentBody_5003Parser(); - } - return commentBody_5003Parser; - } - - /** - * @generated - */ - protected IParser createCommentBody_5003Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getComment_Body(), }; - - MessageFormatParser parser = new MessageFormatParser(features); - return parser; - } - - /** - * @generated - */ - private IParser interactionName_4003Parser; - - /** - * @generated - */ - private IParser getInteractionName_4003Parser() { - if (interactionName_4003Parser == null) { - interactionName_4003Parser = createInteractionName_4003Parser(); - } - return interactionName_4003Parser; - } - - /** - * @generated - */ - protected IParser createInteractionName_4003Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - - MessageFormatParser parser = new MessageFormatParser(features); - parser.setViewPattern("sd: {0} "); - parser.setEditorPattern("{0}"); - parser.setEditPattern("{0}"); - return parser; - } - - /** - * @generated - */ - private IParser lifelineName_4001Parser; - - /** - * @generated - */ - private IParser getLifelineName_4001Parser() { - if (lifelineName_4001Parser == null) { - lifelineName_4001Parser = createLifelineName_4001Parser(); - } - return lifelineName_4001Parser; - } - - /** - * @generated NOT - * - * modified to show lifeline name and represents - */ - protected IParser createLifelineName_4001Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - - // Own MessageFormatParser - MessageFormatParser parser = new LifelineLabelFormatParser(features); - parser.setViewPattern("{0}: "); - parser.setEditorPattern("{0}"); - parser.setEditPattern("{0}"); - // Own TagsAdderParser - return new LifelineTagsAdderParser(parser); - } - - /** - * @generated - */ - private IParser combinedFragmentInteractionOperator_4002Parser; - - /** - * @generated - */ - private IParser getCombinedFragmentInteractionOperator_4002Parser() { - if (combinedFragmentInteractionOperator_4002Parser == null) { - combinedFragmentInteractionOperator_4002Parser = createCombinedFragmentInteractionOperator_4002Parser(); - } - return combinedFragmentInteractionOperator_4002Parser; - } - - /** - * @generated - */ - protected IParser createCombinedFragmentInteractionOperator_4002Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getCombinedFragment_InteractionOperator(), }; - - MessageFormatParser parser = new MessageFormatParser(features); - return parser; - } - - /** - * @generated - */ - private IParser messageName_4005Parser; - - /** - * @generated - */ - private IParser getMessageName_4005Parser() { - if (messageName_4005Parser == null) { - messageName_4005Parser = createMessageName_4005Parser(); - } - return messageName_4005Parser; - } - - /** - * @generated NOT - */ - protected IParser createMessageName_4005Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - // Own parser for Message Label - MessageFormatParser parser = new MessageLabelFormatParser(features); - parser.setViewPattern(" {0}"); - parser.setEditorPattern(" {0}"); - parser.setEditPattern("{0}"); - // Own parser to add convenient listeners - return new MessageTagsAdderParser(parser); - } - - /** - * @generated - */ - private IParser messageName_4006Parser; - - /** - * @generated - */ - private IParser getMessageName_4006Parser() { - if (messageName_4006Parser == null) { - messageName_4006Parser = createMessageName_4006Parser(); - } - return messageName_4006Parser; - } - - /** - * @generated NOT - */ - protected IParser createMessageName_4006Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - // Own parser for Message Label - MessageFormatParser parser = new MessageLabelFormatParser(features); - parser.setViewPattern(" {0}"); - parser.setEditorPattern(" {0}"); - parser.setEditPattern("{0}"); - // Own parser to add convenient listeners - return new MessageTagsAdderParser(parser); - } - - /** - * @generated - */ - private IParser messageName_4007Parser; - - /** - * @generated - */ - private IParser getMessageName_4007Parser() { - if (messageName_4007Parser == null) { - messageName_4007Parser = createMessageName_4007Parser(); - } - return messageName_4007Parser; - } - - /** - * @generated NOT - */ - protected IParser createMessageName_4007Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - // Own parser for Message Label - MessageFormatParser parser = new MessageLabelFormatParser(features); - parser.setViewPattern(" {0}"); - parser.setEditorPattern(" {0}"); - parser.setEditPattern("{0}"); - // Own parser to add convenient listeners - return new MessageTagsAdderParser(parser); - } - - /** - * @generated - */ - private IParser messageName_4008Parser; - - /** - * @generated - */ - private IParser getMessageName_4008Parser() { - if (messageName_4008Parser == null) { - messageName_4008Parser = createMessageName_4008Parser(); - } - return messageName_4008Parser; - } - - /** - * @generated NOT - */ - protected IParser createMessageName_4008Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - // Own parser for Message Label - MessageFormatParser parser = new MessageLabelFormatParser(features); - parser.setViewPattern(" {0}"); - parser.setEditorPattern(" {0}"); - parser.setEditPattern("{0}"); - // Own parser to add convenient listeners - return new MessageTagsAdderParser(parser); - } - - /** - * @generated - */ - private IParser messageName_4009Parser; - - /** - * @generated - */ - private IParser getMessageName_4009Parser() { - if (messageName_4009Parser == null) { - messageName_4009Parser = createMessageName_4009Parser(); - } - return messageName_4009Parser; - } - - /** - * @generated NOT - */ - protected IParser createMessageName_4009Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - // Own parser for Message Label - MessageFormatParser parser = new MessageLabelFormatParser(features); - parser.setViewPattern(" {0}"); - parser.setEditorPattern(" {0}"); - parser.setEditPattern("{0}"); - // Own parser to add convenient listeners - return new MessageTagsAdderParser(parser); - } - - /** - * @generated - */ - private IParser messageName_4010Parser; - - /** - * @generated - */ - private IParser getMessageName_4010Parser() { - if (messageName_4010Parser == null) { - messageName_4010Parser = createMessageName_4010Parser(); - } - return messageName_4010Parser; - } - - /** - * @generated NOT - */ - protected IParser createMessageName_4010Parser() { - EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE - .getNamedElement_Name(), }; - // Own parser for Message Label - MessageFormatParser parser = new MessageLabelFormatParser(features); - parser.setViewPattern(" {0}"); - parser.setEditorPattern(" {0}"); - parser.setEditPattern("{0}"); - // Own parser to add convenient listeners - return new MessageTagsAdderParser(parser); - } - - /** - * @generated - */ - protected IParser getParser(int visualID) { - switch (visualID) { - case InteractionNameEditPart.VISUAL_ID: - return getInteractionName_4004Parser(); - case CommentBodyEditPart.VISUAL_ID: - return getCommentBody_5003Parser(); - case InteractionName2EditPart.VISUAL_ID: - return getInteractionName_4003Parser(); - case LifelineNameEditPart.VISUAL_ID: - return getLifelineName_4001Parser(); - case CombinedFragmentInteractionOperatorEditPart.VISUAL_ID: - return getCombinedFragmentInteractionOperator_4002Parser(); - case MessageNameEditPart.VISUAL_ID: - return getMessageName_4005Parser(); - case MessageName2EditPart.VISUAL_ID: - return getMessageName_4006Parser(); - case MessageName3EditPart.VISUAL_ID: - return getMessageName_4007Parser(); - case MessageName4EditPart.VISUAL_ID: - return getMessageName_4008Parser(); - case MessageName5EditPart.VISUAL_ID: - return getMessageName_4009Parser(); - case MessageName6EditPart.VISUAL_ID: - return getMessageName_4010Parser(); - } - return null; - } - - /** - * @generated - */ - public IParser getParser(IAdaptable hint) { - String vid = (String) hint.getAdapter(String.class); - if (vid != null) { - return getParser(UMLVisualIDRegistry.getVisualID(vid)); - } - View view = (View) hint.getAdapter(View.class); - if (view != null) { - return getParser(UMLVisualIDRegistry.getVisualID(view)); - } - return null; - } - - /** - * @generated - */ - public boolean provides(IOperation operation) { - if (operation instanceof GetParserOperation) { - IAdaptable hint = ((GetParserOperation) operation).getHint(); - if (UMLElementTypes.getElement(hint) == null) { - return false; - } - return getParser(hint) != null; - } - return false; - } - - /** - * @generated - */ - public static class HintAdapter extends ParserHintAdapter { - - /** - * @generated - */ - private final IElementType elementType; - - /** - * @generated - */ - public HintAdapter(IElementType type, EObject object, String parserHint) { - super(object, parserHint); - assert type != null; - elementType = type; - } - - /** - * @generated - */ - @Override - public Object getAdapter(Class adapter) { - if (IElementType.class.equals(adapter)) { - return elementType; - } - return super.getAdapter(adapter); - } - } - - /** - * - * @NOT-generated - * @author Gabriel Merin Cubero - * - */ - public class MessageLabelFormatParser extends MessageFormatParser { - - public MessageLabelFormatParser(EAttribute[] features) { - super(features); - } - - @Override - public String getPrintString(IAdaptable adapter, int flags) { - String superString = super.getPrintString(adapter, flags); - EObject eObject = (EObject) adapter.getAdapter(EObject.class); - if (eObject instanceof Message) { - Operation op = MessageCommonUtil - .getMessageSendOperation((Message) eObject); - if (op != null) { - superString = MessageCommonUtil.getMessageOperationString( - (Message) eObject, op); - } - } - return superString; - } - - } - - /** - * - * @NOT-generated - * @author Gabriel Merin Cubero - * - */ - public class MessageTagsAdderParser extends TagsAdderParser { - - public MessageTagsAdderParser(IParser parser) { - super(parser); - } - - @Override - public List getSemanticElementsBeingParsed(EObject arg0) { - List eList = new ArrayList(super - .getSemanticElementsBeingParsed(arg0)); - - if (arg0 instanceof Message) { - Message msg = (Message) arg0; - // add the Operation - Operation op = MessageCommonUtil.getMessageSendOperation(msg); - if (op != null) { - eList.add(op); - - // add the Operation Parameters : by jmunoz - eList.addAll(op.getOwnedParameters()); - - // add the event - Event e = MessageCommonUtil.getMessageSendEvent(msg); - eList.add(e); - - // add the MessageArguments - eList.addAll(msg.getArguments()); - } - } - return eList; - } - - @Override - public boolean areSemanticElementsAffected(EObject arg0, Object arg1) { - if (arg1 instanceof Notification) { - Notification event = (Notification) arg1; - - if (event.getNotifier() instanceof ValueSpecification) { - return true; - } - - if (event.getNotifier() instanceof Operation - && UMLPackage.eINSTANCE.getNamedElement_Name().equals( - event.getFeature())) { - return true; - } - - if (event.getNotifier() instanceof Operation - && event.getFeature() == UMLPackage.eINSTANCE - .getBehavioralFeature_OwnedParameter()) { - return true; - } - - if (event.getNotifier() instanceof Event) { - return true; - } - - if (event.getNotifier() instanceof Message) { - return true; - } - - } - return false; - } - - } - - /** - * - * @NOT-generated - * @author Francisco Javier Cano Muñoz, Gabriel Merin Cubero - * - */ - public class LifelineLabelFormatParser extends MessageFormatParser { - - public LifelineLabelFormatParser(EAttribute[] features) { - super(features); - } - - @Override - public String getPrintString(IAdaptable adapter, int flags) { - String superString = super.getPrintString(adapter, flags); - EObject eObject = (EObject) adapter.getAdapter(EObject.class); - if (eObject instanceof Lifeline) { - String representsString = getLifelineRepresents((Lifeline) eObject); - if (representsString != null && representsString.length() > 0) { - superString += ("<" + representsString + ">"); - } - } - return superString; - } - - private String getLifelineRepresents(Lifeline lifeline) { - String represents = ""; - if (lifeline != null) { - ConnectableElement connectableElement = lifeline - .getRepresents(); - if (connectableElement instanceof Property) { - Property property = (Property) connectableElement; - Type type = property.getType(); - if (type != null) { - represents = type.getName(); - } - } - } - return represents; - } - - } - - /** - * - * @NOT-generated - * @author Francisco Javier Cano Muñoz, Gabriel Merin Cubero - * - */ - public class LifelineTagsAdderParser extends TagsAdderParser { - - public LifelineTagsAdderParser(IParser parser) { - super(parser); - } - - @Override - public List getSemanticElementsBeingParsed(EObject arg0) { - List eList = new ArrayList(super - .getSemanticElementsBeingParsed(arg0)); - - if (arg0 instanceof Lifeline) { - Lifeline lifeline = (Lifeline) arg0; - // add the represented element - ConnectableElement connectableElement = lifeline - .getRepresents(); - - if (connectableElement != null - && connectableElement instanceof Property) { - Property property = (Property) connectableElement; - // Listen to changes on the property - eList.add(property); - // Listen to changes on the Type referenced by the property - Type type = property.getType(); - if (type != null) { - eList.add(type); - } - } - } - return eList; - } - - @Override - public boolean areSemanticElementsAffected(EObject arg0, Object arg1) { - if (arg1 instanceof Notification) { - Notification event = (Notification) arg1; - - // Change on a ConnectableElement (Parameter, Property or - // Variable) - if (event.getNotifier() instanceof ConnectableElement - && (UMLPackage.eINSTANCE.getNamedElement_Name().equals( - event.getFeature()) || UMLPackage.eINSTANCE - .getTypedElement_Type().equals( - event.getFeature()))) { - return true; - } - // Change on the represent feature - if (event.getNotifier() instanceof Lifeline - && UMLPackage.eINSTANCE.getLifeline_Represents() - .equals(event.getFeature())) { - return true; - } - } - return super.areSemanticElementsAffected(arg0, arg1); - } - - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLShortcutsDecoratorProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLShortcutsDecoratorProvider.java deleted file mode 100644 index 8da23fe5727..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLShortcutsDecoratorProvider.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.providers; - -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.common.draw2d.ManuallyDrawnShortcutDecorator; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ - -public class UMLShortcutsDecoratorProvider extends AbstractProvider implements - IDecoratorProvider { - - /** - * @generated - */ - public static final String SHORTCUTS_DECORATOR_ID = "shortcuts"; //$NON-NLS-1$ - - /** - * @generated - */ - public boolean provides(IOperation operation) { - if (!(operation instanceof CreateDecoratorsOperation)) { - return false; - } - IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation) - .getDecoratorTarget(); - View view = (View) decoratorTarget.getAdapter(View.class); - return view != null - && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(view)); - } - - /** - * @generated - */ - public void createDecorators(IDecoratorTarget decoratorTarget) { - View view = (View) decoratorTarget.getAdapter(View.class); - if (view != null) { - EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ - if (annotation != null) { - //decoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget)); //this does not work due to #209802 - decoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, - new ManuallyDrawnShortcutDecorator(decoratorTarget)); - } - } - } - - /** - * @generated - */ - - protected class ShortcutsDecorator extends AbstractDecorator { - - /** - * @generated - */ - public ShortcutsDecorator(IDecoratorTarget decoratorTarget) { - super(decoratorTarget); - } - - /** - * @generated - */ - public void activate() { - refresh(); - } - - /** - * @generated - */ - public void refresh() { - removeDecoration(); - EditPart editPart = (EditPart) getDecoratorTarget().getAdapter( - EditPart.class); - Image image = UMLDiagramEditorPlugin.getInstance().getBundledImage( - "icons/shortcut.gif"); //$NON-NLS-1$ - if (editPart instanceof ShapeEditPart) { - setDecoration(getDecoratorTarget().addShapeDecoration(image, - IDecoratorTarget.Direction.SOUTH_WEST, 0, false)); - } else if (editPart instanceof ConnectionEditPart) { - setDecoration(getDecoratorTarget().addConnectionDecoration( - image, 50, false)); - } - } - - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLValidationProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLValidationProvider.java deleted file mode 100644 index 5747cadbea5..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLValidationProvider.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.providers; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.validation.AbstractModelConstraint; -import org.eclipse.emf.validation.IValidationContext; -import org.eclipse.emf.validation.model.IClientSelector; -import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider; -import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor; -import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.uml2.uml.NamedElement; - -import org.eclipse.papyrus.diagram.common.util.MDTUtil; -import org.eclipse.papyrus.diagram.common.providers.ValidationProvider; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.part.ValidateAction; - -/** - * @generated - */ - -public class UMLValidationProvider extends AbstractContributionItemProvider { - - /** - * @generated - */ - private static boolean constraintsActive = false; - - /** - * @generated - */ - public static boolean shouldConstraintsBePrivate() { - return false; - } - - /** - * @generated - */ - public static void runWithConstraints( - TransactionalEditingDomain editingDomain, Runnable operation) { - final Runnable op = operation; - Runnable task = new Runnable() { - public void run() { - try { - constraintsActive = true; - op.run(); - } finally { - constraintsActive = false; - } - } - }; - if (editingDomain != null) { - try { - editingDomain.runExclusive(task); - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError( - "Validation failed", e); //$NON-NLS-1$ - } - } else { - task.run(); - } - } - - /** - * @generated - */ - protected IAction createAction(String actionId, - IWorkbenchPartDescriptor partDescriptor) { - if (ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) { - return new ValidateAction(partDescriptor); - } - return super.createAction(actionId, partDescriptor); - } - - /** - * @generated - */ - static boolean isInDefaultEditorContext(Object object) { - if (shouldConstraintsBePrivate() && !constraintsActive) { - return false; - } - if (object instanceof View) { - return constraintsActive - && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID((View) object)); - } - return true; - } - - /** - * @generated - */ - public static class DefaultCtx implements IClientSelector { - - /** - * @generated - */ - public boolean selects(Object object) { - return isInDefaultEditorContext(object); - } - } - - /** - * @generated - */ - public static class Adapter1 extends AbstractModelConstraint { - - /** - * Implementation provided. - * - * @generated NOT - */ - public IStatus validate(IValidationContext ctx) { - NamedElement context = (NamedElement) ctx.getTarget(); - IStatus status = ValidationProvider.validateUniqueName(context); - if (status.getSeverity() != IStatus.OK) { - // UMLDiagramEditorPlugin.getInstance().getLog().log(status); - IStatusLineManager statusLine = MDTUtil.getStatusLineManager(); - if (statusLine != null) { - statusLine.setMessage(status.getMessage()); - } - return ctx.createFailureStatus(null); - } - return ctx.createSuccessStatus(); - } - } - - /** - * @generated - */ - static String formatElement(EObject object) { - return EMFCoreUtil.getQualifiedName(object, true); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLViewProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLViewProvider.java deleted file mode 100644 index 76e99cf4b24..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/providers/UMLViewProvider.java +++ /dev/null @@ -1,361 +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.providers; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentInteractionOperatorEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentBodyEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.diagram.sequence.view.factories.BehaviorExecutionSpecificationViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.CombinedFragmentInteractionOperatorViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.CombinedFragmentViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.CommentAnnotatedElementViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.CommentBodyViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.CommentViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.ElementOwnedCommentViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.Interaction2ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.InteractionInteractionCompartment2ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.InteractionInteractionCompartmentViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.InteractionName2ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.InteractionNameViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.InteractionViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.LifelineNameViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.LifelineViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.Message2ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.Message3ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.Message4ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.Message5ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.Message6ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageName2ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageName3ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageName4ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageName5ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageName6ViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageNameViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.MessageViewFactory; -import org.eclipse.papyrus.diagram.sequence.view.factories.PackageViewFactory; - -/** - * @generated - */ -public class UMLViewProvider extends AbstractViewProvider { - /** - * @generated - */ - @Override - protected Class getDiagramViewClass(IAdaptable semanticAdapter, - String diagramKind) { - EObject semanticElement = getSemanticElement(semanticAdapter); - if (PackageEditPart.MODEL_ID.equals(diagramKind) - && UMLVisualIDRegistry.getDiagramVisualID(semanticElement) != -1) { - return PackageViewFactory.class; - } - return null; - } - - /** - * @generated - */ - @Override - protected Class getNodeViewClass(IAdaptable semanticAdapter, - View containerView, String semanticHint) { - if (containerView == null) { - return null; - } - IElementType elementType = getSemanticElementType(semanticAdapter); - EObject domainElement = getSemanticElement(semanticAdapter); - int visualID; - if (semanticHint == null) { - // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy. - // In this situation there should be NO elementType, visualID will be determined - // by VisualIDRegistry.getNodeVisualID() for domainElement. - if (elementType != null || domainElement == null) { - return null; - } - visualID = UMLVisualIDRegistry.getNodeVisualID(containerView, - domainElement); - } else { - visualID = UMLVisualIDRegistry.getVisualID(semanticHint); - if (elementType != null) { - // Semantic hint is specified together with element type. - // Both parameters should describe exactly the same diagram element. - // In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for - // domainElement (if specified) is the same as in element type. - if (!UMLElementTypes.isKnownElementType(elementType) - || (!(elementType instanceof IHintedType))) { - return null; // foreign element type - } - String elementTypeHint = ((IHintedType) elementType) - .getSemanticHint(); - if (!semanticHint.equals(elementTypeHint)) { - return null; // if semantic hint is specified it should be the same as in element type - } - if (domainElement != null - && visualID != UMLVisualIDRegistry.getNodeVisualID( - containerView, domainElement)) { - return null; // visual id for node EClass should match visual id from element type - } - } else { - // Element type is not specified. Domain element should be present. - // This method is called with EObjectAdapter as parameter from: - // - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint) - // - generated ViewFactory.decorateView() for parent element - if (!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(containerView))) { - return null; // foreign diagram - } - switch (visualID) { - case InteractionEditPart.VISUAL_ID: - case CommentEditPart.VISUAL_ID: - case Interaction2EditPart.VISUAL_ID: - case LifelineEditPart.VISUAL_ID: - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - case CombinedFragmentEditPart.VISUAL_ID: - if (domainElement == null - || visualID != UMLVisualIDRegistry.getNodeVisualID( - containerView, domainElement)) { - return null; // visual id in semantic hint should match visual id for domain element - } - break; - case InteractionNameEditPart.VISUAL_ID: - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - if (InteractionEditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case CommentBodyEditPart.VISUAL_ID: - if (CommentEditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case InteractionName2EditPart.VISUAL_ID: - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - if (Interaction2EditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case LifelineNameEditPart.VISUAL_ID: - if (LifelineEditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case CombinedFragmentInteractionOperatorEditPart.VISUAL_ID: - if (CombinedFragmentEditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case MessageNameEditPart.VISUAL_ID: - if (MessageEditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case MessageName2EditPart.VISUAL_ID: - if (Message2EditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case MessageName3EditPart.VISUAL_ID: - if (Message3EditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case MessageName4EditPart.VISUAL_ID: - if (Message4EditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case MessageName5EditPart.VISUAL_ID: - if (Message5EditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - case MessageName6EditPart.VISUAL_ID: - if (Message6EditPart.VISUAL_ID != UMLVisualIDRegistry - .getVisualID(containerView) - || containerView.getElement() != domainElement) { - return null; // wrong container - } - break; - default: - return null; - } - } - } - return getNodeViewClass(containerView, visualID); - } - - /** - * @generated - */ - protected Class getNodeViewClass(View containerView, int visualID) { - if (containerView == null - || !UMLVisualIDRegistry.canCreateNode(containerView, visualID)) { - return null; - } - switch (visualID) { - case InteractionEditPart.VISUAL_ID: - return InteractionViewFactory.class; - case InteractionNameEditPart.VISUAL_ID: - return InteractionNameViewFactory.class; - case CommentEditPart.VISUAL_ID: - return CommentViewFactory.class; - case CommentBodyEditPart.VISUAL_ID: - return CommentBodyViewFactory.class; - case Interaction2EditPart.VISUAL_ID: - return Interaction2ViewFactory.class; - case InteractionName2EditPart.VISUAL_ID: - return InteractionName2ViewFactory.class; - case LifelineEditPart.VISUAL_ID: - return LifelineViewFactory.class; - case LifelineNameEditPart.VISUAL_ID: - return LifelineNameViewFactory.class; - case BehaviorExecutionSpecificationEditPart.VISUAL_ID: - return BehaviorExecutionSpecificationViewFactory.class; - case CombinedFragmentEditPart.VISUAL_ID: - return CombinedFragmentViewFactory.class; - case CombinedFragmentInteractionOperatorEditPart.VISUAL_ID: - return CombinedFragmentInteractionOperatorViewFactory.class; - case InteractionInteractionCompartmentEditPart.VISUAL_ID: - return InteractionInteractionCompartmentViewFactory.class; - case InteractionInteractionCompartment2EditPart.VISUAL_ID: - return InteractionInteractionCompartment2ViewFactory.class; - case MessageNameEditPart.VISUAL_ID: - return MessageNameViewFactory.class; - case MessageName2EditPart.VISUAL_ID: - return MessageName2ViewFactory.class; - case MessageName3EditPart.VISUAL_ID: - return MessageName3ViewFactory.class; - case MessageName4EditPart.VISUAL_ID: - return MessageName4ViewFactory.class; - case MessageName5EditPart.VISUAL_ID: - return MessageName5ViewFactory.class; - case MessageName6EditPart.VISUAL_ID: - return MessageName6ViewFactory.class; - } - return null; - } - - /** - * @generated - */ - @Override - protected Class getEdgeViewClass(IAdaptable semanticAdapter, - View containerView, String semanticHint) { - IElementType elementType = getSemanticElementType(semanticAdapter); - if (!UMLElementTypes.isKnownElementType(elementType) - || (!(elementType instanceof IHintedType))) { - return null; // foreign element type - } - String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); - if (elementTypeHint == null) { - return null; // our hint is visual id and must be specified - } - if (semanticHint != null && !semanticHint.equals(elementTypeHint)) { - return null; // if semantic hint is specified it should be the same as in element type - } - int visualID = UMLVisualIDRegistry.getVisualID(elementTypeHint); - EObject domainElement = getSemanticElement(semanticAdapter); - if (domainElement != null - && visualID != UMLVisualIDRegistry - .getLinkWithClassVisualID(domainElement)) { - return null; // visual id for link EClass should match visual id from element type - } - return getEdgeViewClass(visualID); - } - - /** - * @generated - */ - protected Class getEdgeViewClass(int visualID) { - switch (visualID) { - case MessageEditPart.VISUAL_ID: - return MessageViewFactory.class; - case Message2EditPart.VISUAL_ID: - return Message2ViewFactory.class; - case Message3EditPart.VISUAL_ID: - return Message3ViewFactory.class; - case Message4EditPart.VISUAL_ID: - return Message4ViewFactory.class; - case Message5EditPart.VISUAL_ID: - return Message5ViewFactory.class; - case Message6EditPart.VISUAL_ID: - return Message6ViewFactory.class; - case ElementOwnedCommentEditPart.VISUAL_ID: - return ElementOwnedCommentViewFactory.class; - case CommentAnnotatedElementEditPart.VISUAL_ID: - return CommentAnnotatedElementViewFactory.class; - } - return null; - } - - /** - * @generated - */ - private IElementType getSemanticElementType(IAdaptable semanticAdapter) { - if (semanticAdapter == null) { - return null; - } - return (IElementType) semanticAdapter.getAdapter(IElementType.class); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/sheet/UMLPropertySection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/sheet/UMLPropertySection.java deleted file mode 100644 index dfd96729056..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/sheet/UMLPropertySection.java +++ /dev/null @@ -1,130 +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.sheet; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.IPropertySource; -import org.eclipse.ui.views.properties.IPropertySourceProvider; - -import org.eclipse.papyrus.diagram.common.sheet.PropertySourceExtension; - -/** - * @generated - */ -public class UMLPropertySection extends AdvancedPropertySection implements - IPropertySourceProvider { - - /** - * @generated - */ - public IPropertySource getPropertySource(Object object) { - if (object instanceof IPropertySource) { - return (IPropertySource) object; - } - AdapterFactory af = getAdapterFactory(object); - if (af != null) { - IItemPropertySource ips = (IItemPropertySource) af.adapt(object, - IItemPropertySource.class); - if (ips != null) { - return new PropertySourceExtension(object, ips, af); - } - } - if (object instanceof IAdaptable) { - return (IPropertySource) ((IAdaptable) object) - .getAdapter(IPropertySource.class); - } - return null; - } - - /** - * @generated - */ - @Override - protected IPropertySourceProvider getPropertySourceProvider() { - return this; - } - - /** - * Modify/unwrap selection. - * @generated - */ - protected Object transformSelection(Object selected) { - - if (selected instanceof EditPart) { - Object model = ((EditPart) selected).getModel(); - return model instanceof View ? ((View) model).getElement() : null; - } - if (selected instanceof View) { - return ((View) selected).getElement(); - } - if (selected instanceof IAdaptable) { - View view = (View) ((IAdaptable) selected).getAdapter(View.class); - if (view != null) { - return view.getElement(); - } - } - return selected; - } - - /** - * @generated - */ - @Override - public void setInput(IWorkbenchPart part, ISelection selection) { - if (selection.isEmpty() - || false == selection instanceof StructuredSelection) { - super.setInput(part, selection); - return; - } - final StructuredSelection structuredSelection = ((StructuredSelection) selection); - ArrayList transformedSelection = new ArrayList(structuredSelection - .size()); - for (Iterator it = structuredSelection.iterator(); it.hasNext();) { - Object r = transformSelection(it.next()); - if (r != null) { - transformedSelection.add(r); - } - } - super.setInput(part, new StructuredSelection(transformedSelection)); - } - - /** - * @generated - */ - protected AdapterFactory getAdapterFactory(Object object) { - if (getEditingDomain() instanceof AdapterFactoryEditingDomain) { - return ((AdapterFactoryEditingDomain) getEditingDomain()) - .getAdapterFactory(); - } - TransactionalEditingDomain editingDomain = TransactionUtil - .getEditingDomain(object); - if (editingDomain != null) { - return ((AdapterFactoryEditingDomain) editingDomain) - .getAdapterFactory(); - } - return null; - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/sheet/UMLSheetLabelProvider.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/sheet/UMLSheetLabelProvider.java deleted file mode 100644 index c524d47960f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/sheet/UMLSheetLabelProvider.java +++ /dev/null @@ -1,93 +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.sheet; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.DecoratingLabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.papyrus.diagram.sequence.navigator.UMLNavigatorGroup; -import org.eclipse.papyrus.diagram.sequence.part.UMLDiagramEditorPlugin; - -/** - * @generated - */ -public class UMLSheetLabelProvider extends DecoratingLabelProvider { - - /** - * @generated - */ - public UMLSheetLabelProvider() { - super(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin - .getInstance().getItemProvidersAdapterFactory()), null); - } - - /** - * @generated - */ - @Override - public String getText(Object element) { - Object selected = unwrap(element); - if (selected instanceof UMLNavigatorGroup) { - return ((UMLNavigatorGroup) selected).getGroupName(); - } - return super.getText(selected); - } - - /** - * @generated - */ - @Override - public Image getImage(Object element) { - return super.getImage(unwrap(element)); - } - - /** - * @generated - */ - private Object unwrap(Object element) { - if (element instanceof IStructuredSelection) { - return unwrap(((IStructuredSelection) element).getFirstElement()); - } - if (element instanceof EditPart) { - return unwrapEditPart((EditPart) element); - } - if (element instanceof IAdaptable) { - View view = (View) ((IAdaptable) element).getAdapter(View.class); - if (view != null) { - return unwrapView(view); - } - } - return element; - } - - /** - * @generated - */ - private Object unwrapEditPart(EditPart p) { - if (p.getModel() instanceof View) { - return unwrapView((View) p.getModel()); - } - return p.getModel(); - } - - /** - * @generated - */ - private Object unwrapView(View view) { - return view.getElement() == null ? view : view.getElement(); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/BehaviorExecutionSpecificationViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/BehaviorExecutionSpecificationViewFactory.java deleted file mode 100644 index eafec9fc2b2..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/BehaviorExecutionSpecificationViewFactory.java +++ /dev/null @@ -1,56 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class BehaviorExecutionSpecificationViewFactory extends - AbstractShapeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createShapeStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(BehaviorExecutionSpecificationEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CombinedFragmentInteractionOperatorViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CombinedFragmentInteractionOperatorViewFactory.java deleted file mode 100644 index bed61e1b825..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CombinedFragmentInteractionOperatorViewFactory.java +++ /dev/null @@ -1,33 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class CombinedFragmentInteractionOperatorViewFactory extends - BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CombinedFragmentViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CombinedFragmentViewFactory.java deleted file mode 100644 index 4d754dd8e6f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CombinedFragmentViewFactory.java +++ /dev/null @@ -1,71 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CombinedFragmentInteractionOperatorEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class CombinedFragmentViewFactory extends AbstractShapeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createShapeStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(CombinedFragmentEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService() - .createNode( - eObjectAdapter, - view, - UMLVisualIDRegistry - .getType(CombinedFragmentInteractionOperatorEditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentAnnotatedElementViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentAnnotatedElementViewFactory.java deleted file mode 100644 index 2caea7ff1a6..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentAnnotatedElementViewFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class CommentAnnotatedElementViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(CommentAnnotatedElementEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentBodyViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentBodyViewFactory.java deleted file mode 100644 index 4278e76c70b..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentBodyViewFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class CommentBodyViewFactory extends BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentViewFactory.java deleted file mode 100644 index 6120c082a8a..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/CommentViewFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentBodyEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.CommentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class CommentViewFactory extends AbstractShapeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createShapeStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(CommentEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - if (!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(containerView))) { - EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE - .createEAnnotation(); - shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ - shortcutAnnotation.getDetails().put( - "modelID", PackageEditPart.MODEL_ID); //$NON-NLS-1$ - view.getEAnnotations().add(shortcutAnnotation); - } - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/ElementOwnedCommentViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/ElementOwnedCommentViewFactory.java deleted file mode 100644 index bab99d18cd9..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/ElementOwnedCommentViewFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.papyrus.diagram.sequence.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.ElementOwnedCommentEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class ElementOwnedCommentViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(ElementOwnedCommentEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Interaction2ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Interaction2ViewFactory.java deleted file mode 100644 index 4044f94dca2..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Interaction2ViewFactory.java +++ /dev/null @@ -1,79 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.Interaction2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionName2EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Interaction2ViewFactory extends AbstractShapeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createShapeStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(Interaction2EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService() - .createNode( - eObjectAdapter, - view, - UMLVisualIDRegistry - .getType(InteractionName2EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - getViewService() - .createNode( - eObjectAdapter, - view, - UMLVisualIDRegistry - .getType(InteractionInteractionCompartment2EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionInteractionCompartment2ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionInteractionCompartment2ViewFactory.java deleted file mode 100644 index 30d3a6b6516..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionInteractionCompartment2ViewFactory.java +++ /dev/null @@ -1,83 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.DrawerStyle; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.TitleStyle; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class InteractionInteractionCompartment2ViewFactory extends - BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createSortingStyle()); - styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(InteractionInteractionCompartment2EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - setupCompartmentTitle(view); - setupCompartmentCollapsed(view); - } - - /** - * @generated - */ - protected void setupCompartmentTitle(View view) { - TitleStyle titleStyle = (TitleStyle) view - .getStyle(NotationPackage.eINSTANCE.getTitleStyle()); - if (titleStyle != null) { - titleStyle.setShowTitle(true); - } - } - - /** - * @generated - */ - protected void setupCompartmentCollapsed(View view) { - DrawerStyle drawerStyle = (DrawerStyle) view - .getStyle(NotationPackage.eINSTANCE.getDrawerStyle()); - if (drawerStyle != null) { - drawerStyle.setCollapsed(false); - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionInteractionCompartmentViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionInteractionCompartmentViewFactory.java deleted file mode 100644 index 06fd214d765..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionInteractionCompartmentViewFactory.java +++ /dev/null @@ -1,83 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.DrawerStyle; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.TitleStyle; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class InteractionInteractionCompartmentViewFactory extends - BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createSortingStyle()); - styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(InteractionInteractionCompartmentEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - setupCompartmentTitle(view); - setupCompartmentCollapsed(view); - } - - /** - * @generated - */ - protected void setupCompartmentTitle(View view) { - TitleStyle titleStyle = (TitleStyle) view - .getStyle(NotationPackage.eINSTANCE.getTitleStyle()); - if (titleStyle != null) { - titleStyle.setShowTitle(true); - } - } - - /** - * @generated - */ - protected void setupCompartmentCollapsed(View view) { - DrawerStyle drawerStyle = (DrawerStyle) view - .getStyle(NotationPackage.eINSTANCE.getDrawerStyle()); - if (drawerStyle != null) { - drawerStyle.setCollapsed(false); - } - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionName2ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionName2ViewFactory.java deleted file mode 100644 index 2714ea9163f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionName2ViewFactory.java +++ /dev/null @@ -1,32 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class InteractionName2ViewFactory extends BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionNameViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionNameViewFactory.java deleted file mode 100644 index c4eec3ea943..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionNameViewFactory.java +++ /dev/null @@ -1,32 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class InteractionNameViewFactory extends BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionViewFactory.java deleted file mode 100644 index 881d5345220..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/InteractionViewFactory.java +++ /dev/null @@ -1,87 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionNameEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class InteractionViewFactory extends AbstractShapeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createShapeStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(InteractionEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - if (!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry - .getModelID(containerView))) { - EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE - .createEAnnotation(); - shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ - shortcutAnnotation.getDetails().put( - "modelID", PackageEditPart.MODEL_ID); //$NON-NLS-1$ - view.getEAnnotations().add(shortcutAnnotation); - } - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(InteractionNameEditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - getViewService() - .createNode( - eObjectAdapter, - view, - UMLVisualIDRegistry - .getType(InteractionInteractionCompartmentEditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/LifelineNameViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/LifelineNameViewFactory.java deleted file mode 100644 index 282d688596e..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/LifelineNameViewFactory.java +++ /dev/null @@ -1,32 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class LifelineNameViewFactory extends BasicNodeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/LifelineViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/LifelineViewFactory.java deleted file mode 100644 index b35454ef7d9..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/LifelineViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.LifelineNameEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class LifelineViewFactory extends AbstractShapeViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createShapeStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(LifelineEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(LifelineNameEditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } - -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message2ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message2ViewFactory.java deleted file mode 100644 index ee1d9f25367..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message2ViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message2EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName2EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Message2ViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(Message2EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(MessageName2EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message3ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message3ViewFactory.java deleted file mode 100644 index 3c87c924f53..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message3ViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message3EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName3EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Message3ViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(Message3EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(MessageName3EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message4ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message4ViewFactory.java deleted file mode 100644 index e67c7f62cbd..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message4ViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message4EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName4EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Message4ViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(Message4EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(MessageName4EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message5ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message5ViewFactory.java deleted file mode 100644 index f3c1eed4444..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message5ViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message5EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName5EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Message5ViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(Message5EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(MessageName5EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message6ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message6ViewFactory.java deleted file mode 100644 index a2ce8003e45..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/Message6ViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.Message6EditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageName6EditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class Message6ViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(Message6EditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(MessageName6EditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName2ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName2ViewFactory.java deleted file mode 100644 index dc2b5a280cc..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName2ViewFactory.java +++ /dev/null @@ -1,55 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class MessageName2ViewFactory extends AbstractLabelViewFactory { - - /** - * @generated - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, - String semanticHint, int index, boolean persisted, - PreferencesHint preferencesHint) { - Node view = (Node) super.createView(semanticAdapter, containerView, - semanticHint, index, persisted, preferencesHint); - Location location = (Location) view.getLayoutConstraint(); - IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView - .getDiagram().getMeasurementUnit()); - location.setX(mapMode.DPtoLP(1)); - location.setY(mapMode.DPtoLP(-13)); - return view; - } - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName3ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName3ViewFactory.java deleted file mode 100644 index b42a8fbb344..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName3ViewFactory.java +++ /dev/null @@ -1,55 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class MessageName3ViewFactory extends AbstractLabelViewFactory { - - /** - * @generated - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, - String semanticHint, int index, boolean persisted, - PreferencesHint preferencesHint) { - Node view = (Node) super.createView(semanticAdapter, containerView, - semanticHint, index, persisted, preferencesHint); - Location location = (Location) view.getLayoutConstraint(); - IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView - .getDiagram().getMeasurementUnit()); - location.setX(mapMode.DPtoLP(1)); - location.setY(mapMode.DPtoLP(-13)); - return view; - } - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName4ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName4ViewFactory.java deleted file mode 100644 index 558bae9384f..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName4ViewFactory.java +++ /dev/null @@ -1,55 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class MessageName4ViewFactory extends AbstractLabelViewFactory { - - /** - * @generated - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, - String semanticHint, int index, boolean persisted, - PreferencesHint preferencesHint) { - Node view = (Node) super.createView(semanticAdapter, containerView, - semanticHint, index, persisted, preferencesHint); - Location location = (Location) view.getLayoutConstraint(); - IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView - .getDiagram().getMeasurementUnit()); - location.setX(mapMode.DPtoLP(1)); - location.setY(mapMode.DPtoLP(-13)); - return view; - } - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName5ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName5ViewFactory.java deleted file mode 100644 index f7d37fb5f5b..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName5ViewFactory.java +++ /dev/null @@ -1,55 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class MessageName5ViewFactory extends AbstractLabelViewFactory { - - /** - * @generated - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, - String semanticHint, int index, boolean persisted, - PreferencesHint preferencesHint) { - Node view = (Node) super.createView(semanticAdapter, containerView, - semanticHint, index, persisted, preferencesHint); - Location location = (Location) view.getLayoutConstraint(); - IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView - .getDiagram().getMeasurementUnit()); - location.setX(mapMode.DPtoLP(1)); - location.setY(mapMode.DPtoLP(-13)); - return view; - } - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName6ViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName6ViewFactory.java deleted file mode 100644 index c390171b23d..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageName6ViewFactory.java +++ /dev/null @@ -1,55 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class MessageName6ViewFactory extends AbstractLabelViewFactory { - - /** - * @generated - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, - String semanticHint, int index, boolean persisted, - PreferencesHint preferencesHint) { - Node view = (Node) super.createView(semanticAdapter, containerView, - semanticHint, index, persisted, preferencesHint); - Location location = (Location) view.getLayoutConstraint(); - IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView - .getDiagram().getMeasurementUnit()); - location.setX(mapMode.DPtoLP(1)); - location.setY(mapMode.DPtoLP(-13)); - return view; - } - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageNameViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageNameViewFactory.java deleted file mode 100644 index 2ff37ade395..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageNameViewFactory.java +++ /dev/null @@ -1,55 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class MessageNameViewFactory extends AbstractLabelViewFactory { - - /** - * @generated - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, - String semanticHint, int index, boolean persisted, - PreferencesHint preferencesHint) { - Node view = (Node) super.createView(semanticAdapter, containerView, - semanticHint, index, persisted, preferencesHint); - Location location = (Location) view.getLayoutConstraint(); - IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView - .getDiagram().getMeasurementUnit()); - location.setX(mapMode.DPtoLP(1)); - location.setY(mapMode.DPtoLP(-13)); - return view; - } - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - return styles; - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageViewFactory.java deleted file mode 100644 index 1a61c46a82c..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/MessageViewFactory.java +++ /dev/null @@ -1,67 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageEditPart; -import org.eclipse.papyrus.diagram.sequence.edit.parts.MessageNameEditPart; -import org.eclipse.papyrus.diagram.sequence.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class MessageViewFactory extends ConnectionViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); - styles.add(NotationFactory.eINSTANCE.createFontStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected void decorateView(View containerView, View view, - IAdaptable semanticAdapter, String semanticHint, int index, - boolean persisted) { - if (semanticHint == null) { - semanticHint = UMLVisualIDRegistry - .getType(MessageEditPart.VISUAL_ID); - view.setType(semanticHint); - } - super.decorateView(containerView, view, semanticAdapter, semanticHint, - index, persisted); - IAdaptable eObjectAdapter = null; - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - eObjectAdapter = new EObjectAdapter(eObject); - } - getViewService().createNode(eObjectAdapter, view, - UMLVisualIDRegistry.getType(MessageNameEditPart.VISUAL_ID), - ViewUtil.APPEND, true, getPreferencesHint()); - } -} diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/PackageViewFactory.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/PackageViewFactory.java deleted file mode 100644 index 429cdf63cfe..00000000000 --- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/view/factories/PackageViewFactory.java +++ /dev/null @@ -1,43 +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.view.factories; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory; -import org.eclipse.gmf.runtime.notation.MeasurementUnit; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @generated - */ -public class PackageViewFactory extends DiagramViewFactory { - - /** - * @generated - */ - @Override - protected List createStyles(View view) { - List styles = new ArrayList(); - styles.add(NotationFactory.eINSTANCE.createDiagramStyle()); - return styles; - } - - /** - * @generated - */ - @Override - protected MeasurementUnit getMeasurementUnit() { - return MeasurementUnit.PIXEL_LITERAL; - } -} |