diff options
author | Camille Letavernier | 2018-04-17 14:09:16 +0000 |
---|---|---|
committer | Camille Letavernier | 2018-04-18 07:15:37 +0000 |
commit | ab582c171cc4874c47a5dd7d09c52d1a1cfa53e8 (patch) | |
tree | a3deece97eb43d4456bcb1bc9a5f8b82e26d73ab | |
parent | fa271e93a8163957385075241d42c3bad5c77e96 (diff) | |
download | org.eclipse.papyrus-ab582c171cc4874c47a5dd7d09c52d1a1cfa53e8.tar.gz org.eclipse.papyrus-ab582c171cc4874c47a5dd7d09c52d1a1cfa53e8.tar.xz org.eclipse.papyrus-ab582c171cc4874c47a5dd7d09c52d1a1cfa53e8.zip |
533700: [SequenceDiagram] Clean-up dead code
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533700
Remove unused OLD classes
Change-Id: Iebb5c9a85c7229bdb6b4f746586162a935326f17
Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
6 files changed, 0 insertions, 1039 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java deleted file mode 100644 index cb6447d89e0..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java +++ /dev/null @@ -1,402 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA - * - * - * 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: - * Soyatec - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartListener; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.RootEditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.DecorationNode; -import org.eclipse.gmf.runtime.notation.LayoutConstraint; -import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.helper.NotificationHelper; -import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; -import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionGraphicalNodeEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.util.BehaviorDisplayHelper; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.BehaviorExecutionSpecification; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=417376. Display the behavior of an BehaviorExecutionSpecification as a Label. - * - * IMPORTANT, the new behavior label was added to the BorderedNodeFigure of Interaction, it seems there are some problems about moving when it was - * added - * on the BorderedNodeFigure of current BehaviorExecutionSpecification EditPart. - * - * @author Jin Liu (jin.liu@soyatec.com) - */ -public class OLDCustomBehaviorExecutionSpecificationEditPart extends BehaviorExecutionSpecificationEditPart { - - /** - * Constructor. - * - * @param view - */ - public OLDCustomBehaviorExecutionSpecificationEditPart(View view) { - super(view); - - } - - private NotificationHelper helper = new NotificationHelper(new UIAdapterImpl() { - - @Override - protected void safeNotifyChanged(Notification msg) { - handleNotificationEvent(msg); - } - }); - - /** - * Registered a removing listener in parent editpart, this can help us to remove the behavior label(tips: behavior label was added to interaction - * figure.). - */ - private EditPartListener selfRemovingListener; - - - /** - * @Override - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - // Fixed bug about reconnect message when the ends of execution were MessageOccurrenceSpecification. - removeEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ExecutionGraphicalNodeEditPolicy()); - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof BehaviorExecutionSpecificationBehaviorEditPart) { - return new BorderItemSelectionEditPolicy() { - - @Override - protected List createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - - @Override - protected Command getMoveCommand(ChangeBoundsRequest request) { - IBorderItemEditPart borderItemEP = (IBorderItemEditPart) getHost(); - IBorderItemLocator borderItemLocator = borderItemEP.getBorderItemLocator(); - - if (borderItemLocator != null) { - LayoutConstraint layout = ((Node) getHost().getModel()).getLayoutConstraint(); - Point location = new Point(); - if (layout instanceof Location) { - location.x = ((Location) layout).getX(); - location.y = ((Location) layout).getY(); - } - location.translate(request.getMoveDelta()); - - ICommand moveCommand = new SetLocationCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); - return new ICommandProxy(moveCommand); - } - return null; - } - - - }; - } - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (childEditPart instanceof BehaviorExecutionSpecificationBehaviorEditPart) { - IFigure childFigure = ((BehaviorExecutionSpecificationBehaviorEditPart) childEditPart).getFigure(); - BorderedNodeFigure borderedFigure = getBorderedFigure(); - final IFigure figure = getFigure(); - BehaviorLabelLocator locator = new BehaviorLabelLocator(figure); - if (borderedFigure != null) { - borderedFigure.getBorderItemContainer().add(childFigure, locator); - } - return; - } - super.addChildVisual(childEditPart, -1); - } - - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (childEditPart instanceof BehaviorExecutionSpecificationBehaviorEditPart) { - IFigure childFigure = ((BehaviorExecutionSpecificationBehaviorEditPart) childEditPart).getFigure(); - BorderedNodeFigure borderedFigure = getBorderedFigure(); - if (borderedFigure != null) { - borderedFigure.getBorderItemContainer().remove(childFigure); - } - return; - } - super.removeChildVisual(childEditPart); - } - - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshBehavior(); - } - - @Override - protected void refreshBounds() { - super.refreshBounds(); - refreshBehavior(); - } - - protected void refreshBehavior() { - if (!BehaviorDisplayHelper.shouldDisplayBehavior(getNotationView())) { - return; - } - List children = getChildren(); - for (Object child : children) { - if (child instanceof BehaviorExecutionSpecificationBehaviorEditPart) { - ((BehaviorExecutionSpecificationBehaviorEditPart) child).refresh(); - } - } - } - - @Override - public void activate() { - super.activate(); - EObject elt = resolveSemanticElement(); - if (elt instanceof BehaviorExecutionSpecification) { - Behavior behavior = ((BehaviorExecutionSpecification) elt).getBehavior(); - if (behavior != null) { - helper.listenObject(behavior); - } - } - addSelfRemovingListener(getParent()); - } - - private void addSelfRemovingListener(EditPart editPart) { - if (editPart == null || editPart instanceof RootEditPart) { - return; - } - if (selfRemovingListener == null) { - selfRemovingListener = new EditPartListener.Stub() { - - @Override - public void removingChild(EditPart child, int index) { - boolean removeBehavior = false; - EditPart editPart = OLDCustomBehaviorExecutionSpecificationEditPart.this; - while (editPart != null && !(editPart instanceof RootEditPart)) { - if (editPart == child) { - removeBehavior = true; - break; - } - editPart = editPart.getParent(); - } - if (removeBehavior) { - List children = new ArrayList(getChildren()); - for (Object object : children) { - if (object instanceof BehaviorExecutionSpecificationBehaviorEditPart) { - removeChild((EditPart) object); - break; - } - } - } - } - }; - } - if (editPart != null) { - editPart.removeEditPartListener(selfRemovingListener); - editPart.addEditPartListener(selfRemovingListener); - addSelfRemovingListener(editPart.getParent()); - } - } - - private void removeSelfRemovingListener(EditPart editPart) { - if (editPart == null || editPart instanceof RootEditPart || selfRemovingListener == null) { - return; - } - if (editPart != null) { - editPart.removeEditPartListener(selfRemovingListener); - removeSelfRemovingListener(editPart.getParent()); - } - } - - @Override - public void deactivate() { - helper.unlistenAll(); - removeSelfRemovingListener(getParent()); - super.deactivate(); - } - - @Override - protected void handleNotificationEvent(Notification event) { - super.handleNotificationEvent(event); - Object feature = event.getFeature(); - Object notifier = event.getNotifier(); - if (UMLPackage.eINSTANCE.getBehaviorExecutionSpecification_Behavior() == feature) { - helper.unlistenObject((Notifier) event.getOldValue()); - helper.listenObject((Notifier) event.getNewValue()); - refreshBehavior(); - } else if (notifier != null) { - EObject elt = resolveSemanticElement(); - if (elt instanceof BehaviorExecutionSpecification && notifier == ((BehaviorExecutionSpecification) elt).getBehavior()) { - refreshBehavior(); - } - } - if (BehaviorDisplayHelper.isDisplayBehaviorChanged(event)) { - refreshChildren(); - } - } - - @Override - protected List getModelChildren() { - List modelChildren = new ArrayList(super.getModelChildren()); - boolean displayBehavior = BehaviorDisplayHelper.shouldDisplayBehavior(getNotationView()); - // Lazy check and create behavior label model. - boolean hasBehaviorLabel = false; - final View view = getNotationView(); - for (Object object : view.getChildren()) { - if (object instanceof View && BehaviorExecutionSpecificationBehaviorEditPart.BEHAVIOR_TYPE.equals(((View) object).getType())) { - hasBehaviorLabel = true; - if (!displayBehavior) { - modelChildren.remove(object); - } - break; - } - } - if (!hasBehaviorLabel && displayBehavior) { - final DecorationNode behaviorLabel = NotationFactory.eINSTANCE.createDecorationNode(); - Location location = NotationFactory.eINSTANCE.createLocation(); - location.setX(16); - location.setY(16); - behaviorLabel.setLayoutConstraint(location); - behaviorLabel.setType(BehaviorExecutionSpecificationBehaviorEditPart.BEHAVIOR_TYPE); - - modelChildren.add(behaviorLabel); - } - return modelChildren; - } - - private static class BehaviorLabelLocator implements IBorderItemLocator { - - private IFigure referenceFigure; - - private Rectangle constraint = new Rectangle(); - - - /** - * Constructor. - * - */ - public BehaviorLabelLocator(IFigure referenceFigure) { - this.referenceFigure = referenceFigure; - } - - /** - * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#setConstraint(org.eclipse.draw2d.geometry.Rectangle) - * - * @param constraint - */ - - @Override - public void setConstraint(Rectangle constraint) { - this.constraint = constraint; - } - - /** - * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getValidLocation(org.eclipse.draw2d.geometry.Rectangle, org.eclipse.draw2d.IFigure) - * - * @param proposedLocation - * @param borderItem - * @return - */ - - @Override - public Rectangle getValidLocation(Rectangle proposedLocation, IFigure borderItem) { - return new Rectangle(proposedLocation); - } - - /** - * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getCurrentSideOfParent() - * - * @return - */ - - @Override - public int getCurrentSideOfParent() { - return 0; - } - - /** - * @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure) - * - * @param target - */ - - @Override - public void relocate(IFigure target) { - Rectangle ref = referenceFigure.getBounds().getCopy(); - referenceFigure.translateToAbsolute(ref); - Rectangle bounds = constraint.getTranslated(ref.getLocation()); - bounds.setSize(target.getPreferredSize()); - target.translateToRelative(bounds); - target.setBounds(bounds); - } - - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.java deleted file mode 100644 index a92041edccc..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.java +++ /dev/null @@ -1,217 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA - * - * - * 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: - * Soyatec - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.sequence.edit.parts; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.ScrollPane; -import org.eclipse.draw2d.XYLayout; -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.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -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.CreateViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomDiagramDragDropEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper; - -/** - * @author Jin Liu (jin.liu@soyatec.com) - */ -public class OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart extends CombinedFragmentCombinedFragmentCompartmentEditPart { - - /** - * Children string for notification event type. - */ - private static final String CHILDREN_TYPE = "children"; - - /** - * Constructor. - * - * @param view - */ - public OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart(View view) { - super(view); - } - - /** - * Not generated for delete borders add stretch children figures. - * - * @Override - */ - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.getScrollPane().setVerticalScrollBarVisibility(ScrollPane.NEVER); - result.setTitleVisibility(false); - result.setBorder(null); - IFigure contentPane = result.getContentPane(); - if (contentPane != null) { - contentPane.setBorder(null); - // fix Scroll bars(https://bugs.eclipse.org/bugs/show_bug.cgi?id=364697) - contentPane.setLayoutManager(new XYLayout()); - // LayoutManager layout = contentPane.getLayoutManager(); - // if(layout instanceof ConstrainedToolbarLayout) { - // ConstrainedToolbarLayout constrainedToolbarLayout = (ConstrainedToolbarLayout)layout; - // constrainedToolbarLayout.setStretchMajorAxis(true); - // constrainedToolbarLayout.setStretchMinorAxis(true); - // } - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, createCreationEditPolicy()); - installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); - } - - private EditPolicy createCreationEditPolicy() { - return new PapyrusCreationEditPolicy() { - - @Override - protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) { - // THIS WAS ALREADY DID IN getCreateCommand(), WHY AGAIN? - // Command createCommand = super.getCreateElementAndViewCommand(request); - // if (createCommand == null || !createCommand.canExecute()){ - // return createCommand; - // } - // ICommandProxy commandProxy = (ICommandProxy)createCommand; - // CompositeCommand command = (CompositeCommand)commandProxy.getICommand(); - // - // IHintedType type = (IHintedType)UMLElementTypes.InteractionOperand_Shape; - // if(type.getSemanticHint().equals(request.getViewAndElementDescriptor().getSemanticHint())) { - // //fix Scroll bars(https://bugs.eclipse.org/bugs/show_bug.cgi?id=364697), note that we use XYLayout - // //to relocate both its bounds and combined fragment bounds when operand is added to combined fragment - // OperandBoundsComputeHelper.addUpdateBoundsForIOCreationCommand(CombinedFragmentCombinedFragmentCompartmentEditPart.this, request.getViewAndElementDescriptor(), command); - // } - // return commandProxy; - return super.getCreateElementAndViewCommand(request); - } - - @Override - protected Command getCreateCommand(CreateViewRequest request) { - ICommandProxy commandProxy = (ICommandProxy) super.getCreateCommand(request); - ICommand command = commandProxy.getICommand(); - CompositeCommand compositeCommand = null; - if (command instanceof CompositeCommand) { - compositeCommand = (CompositeCommand) command; - } else { - compositeCommand = new CompositeCommand(commandProxy.getLabel()); - compositeCommand.add(command); - } - for (ViewDescriptor viewDescriptor : request.getViewDescriptors()) { - IHintedType type = (IHintedType) UMLElementTypes.InteractionOperand_Shape; - if (type.getSemanticHint().equals(viewDescriptor.getSemanticHint())) { - // fix Scroll bars(https://bugs.eclipse.org/bugs/show_bug.cgi?id=364697), note that we use XYLayout - // to relocate both its bounds and combined fragment bounds when operand is added to combined fragment - OperandBoundsComputeHelper.addUpdateBoundsForIOCreationCommand(OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.this, viewDescriptor, compositeCommand); - } - } - return new ICommandProxy(compositeCommand.reduce()); - } - }; - } - - /** - * Not generated for handle the first InteractionOperand case (no LineSeparator) {@inheritDoc} - * - */ - @Override - protected EditPart createChild(Object model) { - EditPart child = super.createChild(model); - if (getChildren() == null || getChildren().isEmpty() && child instanceof OLDCustomInteractionOperandEditPart) { - ((OLDCustomInteractionOperandEditPart) child).setFirstOperand(true); - } - return child; - } - - /** - * Handle the first InteractionOperand deletion case (change FirstOperand attribute) - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (feature instanceof EStructuralFeature) { - EStructuralFeature ref = (EStructuralFeature) feature; - String typeName = ref.getName(); - if (CHILDREN_TYPE.equals(typeName)) { - if (event.getEventType() == Notification.UNSET || event.getEventType() == Notification.REMOVE) { - List<?> children = getChildren(); - if (children != null && children.size() > 1) { - Object firstChild = children.get(0); - if (firstChild instanceof OLDCustomInteractionOperandEditPart) { - OLDCustomInteractionOperandEditPart firstOperandChild = (OLDCustomInteractionOperandEditPart) firstChild; - Object firstChildModel = firstOperandChild.getModel(); - if (firstChildModel != null && firstChildModel.equals(event.getOldValue()) && children.get(1) instanceof OLDCustomInteractionOperandEditPart) { - OLDCustomInteractionOperandEditPart secondOperandChild = (OLDCustomInteractionOperandEditPart) children.get(1); - secondOperandChild.setFirstOperand(true); - } - } - } - } - } - } - super.handleNotificationEvent(event); - } - - public boolean ignoreRequest(Request request) { - if (request instanceof ChangeBoundsRequest && (request.getType().equals(org.eclipse.gef.RequestConstants.REQ_ADD) || request.getType().equals(RequestConstants.REQ_DROP))) { - List parts = ((ChangeBoundsRequest) request).getEditParts(); - if (parts != null) { - for (Object obj : parts) { - if (obj instanceof CommentEditPart || obj instanceof ConstraintEditPart || obj instanceof TimeObservationEditPart) { - return true; - } - } - } - } - return false; - } - - @Override - public void showTargetFeedback(Request request) { - if (ignoreRequest(request)) { - return; - } - super.showTargetFeedback(request); - } - - @Override - public Command getCommand(Request request) { - if (ignoreRequest(request)) { - return null; - } - return super.getCommand(request); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDDestructionEventComponentEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDDestructionEventComponentEditPolicy.java deleted file mode 100644 index ad3fcd8262b..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDDestructionEventComponentEditPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA - * - * - * 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: - * Atos Origin - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.sequence.edit.policies; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -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.editparts.ShapeNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ComponentEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceDeleteHelper; - -/** - * This edit policy also deletes time/duration edit parts which are linked with the deleted edit part. - * - * @since 3.0 - */ -public class OLDDestructionEventComponentEditPolicy extends ComponentEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command createDeleteViewCommand(GroupRequest deleteRequest) { - CompoundCommand deleteViewsCommand = new CompoundCommand(); - Command deleteViewCommand = super.createDeleteViewCommand(deleteRequest); - deleteViewsCommand.add(deleteViewCommand); - if (getHost() instanceof ShapeNodeEditPart) { - TransactionalEditingDomain editingDomain = ((ShapeNodeEditPart) getHost()).getEditingDomain(); - SequenceDeleteHelper.completeDeleteDestructionOccurenceViewCommand(deleteViewsCommand, editingDomain, getHost()); - } - return deleteViewsCommand; - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java deleted file mode 100644 index 93eb500fb02..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java +++ /dev/null @@ -1,123 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ - - -package org.eclipse.papyrus.uml.diagram.sequence.edit.policies; - -import java.util.Map; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool; -import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; -import org.eclipse.papyrus.uml.diagram.sequence.figures.DestructionEventFigure; -import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes; -import org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant; - -/** - * - * This class is manage border item and element inside Lifeline - * @since 3.0 - * - */ -public class OLDLifeLineLayoutEditPolicy extends DefaultCreationEditPolicy { - - - - /** - * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy#getCreateElementAndViewCommand(org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) - * - * @param request - * @return - */ - @Override - protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) { - ViewAndElementDescriptor descriptor=request.getViewAndElementDescriptor(); - if (UMLDIElementTypes.ACTION_EXECUTION_SPECIFICATION_SHAPE.getSemanticHint().equals(descriptor.getSemanticHint())){ - // get the element descriptor - CreateElementRequestAdapter requestAdapter = - request.getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // get the semantic request - CreateElementRequest createElementRequest = - (CreateElementRequest) requestAdapter.getAdapter( - CreateElementRequest.class); - View view = (View)getHost().getModel(); - EObject hostElement = ViewUtil.resolveSemanticElement(view); - createElementRequest.setContainer(hostElement.eContainer()); - createElementRequest.setParameter(SequenceRequestConstant.COVERED, hostElement); - - } - return super.getCreateElementAndViewCommand(request); - } - /** - * {@inheritDoc} - */ - @Override - protected ICommand getSetBoundsCommand(CreateViewRequest request, CreateViewRequest.ViewDescriptor descriptor) { - ICommand setBoundsCommand = null; - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - // Retrieve parent location - if( descriptor.getSemanticHint().equals(UMLDIElementTypes.DESTRUCTION_OCCURRENCE_SPECIFICATION_SHAPE.getSemanticHint())){ - Point parentLoc = getHostFigure().getBounds().getLocation().getCopy(); - final Point realWantedLocation; - Map<?, ?> params = request.getExtendedData(); - Point realLocation = (Point) params.get(AspectUnspecifiedTypeCreationTool.INITIAL_MOUSE_LOCATION_FOR_CREATION); - if (realLocation != null) { - realWantedLocation = realLocation.getCopy(); - } else { - // we use this location to be able to create Port in the corners of the figure - realWantedLocation = request.getLocation().getCopy(); - } - // Compute relative creation location - Point requestedLocation = realWantedLocation.getCopy(); - - //The position of the node must be relation form its container - requestedLocation.translate(parentLoc.negate()); - //In the case of the destruction event we contsider the center as the origin. - - DestructionEventFigure destructionEventFigure= new DestructionEventFigure(); - requestedLocation.y=requestedLocation.y-destructionEventFigure.getDefaultSize().height/2; - setBoundsCommand = new SetLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, requestedLocation); - } - else{ - super.getSetBoundsCommand(request, descriptor); - } - - - - return setBoundsCommand; - } - - - /** - * {@inheritDoc} - */ - protected IFigure getHostFigure() { - return ((GraphicalEditPart) getHost()).getFigure(); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java deleted file mode 100644 index 3b53879db8a..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java +++ /dev/null @@ -1,195 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 CEA - * - * - * 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: - * Atos Origin - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.sequence.edit.policies; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; -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.commands.SemanticCreateCommand; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; -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.RefreshConnectionsRequest; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.figures.LifelineDotLineCustomFigure; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.uml.diagram.sequence.util.FragmentsOrdererHelper; -import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant; -import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil; -import org.eclipse.uml2.uml.InteractionFragment; -import org.eclipse.uml2.uml.OccurrenceSpecification; - -/** - * A specific creation edit policy for the Lifeline. - * Execution Specification is created graphically on the lifeline, but depending on its graphical position determines also its model container. - * - * Occurrence Specification is located on the lifeline, but not visible. Though, elements must be created on it. - */ -public class OLDLifelineCreationEditPolicy extends CreationEditPolicy { - - @Override - protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) { - // get the element descriptor - CreateElementRequestAdapter requestAdapter = request.getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // get the semantic request - View view = (View) getHost().getModel(); - EObject hostElement = ViewUtil.resolveSemanticElement(view); - if (hostElement == null && view.getElement() == null) { - hostElement = view; - } - - CreateElementRequest createElementRequest = (CreateElementRequest) requestAdapter.getAdapter(CreateElementRequest.class); - if (createElementRequest.getContainer() == null) { - // complete the semantic request by filling in the host's semantic - // Returns null if host is unresolvable so that trying to create a - // new element in an unresolved shape will not be allowed. - if (hostElement == null) { - return null; - } - createElementRequest.setContainer(hostElement); - } - InteractionFragment ift = SequenceUtil.findInteractionFragmentContainerAt(request.getLocation(), getHost()); - Map<String, Object> extendedData = request.getExtendedData(); - extendedData.put(SequenceRequestConstant.INTERACTIONFRAGMENT_CONTAINER, ift); - extendedData.put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.COVERED, hostElement); - - createElementRequest.setContainer(ift); - // record the nearest event if necessary - String requestHint = request.getViewAndElementDescriptor().getSemanticHint(); - if (isCreatedOnOccurrenceSpecification(requestHint)) { - EditPart hostPart = getHost(); - if (hostPart instanceof LifelineEditPart) { - Entry<Point, List<OccurrenceSpecification>> eventAndLocation = SequenceUtil.findNearestEvent(request.getLocation(), (LifelineEditPart) hostPart); - // find an event near enough to create the constraint or observation - List<OccurrenceSpecification> events = Collections.emptyList(); - Point location = null; - if (eventAndLocation != null) { - location = eventAndLocation.getKey(); - events = eventAndLocation.getValue(); - } - if (extendedData.containsKey(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2)) { - extendedData.put(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2, events); - } else { - extendedData.put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION, events); - } - if (extendedData.containsKey(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION_2)) { - extendedData.put(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION_2, location); - } else { - extendedData.put(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION, location); - } - } - } - // get the create element command based on the elementdescriptor's - // request - Command createElementCommand = getHost().getCommand(new EditCommandRequestWrapper((CreateElementRequest) requestAdapter.getAdapter(CreateElementRequest.class), request.getExtendedData())); - if (createElementCommand == null) { - return UnexecutableCommand.INSTANCE; - } - if (!createElementCommand.canExecute()) { - return createElementCommand; - } - // create the semantic create wrapper command - SemanticCreateCommand semanticCommand = new SemanticCreateCommand(requestAdapter, createElementCommand); - Command viewCommand = getCreateCommand(request); - Command refreshConnectionCommand = getHost().getCommand(new RefreshConnectionsRequest(((List) request.getNewObject()))); - // form the compound command and return - CompositeCommand cc = new CompositeCommand(semanticCommand.getLabel()); - cc.compose(semanticCommand); - cc.compose(new CommandProxy(viewCommand)); - if (refreshConnectionCommand != null) { - cc.compose(new CommandProxy(refreshConnectionCommand)); - } - LifelineEditPart parentPart = (LifelineEditPart) getHost(); - IHintedType type = (IHintedType) UMLElementTypes.Lifeline_Shape; - if (type.getSemanticHint().equals(request.getViewAndElementDescriptor().getSemanticHint())) { - setChildLifelineBounds(cc, request, parentPart); - } - // Ordering fragments after creation, See https://bugs.eclipse.org/bugs/show_bug.cgi?id=403233 - ICommand orderingFragmentsCommand = FragmentsOrdererHelper.createOrderingFragmentsCommand(getHost(), request); - if (orderingFragmentsCommand != null && orderingFragmentsCommand.canExecute()) { - cc.compose(orderingFragmentsCommand); - } - return new ICommandProxy(cc); - } - - private void setChildLifelineBounds(CompositeCommand cc, CreateViewAndElementRequest request, LifelineEditPart parentPart) { - Point location = request.getLocation().getCopy(); - LifelineDotLineCustomFigure parentFigure = (LifelineDotLineCustomFigure) parentPart.getContentPane(); - Rectangle parentBounds = parentFigure.getBounds().getCopy(); - parentFigure.translateToAbsolute(parentBounds); - Rectangle childBounds = parentBounds.getCopy(); - childBounds.height = parentBounds.height; - childBounds.width = -1; // default size - childBounds.y = 0; // y offset from parent - childBounds.x = location.x - parentBounds.x; // x offset from parent - SetResizeAndLocationCommand cmd = new SetResizeAndLocationCommand(parentPart.getEditingDomain(), "set size", request.getViewAndElementDescriptor(), childBounds); - cc.compose(cmd); - } - - /** - * Return true if creation must be performed on an occurrence specification - * - * @param requestHint - * the hint of object to create - * @return true if creation on an occurrence specification - */ - private boolean isCreatedOnOccurrenceSpecification(String requestHint) { - return isTimeHint(requestHint) || isDurationHint(requestHint); - } - - /** - * Return true if hint is for creating a duration observation/constraint - * - * @param requestHint - * the hint of object to create - * @return true if correct hint - */ - private boolean isDurationHint(String requestHint) { - String durCstOnLifelineHint = ((IHintedType) UMLElementTypes.DurationConstraint_Shape).getSemanticHint(); - String durCstOnMessage = ((IHintedType) UMLElementTypes.DurationConstraint_Shape_CN).getSemanticHint(); - String durObsOnMessage = ((IHintedType) UMLElementTypes.DurationObservation_Shape).getSemanticHint(); - return durCstOnLifelineHint.equals(requestHint) || durCstOnMessage.equals(requestHint) || durObsOnMessage.equals(requestHint); - } - - /** - * Return true if hint is for creating a time observation/constraint - * - * @param requestHint - * the hint of object to create - * @return true if correct hint - */ - private boolean isTimeHint(String requestHint) { - String timeConstraintHint = ((IHintedType) UMLElementTypes.TimeConstraint_Shape).getSemanticHint(); - String timeObservationHint = ((IHintedType) UMLElementTypes.TimeObservation_Shape).getSemanticHint(); - return timeConstraintHint.equals(requestHint) || timeObservationHint.equals(requestHint); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDMessageConnectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDMessageConnectionEditPolicy.java deleted file mode 100644 index 54bee045557..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDMessageConnectionEditPolicy.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA - * - * - * 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: - * Atos Origin - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.sequence.edit.policies; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -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.editparts.ConnectionNodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineMessageCreateHelper; -import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceDeleteHelper; - -/** - * This edit policy also deletes time/duration edit parts which are linked with the deleted edit part. - * - * @since 3.0 - */ -@Deprecated -public class OLDMessageConnectionEditPolicy extends ConnectionEditPolicy { - - @Override - @Deprecated - protected Command createDeleteSemanticCommand(GroupRequest deleteRequest) { - CompoundCommand deleteSemanticsCommand = new CompoundCommand(); - Command deleteSemanticCommand = super.createDeleteSemanticCommand(deleteRequest); - deleteSemanticsCommand.add(deleteSemanticCommand); - return LifelineMessageCreateHelper.restoreLifelineOnMessageDelete(deleteSemanticsCommand, getHost()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - protected Command createDeleteViewCommand(GroupRequest deleteRequest) { - CompoundCommand deleteViewsCommand = new CompoundCommand(); - Command deleteViewCommand = super.createDeleteViewCommand(deleteRequest); - deleteViewsCommand.add(deleteViewCommand); - if (getHost() instanceof ConnectionNodeEditPart) { - TransactionalEditingDomain editingDomain = ((ConnectionNodeEditPart) getHost()).getEditingDomain(); - SequenceDeleteHelper.completeDeleteMessageViewCommand(deleteViewsCommand, editingDomain, getHost()); - } - return LifelineMessageCreateHelper.restoreLifelineOnMessageDelete(deleteViewsCommand, getHost()); - } -} |