Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-03-22 13:41:31 +0000
committercletavernie2013-03-22 13:41:31 +0000
commit9f49c5efb2e475aa6ff3ce86df607690af2a67e5 (patch)
treef758310c5e8e26944a572a44a2cc5599896f2762 /deprecated
parent9bbd2ee37d63cb6861fb9f80eab40b1f0f86b8a1 (diff)
downloadorg.eclipse.papyrus-9f49c5efb2e475aa6ff3ce86df607690af2a67e5.tar.gz
org.eclipse.papyrus-9f49c5efb2e475aa6ff3ce86df607690af2a67e5.tar.xz
org.eclipse.papyrus-9f49c5efb2e475aa6ff3ce86df607690af2a67e5.zip
404141: [Sequence Diagram] Migrate the sequence diagram from 0.9.2 (Juno) to 0.10 (Kepler)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=404141 Deprecate the current version of Sequence Diagram on Kepler - not maintained directly
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.classpath14
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.options7
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/sequenceDiagram.gmfgen.prefs6
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/META-INF/MANIFEST.MF63
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/build.properties16
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramCommand.java57
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java25
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/ObservationLinkMetamodelType.java38
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java35
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramEditorFactory.java30
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java117
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ChangeEdgeTargetCommand.java79
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java185
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateLocatedConnectionViewCommand.java239
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeObservationCreateCommand.java108
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomZOrderCommand.java57
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java139
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java796
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java390
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractMessageEditPart.java194
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ExecutionSpecificationEndEditPart.java595
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionFragmentEditPart.java206
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCreationEditPolicy.java162
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentItemComponentEditPolicy.java90
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java124
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomConnectionHandleEditPolicy.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java1188
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java67
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java461
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DestructionEventComponentEditPolicy.java43
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java117
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExecutionSpecificationComponentEditPolicy.java71
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java69
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/HighlightConnectionPartEditPolicy.java46
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java789
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandComponentEditPolicy.java90
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java71
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java108
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineAppliedStereotypeNodeLabelDisplayEditPolicy.java39
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java237
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineCreationEditPolicy.java202
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineLabelEditPolicy.java207
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java927
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionEditPolicy.java54
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java332
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageLabelEditPolicy.java1000
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java184
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java728
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/RemoveOrphanViewPolicy.java34
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java517
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeRelatedSelectionEditPolicy.java39
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/CoRegionCombinedFragmentFigure.java129
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/CombinedFragmentFigure.java56
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/DestructionEventFigure.java66
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/EllipseDecoration.java51
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionOperandFigure.java45
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionUseRectangleFigure.java59
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineDotLineCustomFigure.java188
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/CenterLocator.java232
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/ContinuationLocator.java83
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/TimeMarkElementPositionLocator.java386
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java120
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java146
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java198
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java111
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java273
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java122
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPolicyProvider.java94
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/service/DurationCreationTool.java471
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentDeleteHelper.java323
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CommandHelper.java1203
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/DestructionOccurrenceUtil.java71
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/EventHelper.java234
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/HighlightUtil.java272
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/InteractionOperatorKindCompatibleMapping.java40
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/InteractionUseUtil.java49
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineCoveredByUpdater.java138
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineLabelHelper.java170
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java263
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineModelChildrenHelper.java90
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineResizeHelper.java106
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LoopOperatorUtil.java53
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/MessageStyleElementFactory.java56
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/NotificationHelper.java74
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java1126
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java837
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/PreferencesModelElementFactory.java14
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/ReconnectMessageHelper.java182
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SelectOrCreateDialog.java647
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceDeleteHelper.java371
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceLinkMappingHelper.java126
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceRequestConstant.java54
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java1713
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/FragmentOrderingKeeper.java823
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/UMLValidationHelper.java106
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/incomingLinksNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/linkSourceNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/linkTargetNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/linksNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/obj16/Diagram_Sequence.gifbin0 -> 92 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/obj16/UMLDiagramFile.gifbin0 -> 339 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/outgoingLinksNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/icons/wizban/NewUMLWizard.gifbin0 -> 2466 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/messages.properties201
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/prop/Environment.xmi12
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/prop/seq.ctx59
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/prop/ui/CombinedFragmentTitle.xwt9
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/prop/ui/ConsiderIgnoreFragmentTitle.xwt9
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/prop/ui/MessageStyle.xwt32
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/sequenceDiagram.gmfgen7475
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/sequenceDiagram.gmfgraph912
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/sequenceDiagram.gmfmap1066
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/sequenceDiagram.gmftool376
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/model/sequenceDiagram.trace221
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/plugin.properties78
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/plugin.xml1533
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/Activator.java65
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java137
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java133
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java135
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java146
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentAnnotatedElementCreateCommand.java106
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentAnnotatedElementReorientCommand.java169
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java129
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java170
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintConstrainedElementCreateCommand.java106
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintConstrainedElementReorientCommand.java169
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java138
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java154
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java130
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java176
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java128
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java191
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/GeneralOrderingCreateCommand.java186
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/GeneralOrderingReorientCommand.java157
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java138
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java193
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java138
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java191
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message2CreateCommand.java191
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message2ReorientCommand.java171
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message3CreateCommand.java184
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message3ReorientCommand.java171
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message4CreateCommand.java184
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message4ReorientCommand.java173
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message5CreateCommand.java247
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message5ReorientCommand.java171
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message6CreateCommand.java183
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message6ReorientCommand.java174
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message7CreateCommand.java183
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/Message7ReorientCommand.java174
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/MessageCreateCommand.java185
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/MessageReorientCommand.java179
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java130
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java168
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java175
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/UMLReorientConnectionViewCommand.java80
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/ActionExecutionSpecificationEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java195
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/BehaviorExecutionSpecificationEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/CombinedFragmentEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/CommentEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/ConsiderIgnoreFragmentEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/ConstraintEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/ContinuationEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/DestructionEventEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/DurationConstraintEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/DurationConstraintInMessageEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/DurationObservationEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/GeneralOrderingEditHelper.java7
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/InteractionEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/InteractionOperandEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/InteractionUseEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/LifelineEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/MessageEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/MessageOccurrenceSpecificationEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/PackageEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/StateInvariantEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/TimeConstraintEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/TimeObservationEditHelper.java20
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/UMLBaseEditHelper.java110
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ActionExecutionSpecificationEditPart.java1120
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ActionExecutionSpecificationNameEditPart.java753
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java1117
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragment2EditPart.java1033
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentCombinedFragmentCompartmentEditPart.java277
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java1733
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CommentAnnotatedElementEditPart.java101
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CommentBodyEditPart.java758
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CommentEditPart.java1144
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConsiderIgnoreFragmentEditPart.java1113
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Constraint2EditPart.java759
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConstraintConstrainedElementEditPart.java101
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConstraintEditPart.java1185
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConstraintNameEditPart.java757
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ContinuationEditPart.java1144
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ContinuationNameEditPart.java778
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DestructionOccurrenceSpecificationEditPart.java1042
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintAppliedStereotypeEditPart.java777
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintEditPart.java1335
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageAppliedStereotypeEditPart.java777
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageEditPart.java1237
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageLabelEditPart.java772
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintLabelEditPart.java771
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationAppliedStereotypeEditPart.java777
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationEditPart.java1157
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationLabelEditPart.java773
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GeneralOrderingAppliedStereotypeEditPart.java730
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GeneralOrderingEditPart.java258
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionEditPart.java1351
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionInteractionCompartmentEditPart.java144
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionNameEditPart.java756
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandEditPart.java1879
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionUseEditPart.java1351
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionUseName2EditPart.java758
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionUseNameEditPart.java750
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java2286
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineNameEditPart.java768
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Message2EditPart.java269
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Message3EditPart.java271
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Message4EditPart.java272
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Message5EditPart.java273
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Message6EditPart.java278
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/Message7EditPart.java286
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageAsyncAppliedStereotypeEditPart.java723
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageCreateAppliedStereotypeEditPart.java723
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageDeleteAppliedStereotypeEditPart.java723
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageEditPart.java276
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageEndEditPart.java664
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageFoundAppliedStereotypeEditPart.java743
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageLostAppliedStereotypeEditPart.java723
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageName2EditPart.java722
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageName3EditPart.java722
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageName4EditPart.java736
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageName5EditPart.java722
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageName6EditPart.java722
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageName7EditPart.java722
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageNameEditPart.java722
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageReplyAppliedStereotypeEditPart.java723
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageSyncAppliedStereotypeEditPart.java723
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ObservationLinkEditPart.java202
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/PackageEditPart.java186
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/StateInvariantEditPart.java1235
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/StateInvariantNameEditPart.java778
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/TimeConstraintAppliedStereotypeEditPart.java777
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/TimeConstraintEditPart.java1248
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/TimeConstraintLabelEditPart.java771
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/TimeObservationAppliedStereotypeEditPart.java777
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/TimeObservationEditPart.java1171
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/TimeObservationLabelEditPart.java944
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/UMLEditPartFactory.java410
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ActionExecutionSpecificationItemSemanticEditPolicy.java276
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/BehaviorExecutionSpecificationItemSemanticEditPolicy.java275
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragment2ItemSemanticEditPolicy.java225
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCombinedFragmentCompartmentCanonicalEditPolicy.java172
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java102
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentItemSemanticEditPolicy.java215
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java60
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CommentItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ConsiderIgnoreFragmentItemSemanticEditPolicy.java210
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java59
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ConstraintItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ContinuationItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicy.java223
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DurationConstraintInMessageItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DurationConstraintItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DurationObservationItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/GeneralOrderingItemSemanticEditPolicy.java188
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCanonicalEditPolicy.java186
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionInteractionCompartmentCanonicalEditPolicy.java201
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java71
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java219
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandCanonicalEditPolicy.java195
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandItemSemanticEditPolicy.java299
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionUseItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineCanonicalEditPolicy.java204
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java290
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineSelectionEditPolicy.java286
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/Message2ItemSemanticEditPolicy.java230
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/Message3ItemSemanticEditPolicy.java228
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/Message4ItemSemanticEditPolicy.java233
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/Message5ItemSemanticEditPolicy.java228
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/Message6ItemSemanticEditPolicy.java228
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/Message7ItemSemanticEditPolicy.java228
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageItemSemanticEditPolicy.java228
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OpenDiagramEditPolicy.java197
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/PackageCanonicalEditPolicy.java592
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java79
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/StateInvariantItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeConstraintItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeObservationItemSemanticEditPolicy.java212
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UMLBaseItemSemanticEditPolicy.java693
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UMLTextNonResizableEditPolicy.java236
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UMLTextSelectionEditPolicy.java220
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/expressions/UMLAbstractExpression.java166
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/expressions/UMLOCLFactory.java181
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLAbstractNavigatorItem.java71
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLDomainNavigatorContentProvider.java230
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLDomainNavigatorItem.java119
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLDomainNavigatorLabelProvider.java107
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorActionProvider.java181
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorContentProvider.java2549
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorGroup.java110
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorItem.java97
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorLabelProvider.java741
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorLinkHelper.java128
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/navigator/UMLNavigatorSorter.java40
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/parsers/AbstractParser.java431
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/parsers/MessageFormatParser.java202
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/DeleteElementAction.java4
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/DiagramEditorContextMenuProvider.java62
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/LoadResourceAction.java43
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/Messages.java1031
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/ModelElementSelectionPage.java156
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLCreationWizard.java167
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLCreationWizardPage.java96
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramActionBarContributor.java60
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java567
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditorPlugin.java343
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditorUtil.java378
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramUpdateCommand.java91
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramUpdater.java2518
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDocumentProvider.java988
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLInitDiagramFileAction.java99
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLLinkDescriptor.java105
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLMatchingStrategy.java47
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLNewDiagramFileWizard.java174
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLNodeDescriptor.java55
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLPaletteFactory.java697
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLUriEditorInputTester.java35
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java962
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/part/ValidateAction.java254
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/ActionExecutionSpecificationPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/BehaviorExecutionSpecificationPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CombinedFragmentPreferencePage.java94
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/CommentPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/ConsiderIgnoreFragmentPreferencePage.java95
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/ConstraintPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/ContinuationPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DestructionEventPreferencePage.java65
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DestructionOccurrenceSpecificationPreferencePage.java51
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DiagramAppearancePreferencePage.java31
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DiagramConnectionsPreferencePage.java31
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DiagramGeneralPreferencePage.java33
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DiagramPreferenceInitializer.java84
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DiagramPrintingPreferencePage.java31
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DiagramRulersAndGridPreferencePage.java31
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DurationConstraintInMessagePreferencePage.java52
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DurationConstraintPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/DurationObservationPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/GeneralOrderingPreferencePage.java36
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/InteractionOperandPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/InteractionPreferencePage.java118
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/InteractionUsePreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/LifelinePreferencePage.java222
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/MessageOccurrenceSpecificationPreferencePage.java40
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/MessagePreferencePage.java214
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/StateInvariantPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/TimeConstraintPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/preferences/TimeObservationPreferencePage.java64
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/ElementInitializers.java613
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLEditPartProvider.java158
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLElementTypes.java525
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLIconProvider.java44
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLMarkerNavigationProvider.java81
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLModelingAssistantProvider.java527
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLParserProvider.java751
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLValidationDecoratorProvider.java59
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLValidationProvider.java322
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLViewProvider.java1435
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/sheet/UMLPropertySection.java123
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/src/org/eclipse/papyrus/uml/diagram/sequence/sheet/UMLSheetLabelProvider.java91
375 files changed, 128979 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.classpath b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.classpath
new file mode 100644
index 00000000000..0a6d19dd7e7
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="custom-src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+ <accessrules>
+ <accessrule kind="nonaccessible" pattern="javax/swing/**"/>
+ <accessrule kind="discouraged" pattern="java/awt/**"/>
+ <accessrule kind="discouraged" pattern="org/eclipse/swt/layout/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.options b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.options
new file mode 100644
index 00000000000..e280f1a9a6b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.options
@@ -0,0 +1,7 @@
+# Tracing options for the org.eclipse.papyrus.uml.diagram.sequence plug-in
+
+# Common issues
+org.eclipse.papyrus.uml.diagram.sequence/debug=false
+
+# Visual IDs
+org.eclipse.papyrus.uml.diagram.sequence/debug/visualID=false
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.project b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.project
new file mode 100644
index 00000000000..d7d275116ac
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.diagram.sequence</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..653db0f115c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Aug 05 15:49:35 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/sequenceDiagram.gmfgen.prefs b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/sequenceDiagram.gmfgen.prefs
new file mode 100644
index 00000000000..4d17984eb1a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/.settings/sequenceDiagram.gmfgen.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+generate_rcp=false
+ignore_gmfgen_validation=true
+ignore_mapmodel_validation=true
+use_map_mode=true
+use_runtime_figures=true
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..67422fbcb57
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/META-INF/MANIFEST.MF
@@ -0,0 +1,63 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.sequence,
+ org.eclipse.papyrus.uml.diagram.sequence.edit.parts,
+ org.eclipse.papyrus.uml.diagram.sequence.edit.policies,
+ org.eclipse.papyrus.uml.diagram.sequence.part,
+ org.eclipse.papyrus.uml.diagram.sequence.providers
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.expressions,
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.0",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
+ org.eclipse.jface,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.gmf.runtime.draw2d.ui,
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.0",
+ org.eclipse.gmf.runtime.notation,
+ org.eclipse.papyrus.uml.service.types;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.appearance;bundle-version="0.10.0",
+ org.eclipse.ocl.ecore;bundle-version="3.2.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.0",
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.emf.databinding;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.0",
+ org.eclipse.papyrus.views.properties;bundle-version="0.10.0",
+ org.eclipse.papyrus.views.properties.model;bundle-version="0.10.0"
+Bundle-Vendor: %providerName
+Eclipse-LazyStart: true
+Bundle-Version: 0.10.0.qualifier
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDia
+ gramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence;singleto
+ n:=true
+
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/about.html b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/build.properties b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/build.properties
new file mode 100644
index 00000000000..607bca21e83
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/build.properties
@@ -0,0 +1,16 @@
+#
+#Mon Sep 12 09:29:49 CEST 2011
+bin.includes = META-INF/,\
+ .,\
+ .options,\
+ icons/,\
+ messages.properties,\
+ plugin.properties,\
+ plugin.xml,\
+ about.html,\
+ model/prop/
+output..=bin/
+jars.compile.order=.
+src.includes = about.html
+source..=src/,custom-src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramCommand.java
new file mode 100644
index 00000000000..03e5c385d8c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramCommand.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.papyrus.uml.diagram.common.commands.CreateBehavioredClassifierDiagramCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * 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.
+ */
+public class CreateSequenceDiagramCommand extends CreateBehavioredClassifierDiagramCommand {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDiagramNotationID() {
+ return PackageEditPart.MODEL_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected PreferencesHint getPreferenceHint() {
+ return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDefaultDiagramName() {
+ return "SeqDiagram"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected EClass getBehaviorEClass() {
+ return UMLPackage.eINSTANCE.getInteraction();
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java
new file mode 100644
index 00000000000..4b2f56c87c2
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence;
+
+import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
+
+
+public class CreateSequenceDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
+
+ public CreateSequenceDiagramWithNavigationHandler() {
+ super(new CreateSequenceDiagramCommand(), new SequenceDiagramCreationCondition());
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/ObservationLinkMetamodelType.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/ObservationLinkMetamodelType.java
new file mode 100644
index 00000000000..b1b26cd645b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/ObservationLinkMetamodelType.java
@@ -0,0 +1,38 @@
+package org.eclipse.papyrus.uml.diagram.sequence;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.MetamodelType;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
+import org.eclipse.gmf.runtime.emf.type.core.internal.descriptors.MetamodelTypeDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.internal.l10n.EMFTypeCoreMessages;
+
+public class ObservationLinkMetamodelType extends MetamodelType {
+
+ public static final String ID = "org.eclipse.papyrus.uml.diagram.sequence.emf.type.core.observationlink"; //$NON-NLS-1$
+
+ private static final ObservationLinkMetamodelType INSTANCE = new ObservationLinkMetamodelType();
+ private static final MetamodelTypeDescriptor DESCRIPTOR_INSTANCE = new MetamodelTypeDescriptor(
+ INSTANCE);
+
+ /**
+ * Initializes me.
+ */
+ private ObservationLinkMetamodelType() {
+ super(ID, null, EMFTypeCoreMessages.defaultEditHelper_name,
+ EcorePackage.Literals.EOBJECT, new DefaultEditHelper());
+ }
+
+ public static ObservationLinkMetamodelType getInstance() {
+ return INSTANCE;
+ }
+
+ public static MetamodelTypeDescriptor getDescriptorInstance() {
+ return DESCRIPTOR_INSTANCE;
+ }
+
+ private static class DefaultEditHelper extends AbstractEditHelper {
+ DefaultEditHelper() {
+ super();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java
new file mode 100644
index 00000000000..51c75bae096
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ * 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;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
+import org.eclipse.uml2.uml.Interaction;
+
+/**
+ * SequenceDiagramCreationCondition class allows to check if a Sequence diagram can be added to the
+ * selected element.
+ */
+public class SequenceDiagramCreationCondition extends PerspectiveContextDependence {
+
+ /**
+ * @return whether the diagram can be created.
+ */
+ public boolean create(EObject selectedElement) {
+ if(super.create(selectedElement)) {
+ // TODO : to specify according to the spec
+ return selectedElement instanceof Interaction;
+ }
+ return false;
+ }
+
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramEditorFactory.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramEditorFactory.java
new file mode 100644
index 00000000000..32c702571bb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramEditorFactory.java
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.PackageEditPart;
+
+/**
+ * The editor factory to launch the sequence diagram.
+ */
+public class SequenceDiagramEditorFactory extends GmfEditorFactory {
+
+ /**
+ * Instantiates a new sequence diagram editor factory.
+ */
+ public SequenceDiagramEditorFactory() {
+ super(UmlSequenceDiagramForMultiEditor.class, PackageEditPart.MODEL_ID);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java
new file mode 100644
index 00000000000..21941bf46e5
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/UmlSequenceDiagramForMultiEditor.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+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.PartInitException;
+
+/**
+ * Editor used in multitabs editor.
+ */
+public class UmlSequenceDiagramForMultiEditor extends UMLDiagramEditor {
+
+ /**
+ * The location of diagram icon in the plug-in
+ */
+ private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Sequence.gif";
+
+ /**
+ * The image descriptor of the diagram icon
+ */
+ private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlSequenceDiagramForMultiEditor.DIAG_IMG_PATH);
+
+ /** The editor splitter. */
+ private Composite splitter;
+
+ /**
+ * Constructor for SashSystem v2. Context and required objects are retrieved from the
+ * ServiceRegistry.
+ *
+ * @throws BackboneException
+ * @throws ServiceException
+ */
+ public UmlSequenceDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
+ super(servicesRegistry, diagram);
+
+ }
+
+ /**
+ * {@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 {
+ // Provide an URI with fragment in order to reuse the same Resource
+ // and set the diagram to the fragment.
+ URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
+ doSetInput(uriInput, true);
+ } catch (CoreException x) {
+ String title = "Problem opening";
+ String msg = "Cannot open input element:";
+ Shell shell = getSite().getShell();
+ ErrorDialog.openError(shell, title, msg, x.getStatus());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createGraphicalViewer(Composite parent) {
+ splitter = parent;
+ super.createGraphicalViewer(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFocus() {
+ splitter.setFocus();
+ super.setFocus();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getEditingDomainID() {
+ return "org.eclipse.papyrus.uml.diagram.sequence.EditingDomain";
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ChangeEdgeTargetCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ChangeEdgeTargetCommand.java
new file mode 100644
index 00000000000..2fe630f70dd
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ChangeEdgeTargetCommand.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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.command;
+
+import org.eclipse.core.commands.ExecutionException;
+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.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+
+
+/**
+ * Command used to change the target of an edge.
+ * It create an IdentityAnchor to attach the edge.
+ *
+ * @author Mathieu Velten
+ *
+ */
+public class ChangeEdgeTargetCommand extends AbstractTransactionalCommand {
+
+ protected CreateElementAndNodeCommand createElementAndNodeCommand;
+
+ protected ConnectionViewDescriptor descriptor;
+
+ protected String anchorId;
+
+ /**
+ *
+ * @param editingDomain
+ * the editing domain.
+ * @param createElementAndNodeCommand
+ * used to retrieve the target new node of the edge.
+ * @param descriptor
+ * used to retrieve the edge.
+ * @param anchorId
+ * the identity of the anchor which will be created to attach the edge.
+ */
+ public ChangeEdgeTargetCommand(TransactionalEditingDomain editingDomain, CreateElementAndNodeCommand createElementAndNodeCommand, ConnectionViewDescriptor descriptor, String anchorId) {
+ super(editingDomain, "Change message graphical target", null);
+ this.createElementAndNodeCommand = createElementAndNodeCommand;
+ this.descriptor = descriptor;
+ this.anchorId = anchorId;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ // retrieve the edge from the descriptor
+ Object obj = descriptor.getAdapter(Edge.class);
+
+ if(obj instanceof Edge) {
+ Edge edge = (Edge)obj;
+ edge.setTarget(createElementAndNodeCommand.getCreatedView());
+
+ IdentityAnchor anchor = NotationFactory.eINSTANCE.createIdentityAnchor();
+ anchor.setId(anchorId);
+
+ edge.setTargetAnchor(anchor);
+ }
+ return null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java
new file mode 100644
index 00000000000..2a65a13a786
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java
@@ -0,0 +1,185 @@
+/*****************************************************************************
+ * 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.command;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+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.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+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.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Command to create an element and its associated view.
+ *
+ * @author Mathieu Velten
+ *
+ */
+public class CreateElementAndNodeCommand extends AbstractTransactionalCommand {
+
+ protected ShapeNodeEditPart nodeEditPart;
+
+ protected Point location;
+
+ protected EObject parent, element;
+
+ protected TransactionalEditingDomain editingDomain;
+
+ protected Command elementCreationCommand;
+
+ protected Command nodeCreationCommand;
+
+ protected Map<String, Object> createElementRequestParameters = new HashMap<String, Object>();
+
+ protected IHintedType elementType;
+
+ protected CreateViewRequest createViewRequest;
+
+ private List affectedFiles;
+
+ /**
+ *
+ * @param editingDomain
+ * editingDomain the editing domain.
+ * @param nodeEditPart
+ * the editpart of the graphical parent of the node to create.
+ * @param parent
+ * the parent of the element to create.
+ * @param elementType
+ * the GMF type of the element which will be created.
+ * @param location
+ * the location where to create the element figure.
+ */
+ public CreateElementAndNodeCommand(TransactionalEditingDomain editingDomain, ShapeNodeEditPart nodeEditPart, EObject parent, IHintedType elementType, Point location) {
+ super(editingDomain, "Create element and node command", null);
+ this.nodeEditPart = nodeEditPart;
+ this.location = location;
+ this.parent = parent;
+ this.editingDomain = editingDomain;
+ this.elementType = elementType;
+ }
+
+ public List getAffectedFiles() {
+ if (affectedFiles == null) {
+ if (getCreatedView() != null) {
+ affectedFiles = getWorkspaceFiles(getCreatedView());
+ } else {
+ affectedFiles = super.getAffectedFiles();
+ }
+ }
+ return affectedFiles;
+ }
+
+ /**
+ * put a parameter which will be add to the parameters of the element creation request.
+ *
+ * @param key
+ * @param value
+ */
+ public void putCreateElementRequestParameter(String key, Object value) {
+ createElementRequestParameters.put(key, value);
+ }
+
+ /**
+ * retrieve the view associated with the created execution specification
+ *
+ * @return the view or null if not created/founded
+ */
+ public View getCreatedView() {
+ if(createViewRequest != null) {
+ List l = (List)createViewRequest.getNewObject();
+ if(!l.isEmpty() && l.get(0) instanceof ViewDescriptor) {
+ return (View)((ViewDescriptor)l.get(0)).getAdapter(View.class);
+ }
+ }
+ return null;
+ }
+
+ public void undo() {
+ if(nodeCreationCommand != null && nodeCreationCommand.canUndo()) {
+ nodeCreationCommand.undo();
+ }
+ if(elementCreationCommand != null && elementCreationCommand.canUndo()) {
+ elementCreationCommand.undo();
+ }
+ }
+
+ /**
+ * Create the element in the model.
+ *
+ * @return the element.
+ */
+ protected EObject createModelElement() {
+
+ CreateElementRequest req = new CreateElementRequest(editingDomain, parent, elementType);
+ req.addParameters(createElementRequestParameters);
+
+ elementCreationCommand = nodeEditPart.getCommand(new EditCommandRequestWrapper(req));
+
+ if(elementCreationCommand != null) {
+ elementCreationCommand.execute();
+ EObject result = req.getNewElement();
+ if(result instanceof EObject) {
+ return (EObject)result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create and execute the command to create the associated view.
+ * The element needs to be created first using createModelElement.
+ */
+ protected void createElementView() {
+ if(nodeEditPart != null) {
+ // check if execution specification is already drawn
+ if(getCreatedView() == null) {
+ ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter((EObject)element), Node.class, elementType.getSemanticHint(), nodeEditPart.getDiagramPreferencesHint());
+ createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(location);
+ nodeCreationCommand = nodeEditPart.getCommand(createViewRequest);
+ if(nodeCreationCommand != null && nodeCreationCommand.canExecute()) {
+ nodeCreationCommand.execute();
+ }
+ }
+ }
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ element = createModelElement();
+ // create the view for the execution specification
+ if(element != null) {
+ createElementView();
+ }
+ return CommandResult.newOKCommandResult();
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateLocatedConnectionViewCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateLocatedConnectionViewCommand.java
new file mode 100644
index 00000000000..5e180818161
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateLocatedConnectionViewCommand.java
@@ -0,0 +1,239 @@
+package org.eclipse.papyrus.uml.diagram.sequence.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+
+/**
+ * This class is used to create a connection view which source and target locations are defined. This is useful for connections linked to an
+ * Occurrence Specification, which is located at a particular predefined point.
+ *
+ * @author vhemery
+ */
+public class CreateLocatedConnectionViewCommand extends CommonDeferredCreateConnectionViewCommand {
+
+ /** Point where source must be drawn */
+ private Point sourceLocation;
+
+ /** Point where target must be drawn */
+ private Point targetLocation;
+
+ /**
+ * {@inheritDoc}
+ */
+ public CreateLocatedConnectionViewCommand(TransactionalEditingDomain editingDomain, String semanticHint, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter, EditPartViewer viewer, PreferencesHint preferencesHint, ConnectionViewDescriptor viewDescriptor, ICommand command) {
+ super(editingDomain, semanticHint, sourceViewAdapter, targetViewAdapter, viewer, preferencesHint, viewDescriptor, command);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public CreateLocatedConnectionViewCommand(TransactionalEditingDomain editingDomain, EObject element, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter, EditPartViewer viewer, PreferencesHint preferencesHint, ICommand command) {
+ super(editingDomain, element, sourceViewAdapter, targetViewAdapter, viewer, preferencesHint, command);
+ }
+
+ /**
+ * Creates a connection view between the source and target.
+ *
+ * @throws ExecutionException
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info, IGraphicalEditPart sourceEditPart, IGraphicalEditPart targetEditPart) throws ExecutionException {
+
+ // If these are null, then the diagram's editparts may not
+ // have been refreshed yet.
+ Assert.isNotNull(sourceEditPart);
+ Assert.isNotNull(targetEditPart);
+
+ // use the String semanticHint to create a view
+ // modification in order to fix the bug
+ CreateConnectionViewRequest createRequest = new CreateConnectionViewRequest(viewDescriptor);
+ createConnectionCmd = getCreateCommand(createRequest, sourceEditPart, targetEditPart);
+
+ if(createConnectionCmd != null && createConnectionCmd.canExecute()) {
+ createConnectionCmd.execute();
+ if(element != null) {
+ ((View)(createRequest.getConnectionViewDescriptor().getAdapter(View.class))).setElement(element);
+ }
+ } else {
+ // connection can not be created
+ handleErrorMessage(createRequest, sourceEditPart, targetEditPart);
+ }
+ viewer = null;// for garbage collection
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * Method getCreateCommand Gets the command given a request, source and target edit parts. (No semantic element required.)
+ * This method is similar to {@link CreateConnectionViewRequest#getCreateCommand(CreateConnectionViewRequest, EditPart, EditPart)}, except it
+ * fixes source and target locations
+ *
+ * @param request
+ * creation request
+ * @param sourceEditPart
+ * source edit part
+ * @param targetEditPart
+ * target edit part
+ * @return <code>Command</code> to create the connection at appropriate locations
+ */
+ protected Command getCreateCommand(CreateConnectionViewRequest request, EditPart sourceEditPart, EditPart targetEditPart) {
+ EditPart newSourceEditPart = sourceEditPart;
+ // set appropriated source edit part
+ if(sourceEditPart instanceof LifelineEditPart && sourceLocation != null) {
+ newSourceEditPart = SequenceUtil.findPartToReconnectTo((LifelineEditPart)sourceEditPart, sourceLocation);
+ }
+ EditPart newTargetEditPart = targetEditPart;
+ // set appropriated target edit part
+ if(targetEditPart instanceof LifelineEditPart && targetLocation != null) {
+ newTargetEditPart = SequenceUtil.findPartToReconnectTo((LifelineEditPart)targetEditPart, targetLocation);
+ }
+
+ Assert.isNotNull(request);
+ Assert.isNotNull(sourceEditPart);
+ Assert.isNotNull(targetEditPart);
+ Assert.isNotNull(newSourceEditPart);
+ Assert.isNotNull(newTargetEditPart);
+
+ request.setSourceEditPart(sourceEditPart);
+ request.setTargetEditPart(targetEditPart);
+
+ request.setType(RequestConstants.REQ_CONNECTION_START);
+ // set source location
+ request.setLocation(sourceLocation);
+ newSourceEditPart.getCommand(request);
+
+ request.setType(RequestConstants.REQ_CONNECTION_END);
+ // set target location
+ request.setLocation(targetLocation);
+ return newTargetEditPart.getCommand(request);
+ }
+
+ /**
+ * Set the locations where source and target points must be drawn.
+ *
+ * @param sourcePoint
+ * point where to draw source or null
+ * @param targetPoint
+ * point where to draw target or null
+ */
+ public void setLocations(Point sourcePoint, Point targetPoint) {
+ sourceLocation = sourcePoint;
+ targetLocation = targetPoint;
+ }
+
+ /**
+ * Handle the failure by reporting an adequate error message
+ *
+ * @param createRequest
+ * the creation request that didn't success
+ * @param sourceEditPart
+ * the link source edit part
+ * @param targetEditPart
+ * the target source edit part
+ */
+ private void handleErrorMessage(CreateConnectionViewRequest createRequest, IGraphicalEditPart sourceEditPart, IGraphicalEditPart targetEditPart) {
+ String hint = createRequest.getConnectionViewDescriptor().getSemanticHint();
+ boolean isMessage = isMessageHint(hint);
+ boolean uphill = sourceLocation != null && targetLocation != null && sourceLocation.y > targetLocation.y;
+ if(isMessage && uphill) {
+ reportCanNotDropUphillMessage(sourceLocation.y - targetLocation.y, sourceEditPart, targetEditPart);
+ } else {
+ reportDefaultMessage(sourceEditPart, targetEditPart);
+ }
+ }
+
+ /**
+ * Test if hint is for a message creation
+ *
+ * @param hint
+ * hint to test
+ * @return true if message hint
+ */
+ private boolean isMessageHint(String hint) {
+ List<String> messageHints = new ArrayList<String>(7);
+ String messageHint = ((IHintedType)UMLElementTypes.Message_4003).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4004).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4005).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4006).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4007).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4008).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4009).getSemanticHint();
+ messageHints.add(messageHint);
+ return messageHints.contains(hint);
+ }
+
+ /**
+ * Report a message telling that the message can not be dropped because it goes uphill.
+ *
+ * @param delta
+ * the missing delta between the two lifelines
+ * @param sourceEditPart
+ * the source of the message
+ * @param targetEditPart
+ * the target of the message
+ */
+ private void reportCanNotDropUphillMessage(int delta, IGraphicalEditPart sourceEditPart, IGraphicalEditPart targetEditPart) {
+ EObject source = sourceEditPart.resolveSemanticElement();
+ String sourceText = EMFCoreUtil.getQualifiedName(source, true);
+ EObject target = targetEditPart.resolveSemanticElement();
+ String targetText = EMFCoreUtil.getQualifiedName(target, true);
+ String txt = NLS.bind(Messages.DropError_UphillMessageTxt, new Object[]{ sourceText, targetText, delta });
+ NotificationBuilder notif = NotificationBuilder.createAsyncPopup(Messages.DropError_UphillMessageTitle, txt);
+ notif.setType(Type.WARNING);
+ notif.run();
+ }
+
+ /**
+ * Report a message telling that the link drop unexpectedly failed.
+ *
+ * @param sourceEditPart
+ * the source of the link
+ * @param targetEditPart
+ * the target of the link
+ */
+ private void reportDefaultMessage(IGraphicalEditPart sourceEditPart, IGraphicalEditPart targetEditPart) {
+ EObject source = sourceEditPart.resolveSemanticElement();
+ String sourceText = EMFCoreUtil.getQualifiedName(source, true);
+ EObject target = targetEditPart.resolveSemanticElement();
+ String targetText = EMFCoreUtil.getQualifiedName(target, true);
+ String txt = NLS.bind(Messages.DropError_DefaultTxt, sourceText, targetText);
+ NotificationBuilder notif = NotificationBuilder.createAsyncPopup(Messages.DropError_DefaultTitle, txt);
+ notif.setType(Type.ERROR);
+ notif.run();
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeObservationCreateCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeObservationCreateCommand.java
new file mode 100644
index 00000000000..df47c81eb18
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeObservationCreateCommand.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * 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.command;
+
+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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.TimeObservation;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * Command for creating time observation element
+ *
+ */
+public class CustomTimeObservationCreateCommand extends EditElementCommand {
+ private EClass eClass = null;
+
+ private EObject eObject = null;
+
+ public CustomTimeObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ public static CustomTimeObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
+ return new CustomTimeObservationCreateCommand(req, eObject);
+ }
+
+ public CustomTimeObservationCreateCommand(CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if(container instanceof View) {
+ container = ((View)container).getElement();
+ }
+ if(container != null) {
+ return container;
+ }
+ return eObject;
+ }
+
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
+
+ // get the parent package as owner
+ EObject container = getElementToEdit();
+ while(container != null && !(container instanceof Package)) {
+ container = container.eContainer();
+ }
+ if(container == null) {
+ return CommandResult.newCancelledCommandResult();
+ }
+ Package owner = (Package)container;
+ owner.getPackagedElements().add(newElement);
+
+ ElementInitializers.getInstance().init_TimeObservation_3020(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if(configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomZOrderCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomZOrderCommand.java
new file mode 100644
index 00000000000..3639ea8225b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomZOrderCommand.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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.command;
+
+import org.eclipse.core.commands.ExecutionException;
+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.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * ZOrder command with a custom index
+ */
+public class CustomZOrderCommand extends AbstractTransactionalCommand {
+
+ protected View view;
+
+ protected View containerView;
+
+ private int index;
+
+ /**
+ * @param editingDomain
+ * the editing domain through which model changes are made
+ * @param label
+ * @param view
+ */
+ public CustomZOrderCommand(TransactionalEditingDomain editingDomain, View view, int index) {
+ super(editingDomain, "change ZOrder", getWorkspaceFiles(view));
+
+ this.view = view;
+ this.index = index;
+ containerView = ViewUtil.getContainerView(view);
+
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ ViewUtil.repositionChildAt(containerView, view, index);
+ return CommandResult.newOKCommandResult();
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java
new file mode 100644
index 00000000000..52474d3a6d1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java
@@ -0,0 +1,139 @@
+package org.eclipse.papyrus.uml.diagram.sequence.command;
+
+import java.util.ArrayList;
+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.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateOrSelectElementCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.InteractionFragment;
+
+public class PromptCreateElementAndNodeCommand extends
+ CreateOrSelectElementCommand {
+ private static final List<IElementType> executionTypes = new ArrayList<IElementType>();
+ static {
+ executionTypes.add(UMLElementTypes.ActionExecutionSpecification_3006);
+ executionTypes.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
+ }
+ private final CompoundCommand command;
+ private TransactionalEditingDomain editingDomain;
+ private ConnectionViewDescriptor descriptor;
+ private ShapeNodeEditPart targetEP;
+ private EObject target;
+ private Point location;
+ private InteractionFragment container;
+ private CreateConnectionRequest request;
+ private EditPart sourceEP;
+
+ public PromptCreateElementAndNodeCommand(Command createCommand,
+ TransactionalEditingDomain editingDomain,
+ ConnectionViewDescriptor descriptor, ShapeNodeEditPart targetEP,
+ EObject target, EditPart sourceEP, CreateConnectionRequest request, InteractionFragment container) {
+ super(Display.getCurrent().getActiveShell(), executionTypes);
+ this.editingDomain = editingDomain;
+ this.descriptor = descriptor;
+ this.targetEP = targetEP;
+ this.target = target;
+ this.sourceEP = sourceEP;
+ this.request = request;
+ this.location = request.getLocation();
+ this.container = container;
+ command = new CompoundCommand();
+ command.add(createCommand);
+ }
+
+ protected CommandResult doExecuteWithResult(
+ IProgressMonitor progressMonitor, IAdaptable info)
+ throws ExecutionException {
+ sourceEP.eraseSourceFeedback(request);
+ targetEP.eraseSourceFeedback(request);
+
+ CommandResult cmdResult = super.doExecuteWithResult(progressMonitor,
+ info);
+ if (!cmdResult.getStatus().isOK()) {
+ return cmdResult;
+ }
+ IHintedType connectionType = (IHintedType) cmdResult.getReturnValue();
+
+ CreateElementAndNodeCommand createExecutionSpecificationCommand = new CreateElementAndNodeCommand(
+ editingDomain, (ShapeNodeEditPart) targetEP, target,
+ connectionType, location);
+ createExecutionSpecificationCommand.putCreateElementRequestParameter(
+ SequenceRequestConstant.INTERACTIONFRAGMENT_CONTAINER,
+ container);
+ command.add(new ICommandProxy(createExecutionSpecificationCommand));
+
+ // put the anchor at the top of the figure
+ ChangeEdgeTargetCommand changeTargetCommand = new ChangeEdgeTargetCommand(
+ editingDomain, createExecutionSpecificationCommand, descriptor,
+ "(0.5, 0.0)");
+ command.add(new ICommandProxy(changeTargetCommand));
+
+ command.execute();
+
+ return CommandResult.newOKCommandResult(descriptor);
+ }
+
+ public boolean canUndo() {
+ return command != null && command.canUndo();
+ }
+
+ protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor,
+ IAdaptable info) throws ExecutionException {
+ if (command != null) {
+ command.redo();
+ }
+ return super.doRedoWithResult(progressMonitor, info);
+ }
+
+ protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor,
+ IAdaptable info) throws ExecutionException {
+ if (command != null) {
+ command.undo();
+ }
+ return super.doUndoWithResult(progressMonitor, info);
+ }
+
+ protected ILabelProvider getLabelProvider() {
+ return new LabelProvider() {
+
+ @Override
+ public String getText(Object object) {
+ if (object instanceof IHintedType) {
+ IHintedType elementType = (IHintedType) object;
+ switch (UMLVisualIDRegistry.getVisualID(elementType
+ .getSemanticHint())) {
+ case ActionExecutionSpecificationEditPart.VISUAL_ID:
+ return Messages.createActionExecutionSpecification2CreationTool_title;
+ case BehaviorExecutionSpecificationEditPart.VISUAL_ID:
+ return Messages.createBehaviorExecutionSpecification3CreationTool_title;
+ }
+ }
+ return super.getText(object);
+ }
+ };
+
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java
new file mode 100644
index 00000000000..a2c39fc6107
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java
@@ -0,0 +1,796 @@
+/*****************************************************************************
+ * 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.draw2d.routers;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+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.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Ray;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.OrthogonalConnectionAnchor;
+import org.eclipse.gmf.runtime.draw2d.ui.geometry.PointListUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter;
+import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.OrthogonalRouterUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart.LifelineFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart.MessageCreate;
+
+/**
+ * A multi behavior router which enable to draw message.
+ * It can behave as an oblique router (with no bendpoint), or as an horizontal router (with no bendpoint),
+ * or as a rectilinear router with 2 bendpoints.
+ *
+ * @author mvelten and vhemery
+ */
+@SuppressWarnings({ "restriction", "deprecation" })
+public class MessageRouter extends ObliqueRouter {
+
+ private static final int MAX_DELTA = 10;
+
+ public static enum RouterKind {
+ HORIZONTAL, OBLIQUE, SELF;
+
+ public static RouterKind getKind(Connection conn, PointList newLine) {
+ if(isSelfConnection(conn)) {
+ return SELF;
+ }
+ if(isHorizontalConnection(conn, newLine)) {
+ return HORIZONTAL;
+ }
+ return OBLIQUE;
+ }
+
+ private static boolean isHorizontalConnection(Connection conn, PointList newLine) {
+ if(!(conn instanceof Message2EditPart.MessageAsync)) {
+ return false;
+ }
+ Point sourcePoint = newLine.getFirstPoint();
+ Point targetPoint = newLine.getLastPoint();
+ return Math.abs(sourcePoint.y - targetPoint.y) <= MAX_DELTA;
+ }
+
+ /**
+ * It is self if the parent lifeline is the same.
+ */
+ private static boolean isSelfConnection(Connection conn) {
+ if(conn == null || conn.getSourceAnchor() == null || conn.getTargetAnchor() == null) {
+ return false;
+ }
+ IFigure sourceLifeline = conn.getSourceAnchor().getOwner();
+ while(sourceLifeline != null && !(sourceLifeline instanceof LifelineFigure)) {
+ sourceLifeline = sourceLifeline.getParent();
+ }
+ IFigure targetLifeline = conn.getTargetAnchor().getOwner();
+ while(targetLifeline != null && !(targetLifeline instanceof LifelineFigure)) {
+ targetLifeline = targetLifeline.getParent();
+ }
+
+ return sourceLifeline != null && sourceLifeline.equals(targetLifeline);
+ }
+ }
+
+ @Override
+ public void routeLine(Connection conn, int nestedRoutingDepth, PointList newLine) {
+ Point sourcePoint, targetPoint;
+ switch(RouterKind.getKind(conn, newLine)) {
+ case HORIZONTAL:
+ originalRectilinearRouteLine(conn, nestedRoutingDepth, newLine);
+
+ // force 2 bendpoints on the same Y coordinate
+ sourcePoint = newLine.getFirstPoint();
+ targetPoint = newLine.getLastPoint();
+ targetPoint.y = sourcePoint.y;
+ newLine.removeAllPoints();
+ newLine.addPoint(sourcePoint);
+ newLine.addPoint(targetPoint);
+ break;
+ case OBLIQUE:
+ super.routeLine(conn, nestedRoutingDepth, newLine);
+ adjustCreateEndpoint(conn, newLine);
+
+ // force 2 bendpoints only
+ if(newLine.size() > 2) {
+ sourcePoint = newLine.getFirstPoint();
+ targetPoint = newLine.getLastPoint();
+ newLine.removeAllPoints();
+ newLine.addPoint(sourcePoint);
+ newLine.addPoint(targetPoint);
+ }
+ break;
+ case SELF:
+ // Handle special routing: self connections and intersecting shapes connections
+ if(checkSelfRelConnection(conn, newLine)) {
+ super.resetEndPointsToEdge(conn, newLine);
+ OrthogonalRouterUtilities.transformToOrthogonalPointList(newLine, getOffShapeDirection(getAnchorOffRectangleDirection(newLine.getFirstPoint(), sourceBoundsRelativeToConnection(conn))), getOffShapeDirection(getAnchorOffRectangleDirection(newLine.getLastPoint(), targetBoundsRelativeToConnection(conn))));
+ removeRedundantPoints(newLine);
+ return;
+ }
+ break;
+ }
+ }
+
+ protected boolean checkShapesIntersect(Connection conn, PointList newLine) {
+ if(conn.getTargetAnchor().getOwner() instanceof AnchorHelper.CombinedFragmentNodeFigure){
+ return false;
+ }
+ return super.checkShapesIntersect(conn, newLine);
+ }
+
+ protected void adjustCreateEndpoint(Connection conn, PointList newLine) {
+ if(conn instanceof MessageCreate){
+ if(newLine.size() >= 2){
+ Point start = newLine.getFirstPoint();
+ Point end = newLine.getLastPoint();
+ if(start.y != end.y){
+ start.y = end.y;
+ newLine.setPoint(start, 0);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void getSelfRelVertices(Connection conn, PointList newLine) {
+
+ rectilinearResetEndPointsToEdge(conn, newLine);
+
+ IFigure owner = conn.getSourceAnchor().getOwner();
+ Point middle = owner.getBounds().getCenter();
+
+ // ensure that the end points are anchored properly to the shape.
+ Point ptS2 = newLine.getPoint(0);
+ Point ptS1 = conn.getSourceAnchor().getReferencePoint();
+ conn.translateToRelative(ptS1);
+ Point ptAbsS2 = new Point(ptS2);
+ conn.translateToAbsolute(ptAbsS2);
+ Point ptEdge = conn.getSourceAnchor().getLocation(ptAbsS2);
+ conn.translateToRelative(ptEdge);
+ ptS1 = getStraightEdgePoint(ptEdge, ptS1, ptS2);
+
+ Point ptE2 = newLine.getPoint(newLine.size() - 1);
+ Point ptE1 = conn.getTargetAnchor().getReferencePoint();
+ conn.translateToRelative(ptE1);
+ Point ptAbsE2 = new Point(ptE2);
+ conn.translateToAbsolute(ptAbsE2);
+ ptEdge = conn.getTargetAnchor().getLocation(ptAbsE2);
+ conn.translateToRelative(ptEdge);
+ ptE1 = getStraightEdgePoint(ptEdge, ptE1, ptE2);
+
+ newLine.removeAllPoints();
+ newLine.addPoint(ptS1);
+
+ // insert two points
+ Point extraPoint1 = ptS2.getTranslated(ptE2).scale(0.5);
+ if(isOnRightHand(conn, owner, middle)){
+ extraPoint1.translate(SELFRELSIZEINIT, 0);
+ } else {
+ extraPoint1.translate(-SELFRELSIZEINIT, 0);
+ }
+ Point extraPoint2 = extraPoint1.getCopy();
+
+ if(isFeedback(conn)) {
+ extraPoint1.y = ptS2.y;
+ extraPoint2.y = ptE2.y;
+ } else {
+ extraPoint1.y = ptS1.y;
+ extraPoint2.y = ptE1.y;
+ }
+ newLine.addPoint(extraPoint1);
+ newLine.addPoint(extraPoint2);
+
+ newLine.addPoint(ptE1);
+ }
+
+ protected boolean isOnRightHand(Connection conn, IFigure owner, Point middle) {
+ boolean right = true;
+ if(conn.getTargetAnchor() instanceof AnchorHelper.SideAnchor){
+ AnchorHelper.SideAnchor anchor = ( AnchorHelper.SideAnchor) conn.getTargetAnchor();
+ right = anchor.isRight();
+ }else{
+ PointList list = conn.getPoints();
+ if(list.getPoint(0).x > list.getPoint(1).x)
+ right = false;
+ }
+ return right;
+ }
+
+ @Override
+ protected boolean checkSelfRelConnection(Connection conn, PointList newLine) {
+ if(RouterKind.getKind(conn, newLine).equals(RouterKind.SELF)) {
+ getSelfRelVertices(conn, newLine);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * All the code after this comment is copied from RectilinearRouter and RouterHelper
+ *
+ * Copyright (c) 2002, 2010 IBM Corporation and others.
+ */
+
+ private void originalRectilinearRouteLine(Connection conn, int nestedRoutingDepth, PointList newLine) {
+
+ boolean skipNormalization = (routerFlags & ROUTER_FLAG_SKIPNORMALIZATION) != 0;
+
+ // if we are reorienting, then just default to the super class implementation and
+ // don't try to do rectilinear routing.
+ if(isReorienting(conn)) {
+ super.routeLine(conn, nestedRoutingDepth, newLine);
+ return;
+ }
+
+ /*
+ * Remove and store former anchor points. Anchor points will be re-calculated anyway.
+ * However, the old anchor points may be useful if connection didn't have any bend points
+ * except the anchor points.
+ */
+ Point lastStartAnchor = newLine.removePoint(0);
+ Point lastEndAnchor = newLine.removePoint(newLine.size() - 1);
+
+ /*
+ * Check if connection is rectilinear and if not make it rectilinear
+ */
+ if(!OrthogonalRouterUtilities.isRectilinear(newLine)) {
+ OrthogonalRouterUtilities.transformToOrthogonalPointList(newLine, PositionConstants.NONE, PositionConstants.NONE);
+ }
+
+ removeRedundantPoints(newLine);
+
+ /*
+ * Remove unnecessary points that are contained within source and/or target shapes
+ * as well as insert extra points if all points are within source and/or target shapes
+ */
+ removePointsInViews(conn, newLine, lastStartAnchor, lastEndAnchor);
+
+ Dimension tolerance = new Dimension(3, 0);
+ if(!isFeedback(conn))
+ tolerance = (Dimension)MapModeUtil.getMapMode(conn).DPtoLP(tolerance);
+
+ /*
+ * Normalize polyline to eliminate extra segments. (This makes 3 segments collapsing into
+ * one, while line segments are moved)
+ */
+ if(!skipNormalization) {
+ if(PointListUtilities.normalizeSegments(newLine, tolerance.width)) {
+ /*
+ * Normalization can make our polyline not rectilinear. Hence, we need to normalize
+ * segments of polyline to straight line tolerance.
+ */
+ normalizeToStraightLineTolerance(newLine, tolerance.width);
+ }
+ }
+
+ /*
+ * Normalization is not touching the end points, hence we'd like to handle this here.
+ * If distance between start and end (which are the only points in a polyline) points
+ * is too short we'll remove one of the points
+ */
+ if(newLine.size() == 2) {
+ Ray middleSeg = new Ray(newLine.getFirstPoint(), newLine.getLastPoint());
+ if(middleSeg.length() <= tolerance.width) {
+ newLine.removePoint(0);
+ }
+ }
+
+ /*
+ * Calculate connection anchor points and possibly some extra routing work to keep
+ * the connection rectilinear if anchor points make it not rectilinear.
+ */
+ rectilinearResetEndPointsToEdge(conn, newLine);
+
+ if(nestedRoutingDepth < 1 && !isValidRectilinearLine(conn, newLine)) {
+ routeLine(conn, ++nestedRoutingDepth, newLine);
+ }
+ }
+
+ /**
+ * Rectilinear polyline is invalid if:
+ * 1. First bend point is within the source
+ * 2. Last bend point is within the target
+ * 3. First bend point and source anchor are on different sides of the source shape
+ * 4. Last bend point and target anchor are on different sides of the target shape
+ *
+ * @param conn
+ * connection
+ * @param line
+ * rectilinear polyline
+ * @return <code>true</code> if the line is valid
+ */
+ private boolean isValidRectilinearLine(Connection conn, PointList line) {
+ if(!(conn.getSourceAnchor().getOwner() instanceof Connection)) {
+ Rectangle source = new PrecisionRectangle(FigureUtilities.getAnchorableFigureBounds(conn.getSourceAnchor().getOwner()));
+ conn.getSourceAnchor().getOwner().translateToAbsolute(source);
+ conn.translateToRelative(source);
+ if(source.contains(line.getPoint(1))) {
+ return false;
+ }
+ int firstSegmentOrientation = line.getFirstPoint().x == line.getPoint(1).x ? PositionConstants.VERTICAL : PositionConstants.HORIZONTAL;
+ if(getOutisePointOffRectanglePosition(line.getPoint(1), source) != getAnchorLocationBasedOnSegmentOrientation(line.getFirstPoint(), source, firstSegmentOrientation)) {
+ return false;
+ }
+ }
+ if(!(conn.getTargetAnchor().getOwner() instanceof Connection)) {
+ Rectangle target = new PrecisionRectangle(FigureUtilities.getAnchorableFigureBounds(conn.getTargetAnchor().getOwner()));
+ conn.getTargetAnchor().getOwner().translateToAbsolute(target);
+ conn.translateToRelative(target);
+ if(target.contains(line.getPoint(line.size() - 2))) {
+ return false;
+ }
+ int lastSegmentOrientation = line.getLastPoint().x == line.getPoint(line.size() - 2).x ? PositionConstants.VERTICAL : PositionConstants.HORIZONTAL;
+ if(getOutisePointOffRectanglePosition(line.getPoint(line.size() - 2), target) != getAnchorLocationBasedOnSegmentOrientation(line.getLastPoint(), target, lastSegmentOrientation)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Calculates geographic position of a point located outside the given rectangle relative
+ * to the rectangle
+ *
+ * @param p
+ * point outside of rectangle
+ * @param r
+ * the rectangle
+ * @return geographic position of the point relative to the recatangle
+ */
+ private int getOutisePointOffRectanglePosition(Point p, Rectangle r) {
+ int position = PositionConstants.NONE;
+ if(r.x > p.x) {
+ position |= PositionConstants.WEST;
+ } else if(r.x + r.width < p.x) {
+ position |= PositionConstants.EAST;
+ }
+ if(r.y > p.y) {
+ position |= PositionConstants.NORTH;
+ } else if(r.y + r.height < p.y) {
+ position |= PositionConstants.SOUTH;
+ }
+ return position;
+ }
+
+ /**
+ * Given the coordinates of the connection anchor point the shape's rectangle and the
+ * orientation of the first rectilinear connection segment that comes out from the anchor
+ * point the method detemines on which geographic side of the rectangle the anchor point
+ * is located on.
+ *
+ * @param anchorPoint
+ * coordinates of the anchor point
+ * @param rectangle
+ * the shape's bounding rectangle
+ * @param segmentOrientation
+ * orinetation of the segment coming out from the anchor point
+ * @return geographic position of the anchor point relative to the rectangle
+ */
+ private int getAnchorLocationBasedOnSegmentOrientation(Point anchorPoint, Rectangle rectangle, int segmentOrientation) {
+ if(segmentOrientation == PositionConstants.VERTICAL) {
+ if(Math.abs(anchorPoint.y - rectangle.y) < Math.abs(anchorPoint.y - rectangle.y - rectangle.height)) {
+ return PositionConstants.NORTH;
+ } else {
+ return PositionConstants.SOUTH;
+ }
+ } else if(segmentOrientation == PositionConstants.HORIZONTAL) {
+ if(Math.abs(anchorPoint.x - rectangle.x) < Math.abs(anchorPoint.x - rectangle.x - rectangle.width)) {
+ return PositionConstants.WEST;
+ } else {
+ return PositionConstants.EAST;
+ }
+ }
+ return PositionConstants.NONE;
+ }
+
+ /**
+ * Goes through line segments of a polyline and makes strict straight segments
+ * from nearly straight segments.
+ *
+ * @param line
+ * polyline
+ * @param tolerance
+ * tolerance value specifying nearly straight lines.
+ */
+ private void normalizeToStraightLineTolerance(PointList line, int tolerance) {
+ for(int i = 0; i < line.size() - 1; i++) {
+ Point pt1 = line.getPoint(i);
+ Point pt2 = line.getPoint(i + 1);
+ if(Math.abs(pt1.x - pt2.x) < tolerance) {
+ line.setPoint(new Point(pt1.x, pt2.y), i + 1);
+ } else if(Math.abs(pt1.y - pt2.y) < tolerance) {
+ line.setPoint(new Point(pt2.x, pt1.y), i + 1);
+ }
+ }
+ }
+
+ /**
+ * Removes consecutive points contained within the source shape and removes consecutive
+ * points contained within the target shape. If all points have been removed an extra point
+ * outside source and target shapes will be added.
+ *
+ * @param conn
+ * connection
+ * @param newLine
+ * polyline of the connection (routed connection)
+ * @param start
+ * old start anchor point
+ * @param end
+ * old end anchor point
+ */
+ private void removePointsInViews(Connection conn, PointList newLine, Point start, Point end) {
+ /*
+ * Get the bounds of anchorable figure of the source and target and translate it to
+ * connection relative coordinates.
+ */
+ PrecisionRectangle source = conn.getSourceAnchor().getOwner() != null ? new PrecisionRectangle(FigureUtilities.getAnchorableFigureBounds(conn.getSourceAnchor().getOwner())) : null;
+ PrecisionRectangle target = conn.getTargetAnchor().getOwner() != null ? new PrecisionRectangle(FigureUtilities.getAnchorableFigureBounds(conn.getTargetAnchor().getOwner())) : null;
+ if(source != null) {
+ conn.getSourceAnchor().getOwner().translateToAbsolute(source);
+ conn.translateToRelative(source);
+ }
+ if(target != null) {
+ conn.getTargetAnchor().getOwner().translateToAbsolute(target);
+ conn.translateToRelative(target);
+ }
+
+ Point lastRemovedFromSource = null;
+ Point lastRemovedFromTarget = null;
+
+ /*
+ * Starting from the first point of polyline remove points that are contained
+ * within the source shape until the first point outside is found.
+ * Remember the point that was removed from the source shape last for a possible
+ * case of all points removed from polyline.
+ */
+ if(!(conn.getSourceAnchor().getOwner() instanceof Connection) && newLine.size() != 0 && source.contains(new PrecisionPoint(newLine.getFirstPoint()))) {
+ lastRemovedFromSource = newLine.removePoint(0);
+ for(int i = 0; i < newLine.size() && source.contains(new PrecisionPoint(newLine.getPoint(i))); i++) {
+ lastRemovedFromSource = newLine.removePoint(i--);
+ }
+ }
+
+ /*
+ * Starting from the end point of polyline remove points that are contained
+ * within the target shape until the first point outside is found.
+ * Remember the point that was removed from the target shape last for a possible
+ * case of all points removed from polyline.
+ */
+ if(!(conn.getTargetAnchor().getOwner() instanceof Connection) && newLine.size() != 0 && target.contains(new PrecisionPoint(newLine.getLastPoint()))) {
+ lastRemovedFromTarget = newLine.removePoint(newLine.size() - 1);
+ for(int i = newLine.size(); i > 0 && target.contains(new PrecisionPoint(newLine.getPoint(i - 1))); i--) {
+ lastRemovedFromTarget = newLine.removePoint(i - 1);
+ }
+ }
+
+ /*
+ * Handle the special case of all points removed from polyline.
+ */
+ if(newLine.size() == 0) {
+ Dimension tolerance = new Dimension(1, 0);
+ if(!isFeedback(conn))
+ tolerance = (Dimension)MapModeUtil.getMapMode(conn).DPtoLP(tolerance);
+ int toleranceValue = tolerance.width;
+ if(lastRemovedFromSource == null) {
+ lastRemovedFromSource = start;
+ }
+ if(lastRemovedFromTarget == null) {
+ lastRemovedFromTarget = end;
+ }
+ /*
+ * If last point removed from source and the points removed from target form
+ * a vertical or horizontal line we'll find a point located on this line and is
+ * outside of source and target shape and insert it in the polyline.
+ * The check for vertical and horizontal segment is using tolerance value, because
+ * bend point location extracted from RelativeBendpoint can have precision errors due
+ * to non-integer weight factors.
+ */
+ if(Math.abs(lastRemovedFromSource.x - lastRemovedFromTarget.x) < toleranceValue) {
+ // Vertical
+ if(source.preciseY < target.preciseY) {
+ newLine.addPoint(lastRemovedFromSource.x, (source.getBottom().y + target.getTop().y) / 2);
+ } else {
+ newLine.addPoint(lastRemovedFromSource.x, (source.getTop().y + target.getBottom().y) / 2);
+ }
+ } else if(Math.abs(lastRemovedFromSource.y - lastRemovedFromTarget.y) < toleranceValue) {
+ // Horizontal
+ if(source.preciseX < target.preciseX) {
+ newLine.addPoint((source.getRight().x + target.getLeft().x) / 2, lastRemovedFromSource.y);
+ } else {
+ newLine.addPoint((source.getLeft().x + target.getRight().x) / 2, lastRemovedFromSource.y);
+ }
+ } else if((conn.getSourceAnchor() instanceof BaseSlidableAnchor && StringStatics.BLANK.equals(((BaseSlidableAnchor)conn.getSourceAnchor()).getTerminal()) && (conn.getTargetAnchor() instanceof BaseSlidableAnchor && StringStatics.BLANK.equals(((BaseSlidableAnchor)conn.getTargetAnchor()).getTerminal())))) {
+ /*
+ * This a special case for old diagrams with rectilinear connections routed by
+ * the old router to look good with the new router
+ */
+ if(lastRemovedFromSource != null && lastRemovedFromTarget != null) {
+ newLine.addPoint((lastRemovedFromSource.x + lastRemovedFromTarget.x) / 2, (lastRemovedFromSource.y + lastRemovedFromTarget.y) / 2);
+ } else {
+ double startX = Math.max(source.preciseX, target.preciseX);
+ double endX = Math.min(source.preciseX + source.preciseWidth, target.preciseX + target.preciseWidth);
+ double startY = Math.max(source.preciseY, target.preciseY);
+ double endY = Math.min(source.preciseY + source.preciseHeight, target.preciseY + target.preciseHeight);
+ if(startX < endX) {
+ if(source.preciseY < target.preciseY) {
+ newLine.addPoint((int)Math.round((startX + endX) / 2.0), (source.getBottom().y + target.getTop().y) / 2);
+ } else {
+ newLine.addPoint((int)Math.round((startX + endX) / 2.0), (source.getTop().y + target.getBottom().y) / 2);
+ }
+ } else if(startY < endY) {
+ if(source.preciseX < target.preciseX) {
+ newLine.addPoint((source.getRight().x + target.getLeft().x) / 2, (int)Math.round((startY + endY) / 2.0));
+ } else {
+ newLine.addPoint((source.getLeft().x + target.getRight().x) / 2, (int)Math.round((startY + endY) / 2.0));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void rectilinearResetEndPointsToEdge(Connection conn, PointList line) {
+ if(isReorienting(conn)) {
+ /*
+ * If the connection doesn't have a shape as a source or target we'll
+ * let the oblique router to do the work. The connection doesn't need to
+ * be rectilinear at this point. There is no support for making a rectilinear
+ * connection for which one of the ends is not connected to anything.
+ */
+ super.resetEndPointsToEdge(conn, line);
+ return;
+ }
+ PrecisionRectangle source = sourceBoundsRelativeToConnection(conn);
+ PrecisionRectangle target = targetBoundsRelativeToConnection(conn);
+ int offSourceDirection = PositionConstants.NONE;
+ int offTargetDirection = PositionConstants.NONE;
+ int sourceAnchorRelativeLocation = PositionConstants.NONE;
+ int targetAnchorRelativeLocation = PositionConstants.NONE;
+ if(line.size() == 0) {
+ /*
+ * If there are no valid bend points, we'll use the oblique connection anchor points
+ * and just convert the polyline from oblique to rectilinear.
+ */
+ // Need to add 2 dumb points to ensure that RouterHelper#resetEndPointsToEdge works
+ line.addPoint(new Point());
+ line.addPoint(new Point());
+ super.resetEndPointsToEdge(conn, line);
+ sourceAnchorRelativeLocation = getAnchorOffRectangleDirection(line.getFirstPoint(), source);
+ targetAnchorRelativeLocation = getAnchorOffRectangleDirection(line.getLastPoint(), target);
+ /*
+ * We need to find two points offset from the source and target anchors outside the shapes
+ * such that when the polyline is converted to rectilinear from oblique we won't have
+ * rectilinear line segments alligned with source or target shapes edges.
+ */
+ Point offStart = line.getFirstPoint();
+ Point offEnd = line.getLastPoint();
+ Dimension offsetDim = offStart.getDifference(offEnd).scale(0.5);
+ offStart.translate(getTranslationValue(sourceAnchorRelativeLocation, Math.abs(offsetDim.width), Math.abs(offsetDim.height)));
+ offEnd.translate(getTranslationValue(targetAnchorRelativeLocation, Math.abs(offsetDim.width), Math.abs(offsetDim.height)));
+ line.insertPoint(offStart, 1);
+ line.insertPoint(offEnd, 2);
+ offSourceDirection = getOffShapeDirection(sourceAnchorRelativeLocation);
+ offTargetDirection = getOffShapeDirection(targetAnchorRelativeLocation);
+ } else {
+ Point start = line.getFirstPoint();
+ Point end = line.getLastPoint();
+ if(conn.getSourceAnchor() instanceof OrthogonalConnectionAnchor) {
+ line.insertPoint(OrthogonalRouterUtilities.getOrthogonalLineSegToAnchorLoc(conn, conn.getSourceAnchor(), start).getOrigin(), 0);
+ } else {
+ /*
+ * If anchor is not supporting orthogonal connections we'll use the oblique connection
+ * anchors and then convert it to rectilinear.
+ */
+ PrecisionPoint reference = new PrecisionPoint(start);
+ conn.getSourceAnchor().getOwner().translateToAbsolute(reference);
+ PrecisionPoint anchorLocation = new PrecisionPoint(conn.getSourceAnchor().getLocation(reference));
+ conn.translateToRelative(anchorLocation);
+ line.insertPoint(anchorLocation, 0);
+ }
+ if(conn.getTargetAnchor() instanceof OrthogonalConnectionAnchor) {
+ line.addPoint(OrthogonalRouterUtilities.getOrthogonalLineSegToAnchorLoc(conn, conn.getTargetAnchor(), end).getOrigin());
+ } else {
+ /*
+ * If anchor is not supporting orthogonal connections we'll use the oblique connection
+ * anchors and then convert it to rectilinear.
+ */
+ PrecisionPoint reference = new PrecisionPoint(end);
+ conn.getSourceAnchor().getOwner().translateToAbsolute(reference);
+ PrecisionPoint anchorLocation = new PrecisionPoint(conn.getTargetAnchor().getLocation(reference));
+ conn.translateToRelative(anchorLocation);
+ line.addPoint(anchorLocation);
+ }
+ sourceAnchorRelativeLocation = getAnchorOffRectangleDirection(line.getFirstPoint(), source);
+ offSourceDirection = getOffShapeDirection(sourceAnchorRelativeLocation);
+ targetAnchorRelativeLocation = getAnchorOffRectangleDirection(line.getLastPoint(), target);
+ offTargetDirection = getOffShapeDirection(targetAnchorRelativeLocation);
+ }
+
+ /*
+ * Convert the polyline to rectilinear. If the connection is rectilinear already then the
+ * connection will remain as it is.
+ */
+ OrthogonalRouterUtilities.transformToOrthogonalPointList(line, offSourceDirection, offTargetDirection);
+ removeRedundantPoints(line);
+ }
+
+ /**
+ * Returns a translation dimension for the anchor point. Translation dimension
+ * translates the anchor point off the shape. The off shape direction
+ * is specified by the relative to the shape geographic position of the anchor
+ *
+ * @param position
+ * relative to the shape geographic position of the anchor
+ * @param xFactorValue
+ * translation value along x-axis
+ * @param yFactorValue
+ * translation value along y-axis
+ * @return
+ */
+ private Dimension getTranslationValue(int position, int xFactorValue, int yFactorValue) {
+ Dimension translationDimension = new Dimension();
+ if(position == PositionConstants.EAST) {
+ translationDimension.width = xFactorValue;
+ } else if(position == PositionConstants.SOUTH) {
+ translationDimension.height = yFactorValue;
+ } else if(position == PositionConstants.WEST) {
+ translationDimension.width = -xFactorValue;
+ } else if(position == PositionConstants.NORTH) {
+ translationDimension.height = -yFactorValue;
+ }
+ return translationDimension;
+ }
+
+ /**
+ * Target bounding rectangle relative to connection figure coordinates
+ *
+ * @param conn
+ * connection
+ * @return <code>PrecisionRectangle</code> target bounds relative to connection's coordinate
+ * system
+ */
+ private PrecisionRectangle targetBoundsRelativeToConnection(Connection conn) {
+ PrecisionRectangle target = new PrecisionRectangle(conn.getTargetAnchor().getOwner().getBounds());
+ conn.getTargetAnchor().getOwner().translateToAbsolute(target);
+ conn.translateToRelative(target);
+ return target;
+ }
+
+ /**
+ * Iterates through points of a polyline and does the following:
+ * if 3 points lie on the same line the middle point is removed
+ *
+ * @param line
+ * polyline's points
+ */
+ private boolean removeRedundantPoints(PointList line) {
+ int initialNumberOfPoints = line.size();
+ if(line.size() > 2) {
+ PointList newLine = new PointList(line.size());
+ newLine.addPoint(line.removePoint(0));
+ while(line.size() >= 2) {
+ Point p0 = newLine.getLastPoint();
+ Point p1 = line.getPoint(0);
+ Point p2 = line.getPoint(1);
+ if(p0.x == p1.x && p0.x == p2.x) {
+ // Have two vertical segments in a row
+ // get rid of the point between
+ line.removePoint(0);
+ } else if(p0.y == p1.y && p0.y == p2.y) {
+ // Have two horizontal segments in a row
+ // get rid of the point between
+ line.removePoint(0);
+ } else {
+ newLine.addPoint(line.removePoint(0));
+ }
+ }
+ while(line.size() > 0) {
+ newLine.addPoint(line.removePoint(0));
+ }
+ line.removeAllPoints();
+ line.addAll(newLine);
+ }
+ return line.size() != initialNumberOfPoints;
+ }
+
+ /**
+ * Determines whether the rectilinear line segment coming out of the shape should be
+ * horizontal or vertical based on the anchor geographic position relative to the shape
+ *
+ * @param anchorRelativeLocation
+ * @return
+ */
+ private int getOffShapeDirection(int anchorRelativeLocation) {
+ if(anchorRelativeLocation == PositionConstants.EAST || anchorRelativeLocation == PositionConstants.WEST) {
+ return PositionConstants.HORIZONTAL;
+ } else if(anchorRelativeLocation == PositionConstants.NORTH || anchorRelativeLocation == PositionConstants.SOUTH) {
+ return PositionConstants.VERTICAL;
+ }
+ return PositionConstants.NONE;
+ }
+
+ /**
+ * Source bounding rectangle relative to connection figure coordinates
+ *
+ * @param conn
+ * connection
+ * @return <code>PrecisionRectangle</code> source bounds relative to connection's coordinate
+ * system
+ */
+ private PrecisionRectangle sourceBoundsRelativeToConnection(Connection conn) {
+ PrecisionRectangle source = new PrecisionRectangle(conn.getSourceAnchor().getOwner().getBounds());
+ conn.getSourceAnchor().getOwner().translateToAbsolute(source);
+ conn.translateToRelative(source);
+ return source;
+ }
+
+ /**
+ * Determines the relative to rectangle geographic location of a point.
+ * Example: If shape is closer to the the top edge of the rectangle location
+ * would be north.
+ * Method used to determine which side of shape's bounding rectangle is closer
+ * to connection's anchor point.
+ * All geometric quantities must be in the same coordinate system.
+ *
+ * @param anchorPoint
+ * location of the anchor point
+ * @param rect
+ * bounding rectangle of the shape
+ * @return
+ */
+ private int getAnchorOffRectangleDirection(Point anchorPoint, Rectangle rect) {
+ int position = PositionConstants.NORTH;
+ int criteriaValue = Math.abs(anchorPoint.y - rect.y);
+ int tempCriteria = Math.abs(anchorPoint.y - rect.y - rect.height);
+ if(tempCriteria < criteriaValue) {
+ criteriaValue = tempCriteria;
+ position = PositionConstants.SOUTH;
+ }
+
+ tempCriteria = Math.abs(anchorPoint.x - rect.x);
+ if(tempCriteria < criteriaValue) {
+ criteriaValue = tempCriteria;
+ position = PositionConstants.WEST;
+ }
+
+ tempCriteria = Math.abs(anchorPoint.x - rect.x - rect.width);
+ if(tempCriteria < criteriaValue) {
+ criteriaValue = tempCriteria;
+ position = PositionConstants.EAST;
+ }
+
+ return position;
+ }
+
+ /**
+ * @param conn
+ * the <code>Connection</code> that is to be check if it is a feedback
+ * connection or not.
+ * @return <code>true</code> is it is a feedback connection, <code>false</code> otherwise.
+ */
+ private static boolean isFeedback(Connection conn) {
+ Dimension dim = new Dimension(100, 100);
+ Dimension dimCheck = dim.getCopy();
+ conn.translateToRelative(dimCheck);
+ return dim.equals(dimCheck);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
new file mode 100644
index 00000000000..ba373ecc69b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
@@ -0,0 +1,390 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Locator;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RelativeLocator;
+import org.eclipse.draw2d.TreeSearch;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+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.commands.UnexecutableCommand;
+import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.FillStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.GradientData;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.LifelineXYLayoutEditPolicy;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+
+public abstract class AbstractExecutionSpecificationEditPart extends ShapeNodeEditPart {
+
+ private List executionSpecificationEndParts;
+
+ public AbstractExecutionSpecificationEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ public List getChildren() {
+ if(executionSpecificationEndParts == null) {
+ initExecutionSpecificationEndEditPart();
+ }
+ return super.getChildren();
+ }
+
+ protected void initExecutionSpecificationEndEditPart() {
+ executionSpecificationEndParts = new ArrayList();
+
+ EObject element = this.resolveSemanticElement();
+ if(!(element instanceof ExecutionSpecification)) {
+ return;
+ }
+ ExecutionSpecification execution = (ExecutionSpecification)element;
+ final ExecutionSpecificationEndEditPart startPart = new ExecutionSpecificationEndEditPart(execution.getStart(), this, new RelativeLocator(getFigure(), PositionConstants.NORTH));
+ executionSpecificationEndParts.add(startPart);
+
+ final ExecutionSpecificationEndEditPart finishPart = new ExecutionSpecificationEndEditPart(execution.getFinish(), this, new RelativeLocator(getFigure(), PositionConstants.SOUTH));
+ executionSpecificationEndParts.add(finishPart);
+
+ Diagram diagram = ((View)this.getModel()).getDiagram();
+ startPart.rebuildLinks(diagram);
+ finishPart.rebuildLinks(diagram);
+
+ addChild(startPart, -1);
+ addChild(finishPart, -1);
+ }
+
+ static class FillParentLocator implements Locator {
+
+ public void relocate(IFigure target) {
+ target.setBounds(target.getParent().getBounds());
+ }
+ }
+
+ /**
+ * Overrides to disable the defaultAnchorArea. The edge is now more stuck with the middle of the
+ * figure.
+ *
+ * @generated NOT
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(16, 60) {
+
+ /**
+ * @see org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure#isDefaultAnchorArea(org.eclipse.draw2d.geometry.PrecisionPoint)
+ */
+ @Override
+ protected boolean isDefaultAnchorArea(PrecisionPoint p) {
+ return false;
+ }
+ };
+ result.setMinimumSize(new Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(20))); // min height 20
+ return result;
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableShapeEditPolicy() {
+
+ @Override
+ protected Command getResizeCommand(ChangeBoundsRequest request) {
+ // Bugfix: Avoid resize ES with the child size is little than parent one.
+ EditPart host = getHost();
+ List<ShapeNodeEditPart> movedChildrenParts = LifelineXYLayoutEditPolicy.getAffixedExecutionSpecificationEditParts((ShapeNodeEditPart)host);
+ Rectangle r = getInitialFeedbackBounds().getCopy();
+ getHostFigure().translateToAbsolute(r);
+ r.translate(0, request.getMoveDelta().y);
+ r.resize(0, request.getSizeDelta().height);
+ for(ShapeNodeEditPart child : movedChildrenParts) {
+ IFigure figure = child.getFigure();
+ Rectangle rect = figure.getBounds().getCopy();
+ if (figure instanceof HandleBounds) {
+ rect = ((HandleBounds)figure).getBounds().getCopy();
+ }
+ figure.translateToAbsolute(rect);
+ if(rect.y < r.y || rect.bottom() > r.bottom()) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ return super.getResizeCommand(request);
+ }
+
+ @Override
+ protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
+ request.getMoveDelta().x = 0; // reset offset
+
+ IFigure feedback = getDragSourceFeedbackFigure();
+
+ PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ getHostFigure().translateToAbsolute(rect);
+
+ IFigure f = getHostFigure();
+ Dimension min = f.getMinimumSize().getCopy();
+ Dimension max = f.getMaximumSize().getCopy();
+ IMapMode mmode = MapModeUtil.getMapMode(f);
+ min.height = mmode.LPtoDP(min.height);
+ min.width = mmode.LPtoDP(min.width);
+ max.height = mmode.LPtoDP(max.height);
+ max.width = mmode.LPtoDP(max.width);
+
+ Rectangle originalBounds = rect.getCopy();
+ rect.translate(request.getMoveDelta());
+ rect.resize(request.getSizeDelta());
+
+ if(min.width > rect.width) {
+ rect.width = min.width;
+ } else if(max.width < rect.width) {
+ rect.width = max.width;
+ }
+ if(min.height > rect.height) {
+ rect.height = min.height;
+ } else if(max.height < rect.height) {
+ rect.height = max.height;
+ }
+
+ if(rect.height == min.height && request.getSizeDelta().height < 0 && request.getMoveDelta().y > 0) { //shrink at north
+ Point loc = rect.getLocation();
+ loc.y = originalBounds.getBottom().y - min.height;
+ rect.setLocation(loc);
+
+ request.getSizeDelta().height = min.height - originalBounds.height;
+ request.getMoveDelta().y = loc.y - originalBounds.y;
+ }
+
+ if(request.getSizeDelta().height == 0) { // moving
+ moveExecutionSpecificationFeedback(request, AbstractExecutionSpecificationEditPart.this, rect);
+ }
+ feedback.translateToRelative(rect);
+ feedback.setBounds(rect);
+ }
+ });
+ }
+
+ @Override
+ protected void setLineWidth(int width) {
+ if(getPrimaryShape() instanceof NodeFigure) {
+ ((NodeFigure)getPrimaryShape()).setLineWidth(width);
+ }
+ }
+
+ protected final void refreshShadow() {
+ getPrimaryShape().setShadow(AppearanceHelper.showShadow((View)getModel()));
+ }
+
+ /**
+ * Override to set the transparency to the correct figure
+ */
+ @Override
+ protected void setTransparency(int transp) {
+ getPrimaryShape().setTransparency(transp);
+ }
+
+ /**
+ * sets the back ground color of this edit part
+ *
+ * @param color
+ * the new value of the back ground color
+ */
+ @Override
+ protected void setBackgroundColor(Color color) {
+ getPrimaryShape().setBackgroundColor(color);
+ getPrimaryShape().setIsUsingGradient(false);
+ getPrimaryShape().setGradientData(-1, -1, 0);
+ }
+
+ /**
+ * Override to set the gradient data to the correct figure
+ */
+ @Override
+ protected void setGradient(GradientData gradient) {
+ IPapyrusNodeFigure fig = getPrimaryShape();
+ FillStyle style = (FillStyle)getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE);
+ if(gradient != null) {
+ fig.setIsUsingGradient(true);;
+ fig.setGradientData(style.getFillColor(), gradient.getGradientColor1(), gradient.getGradientStyle());
+ } else {
+ fig.setIsUsingGradient(false);
+ }
+ }
+
+ @Override
+ public boolean supportsGradient() {
+ return true;
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ Object feature = event.getFeature();
+ if((getModel() != null) && (getModel() == event.getNotifier())) {
+ if(NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
+ refreshLineWidth();
+ } else if(NotationPackage.eINSTANCE.getLineTypeStyle_LineType().equals(feature)) {
+ refreshLineType();
+ }
+ }
+
+ refreshShadow();
+ }
+
+ public class ExecutionSpecificationRectangleFigure extends PapyrusNodeFigure { //RectangleFigure {
+
+ public ExecutionSpecificationRectangleFigure() {
+ this.setPreferredSize(new Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(60)));
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(20)));
+ }
+
+ @Override
+ public IFigure findMouseEventTargetAt(int x, int y) {
+ // check children first instead of self
+ IFigure f = findMouseEventTargetInDescendantsAt(x, y);
+ if(f != null) {
+ return f;
+ }
+ if(!containsPoint(x, y)) {
+ return null;
+ }
+ if(isMouseEventTarget()) {
+ return this;
+ }
+ return null;
+ }
+
+ @Override
+ public IFigure findFigureAt(int x, int y, TreeSearch search) {
+ if(search.prune(this)) {
+ return null;
+ }
+ IFigure child = findDescendantAtExcluding(x, y, search);
+ if(child != null) {
+ return child;
+ }
+ if(!containsPoint(x, y)) {
+ return null;
+ }
+ if(search.accept(this)) {
+ return this;
+ }
+ return null;
+ }
+ }
+
+ public abstract ExecutionSpecificationRectangleFigure getPrimaryShape();
+
+ //see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=385604
+ protected void moveExecutionSpecificationFeedback(ChangeBoundsRequest request, AbstractExecutionSpecificationEditPart movedPart, PrecisionRectangle rect) {
+ LifelineEditPart lifelineEP = (LifelineEditPart)movedPart.getParent();
+ Rectangle copy = rect.getCopy();
+ lifelineEP.getPrimaryShape().translateToRelative(copy);
+
+ List<ShapeNodeEditPart> executionSpecificationList = lifelineEP.getChildShapeNodeEditPart();
+ List<ShapeNodeEditPart> movedChildrenParts = LifelineXYLayoutEditPolicy.getAffixedExecutionSpecificationEditParts(AbstractExecutionSpecificationEditPart.this);
+ executionSpecificationList.remove(movedPart); // ignore current action and its children
+ executionSpecificationList.removeAll(movedChildrenParts);
+ ShapeNodeEditPart parentBar = LifelineXYLayoutEditPolicy.getParent(lifelineEP, copy, executionSpecificationList);
+
+ Rectangle dotLineBounds = lifelineEP.getPrimaryShape().getFigureLifelineDotLineFigure().getBounds();
+ int dotLineBarLocationX = dotLineBounds.x + dotLineBounds.width / 2 - LifelineXYLayoutEditPolicy.EXECUTION_INIT_WIDTH / 2;
+ if(parentBar == null) {
+ if(dotLineBarLocationX < copy.x) { // there is no parent bar, move to the center dotline position
+ int dx = dotLineBarLocationX - copy.x;
+ request.getMoveDelta().x += dx;
+ rect.x += dx;
+ }
+ } else {
+ while(!executionSpecificationList.isEmpty()) {
+ Rectangle parentBounds = parentBar.getFigure().getBounds();
+ int width = parentBounds.width > 0 ? parentBounds.width : LifelineXYLayoutEditPolicy.EXECUTION_INIT_WIDTH;
+ int x = parentBounds.x + width / 2 + 1; // affixed to the parent bar
+ int dx = x - copy.x;
+ rect.x += dx;
+ request.getMoveDelta().x += dx;
+ copy.x = x;
+
+ // check again to see if the new bar location overlaps with existing bars
+ ShapeNodeEditPart part = LifelineXYLayoutEditPolicy.getParent(lifelineEP, copy, executionSpecificationList);
+ if(part == parentBar) {
+ break;
+ } else {
+ parentBar = part;
+ }
+ }
+ }
+ }
+
+ /**
+ * Override for add elements on ExecutionSpecification
+ */
+ @Override
+ public Command getCommand(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ return getParent().getCommand(request);
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * @generated NOT Override for redirecting creation request to the lifeline
+ */
+ @Override
+ public void showSourceFeedback(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ getParent().showSourceFeedback(request);
+ }
+ super.showSourceFeedback(request);
+ }
+
+ /**
+ * @generated NOT Override for redirecting creation request to the lifeline
+ */
+ @Override
+ public void eraseSourceFeedback(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ getParent().eraseSourceFeedback(request);
+ }
+ super.eraseSourceFeedback(request);
+ }
+
+ @Override
+ public void showTargetFeedback(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ getParent().showTargetFeedback(request);
+ }
+ super.showTargetFeedback(request);
+ }
+
+ @Override
+ public void eraseTargetFeedback(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ getParent().eraseSourceFeedback(request);
+ }
+ super.eraseTargetFeedback(request);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractMessageEditPart.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractMessageEditPart.java
new file mode 100644
index 00000000000..353cd16c66a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractMessageEditPart.java
@@ -0,0 +1,194 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.uml2.uml.Message;
+
+public abstract class AbstractMessageEditPart extends UMLConnectionNodeEditPart {
+
+ private List messageEventParts;
+
+ public AbstractMessageEditPart(View view) {
+ super(view);
+ }
+
+ public View findChildByModel(EObject model) {
+ List list = getModelChildren();
+ if(list != null && list.size() > 0) {
+ for(Object o : list) {
+ if(!(o instanceof View) )
+ continue;
+
+ View view = (View) o;
+ if(view.getElement() == model){
+ return view;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public List getChildren() {
+ if (messageEventParts == null) {
+ initMessageEventPart();
+ }
+ return super.getChildren();
+ }
+
+ protected void initMessageEventPart() {
+ messageEventParts = new ArrayList();
+
+ EObject element = this.resolveSemanticElement();
+ if (!(element instanceof Message))
+ return;
+ Message message = (Message) element;
+ UMLEdgeFigure edgeFigure = (UMLEdgeFigure) this.getFigure();
+ final MessageEndEditPart sendEventPart = new MessageEndEditPart(
+ message.getSendEvent(), this, new ConnectionLocator(edgeFigure,
+ ConnectionLocator.SOURCE));
+ messageEventParts.add(sendEventPart);
+
+ final MessageEndEditPart receiveEventPart = new MessageEndEditPart(
+ message.getReceiveEvent(), this, new ConnectionLocator(
+ edgeFigure, ConnectionLocator.TARGET));
+ messageEventParts.add(receiveEventPart);
+
+ Diagram diagram = ((View) this.getModel()).getDiagram();
+ sendEventPart.rebuildLinks(diagram);
+ receiveEventPart.rebuildLinks(diagram);
+
+ addChild(sendEventPart, -1);
+ addChild(receiveEventPart, -1);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MessageLabelEditPolicy());
+ }
+
+ @Override
+ public EditPart getTargetEditPart(Request request) {
+ if(request instanceof CreateUnspecifiedTypeConnectionRequest){
+ List types = ((CreateUnspecifiedTypeConnectionRequest) request).getElementTypes();
+ if(types.contains(UMLElementTypes.Message_4009) || types.contains(UMLElementTypes.Message_4008)){
+ return null;
+ }
+ }else if(request instanceof ReconnectRequest){
+ ConnectionEditPart con = ((ReconnectRequest)request).getConnectionEditPart();
+ if(con instanceof Message7EditPart || con instanceof Message6EditPart){
+ return null;
+ }
+ }
+ return super.getTargetEditPart(request);
+ }
+
+ protected void handleNotificationEvent(Notification notification) {
+ super.handleNotificationEvent(notification);
+ Object feature = notification.getFeature();
+
+ MessageLabelEditPart labelPart = getMessageLabelEditPart();
+ if(labelPart == null)
+ return;
+ if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ labelPart.refreshFontColor();
+ }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)) {
+ labelPart.refreshFont();
+ }
+ }
+
+ public MessageLabelEditPart getMessageLabelEditPart(){
+ for(Object c : this.getChildren())
+ if(c instanceof MessageLabelEditPart) {
+ return (MessageLabelEditPart)c;
+ }
+ return null;
+ }
+
+ //public abstract IFigure getPrimaryShape() ;
+
+ public void setLineWidth(int width) {
+ if(getPrimaryShape() instanceof MessageFigure){
+ MessageFigure edge = (MessageFigure)getPrimaryShape();
+ edge.setLineWidth(width);
+ }
+ }
+
+ public static class MessageFigure extends UMLEdgeFigure{
+ @Override
+ public void setLineWidth(int w) {
+ super.setLineWidth(w);
+ if(getSourceDecoration() instanceof Shape){
+ ((Shape)getSourceDecoration()).setLineWidth(w);
+ }
+ if(getTargetDecoration() instanceof Shape){
+ ((Shape)getTargetDecoration()).setLineWidth(w);
+ }
+ }
+
+ @Override
+ public void setForegroundColor(Color c) {
+ super.setForegroundColor(c);
+ if(getSourceDecoration() instanceof Shape){
+ ((Shape)getSourceDecoration()).setForegroundColor(c);
+ ((Shape)getSourceDecoration()).setBackgroundColor(c);
+ }
+ if(getTargetDecoration() instanceof Shape){
+ ((Shape)getTargetDecoration()).setForegroundColor(c);
+ ((Shape)getTargetDecoration()).setBackgroundColor(c);
+ }
+ }
+ }
+
+ static abstract class MessageLabelEditPart extends LabelEditPart {
+
+ public MessageLabelEditPart(View view) {
+ super(view);
+ }
+
+ protected void handleNotificationEvent(Notification notification) {
+ Object feature = notification.getFeature();
+ if(NotationPackage.eINSTANCE.getLineStyle_LineColor().equals(feature)) {
+ refreshFontColor();
+ } else
+ super.handleNotificationEvent(notification);
+ }
+
+ @Override
+ public void refreshFontColor() {
+ FontStyle style = (FontStyle)((org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)getParent()).getPrimaryView().getStyle(NotationPackage.Literals.FONT_STYLE);
+ if(style != null) {
+ setFontColor(DiagramColorRegistry.getInstance().getColor(Integer.valueOf(style.getFontColor())));
+ }
+ }
+
+ public void refreshFont() {
+ super.refreshFont();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ExecutionSpecificationEndEditPart.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ExecutionSpecificationEndEditPart.java
new file mode 100644
index 00000000000..fac23c92c04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ExecutionSpecificationEndEditPart.java
@@ -0,0 +1,595 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Locator;
+import org.eclipse.draw2d.RelativeLocator;
+import org.eclipse.draw2d.geometry.Point;
+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.EcoreFactory;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.ConnectionEditPart;
+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.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.DropRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+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.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
+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.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.IAnchorableFigure;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.gef.ui.figures.SlidableOvalAnchor;
+import org.eclipse.gmf.runtime.gef.ui.internal.figures.CircleFigure;
+import org.eclipse.gmf.runtime.notation.Anchor;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.impl.ShapeImpl;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+public class ExecutionSpecificationEndEditPart extends GraphicalEditPart
+ implements INodeEditPart {
+
+ private static final String DUMMY_TYPE = "999998";
+ private static final int DEFAULT_SIZE = 16;
+ private Locator locator;
+ private OccurrenceSpecification executionSpecificationEnd;
+
+ public ExecutionSpecificationEndEditPart(OccurrenceSpecification occurrenceSpecification, ShapeNodeEditPart parent, RelativeLocator locator ) {
+ super(createDummyView(parent, occurrenceSpecification) );
+ this.executionSpecificationEnd = occurrenceSpecification;
+ this.setParent(parent);
+ this.locator = locator;
+ addToResource(parent.getNotationView(), this.getNotationView());
+ }
+
+ private static EObject createDummyView(ShapeNodeEditPart parent,
+ EObject model) {
+ final Shape node = new ShapeImpl() {
+ public boolean eNotificationRequired() {
+ return true;
+ }
+ };
+
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(DUMMY_TYPE);
+ node.setElement(model);
+
+ return node;
+ }
+
+ protected void handleNotificationEvent(Notification notification) {
+ Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getView_SourceEdges().equals(feature))
+ refreshSourceConnections();
+ else if (NotationPackage.eINSTANCE.getView_TargetEdges()
+ .equals(feature))
+ refreshTargetConnections();
+ else
+ super.handleNotificationEvent(notification);
+ }
+
+ protected void addNotationalListeners() {
+ if (hasNotationView()) {
+ addListenerFilter("View", this,(View)getModel());
+ }
+ }
+
+ static class DummyCommand extends org.eclipse.emf.common.command.AbstractCommand {
+ public void execute() {
+ }
+
+ public void redo() {
+ }
+
+ public void undo() {
+ }
+
+ protected boolean prepare() {
+ return true;
+ }
+ }
+
+ private void addToResource(final View container, final View view) {
+ CommandHelper.executeCommandWithoutHistory(getEditingDomain(), new DummyCommand() {
+ public void execute() {
+ ViewUtil.insertChildView(container, view,-1, false);
+ }
+ },true);
+ }
+
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ExecutionSpecificationEndSemanticEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ExecutionSpecificationEndGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy(){
+ protected void addSelectionHandles() { // remove handles
+ }
+ });
+ }
+
+ public void rebuildLinks(Diagram diagram) {
+ helper.collectViews(diagram);
+ EObject semanticModel = this.resolveSemanticElement();
+ EAnnotation annotation = executionSpecificationEnd.getEAnnotation("Connections");
+ if (annotation != null) {
+ for (EObject eo : annotation.getReferences()) {
+ View view = helper.findView(eo);
+ if (view == null)
+ continue; // should not happen
+
+ EList edges = view.getSourceEdges();
+ for (Object o : edges) {
+ if (o instanceof Edge ) {
+ if(needRestoreLink((Edge) o)) {
+ restoreEdgeTarget((Edge) o);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private boolean needRestoreLink(Edge e) {
+ if(e.getTarget() == null)
+ return true;
+
+ EObject model = e.getTarget().getElement();
+ if(!(model instanceof OccurrenceSpecification))
+ return false;
+
+ if(model == this.resolveSemanticElement()) {
+ System.out.println( ((OccurrenceSpecification) model).getName() );
+ if(!this.getNotationView().equals( e.getTarget()))
+ return true;
+ }
+ return false;
+ }
+
+ private void restoreEdgeTarget(final Edge edge) {
+ CommandHelper.executeCommandWithoutHistory(this.getEditingDomain(), new DummyCommand() {
+ public void execute() {
+ edge.setTarget((View) ExecutionSpecificationEndEditPart.this
+ .getModel());
+ }
+ },true);
+ }
+
+ static ViewHelper helper = new ViewHelper();
+
+ static class ViewHelper {
+ Diagram diagram = null;
+ Set<View> allViews = new HashSet<View>();
+ Map<EObject, View> viewMaps = new HashMap<EObject, View>();
+
+ View findView(EObject key) {
+ return viewMaps.get(key);
+ }
+
+ void collectViews(Diagram d) {
+ if (diagram != d) { // compare pointer ref
+ diagram = d;
+ allViews.clear();
+ viewMaps.clear();
+
+ getAllNestedViews(diagram, allViews);
+ for (View v : allViews) {
+ if (v instanceof DecorationNode)
+ continue;
+
+ viewMaps.put(v.getElement(), v);
+ }
+ }
+ }
+
+ static private void getAllNestedViews(View view, Set<View> allViews) {
+ for (View childView : (List<View>) view.getChildren()) {
+ getAllNestedViews(childView, allViews);
+ allViews.add(childView);
+ }
+ }
+ }
+
+ static class ExecutionSpecificationEndGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
+ IFigure executionSpecificationEndFeedback;
+
+ @Override
+ public void eraseTargetFeedback(Request request) {
+ super.eraseSourceFeedback(request);
+ if (executionSpecificationEndFeedback != null)
+ removeFeedback(executionSpecificationEndFeedback);
+ executionSpecificationEndFeedback = null;
+ }
+
+ protected void showTargetConnectionFeedback(
+ DropRequest request) {
+ if (executionSpecificationEndFeedback == null) {
+ CircleFigure c = new CircleFigure(DEFAULT_SIZE,
+ DEFAULT_SIZE);
+ c.setForegroundColor(ColorConstants.black);
+ ExecutionSpecificationEndEditPart p = (ExecutionSpecificationEndEditPart) getHost();
+ IFigure parent = p.getFigure().getParent();
+
+
+ Rectangle targetBounds = p.getFigure().getBounds().getCopy();
+ p.getFigure().translateToAbsolute(targetBounds);
+ //targetBounds.translate(0, DEFAULT_SIZE /2 );
+
+ getFeedbackLayer().translateToRelative(targetBounds);
+ getFeedbackLayer().translateFromParent(targetBounds);
+
+ c.setBounds(targetBounds);
+
+ addFeedback(c);
+ executionSpecificationEndFeedback = c;
+ }
+ }
+ }
+
+ static class ReorientExecutionSpecificationEndCommand extends EditElementCommand{
+ private ReorientReferenceRelationshipRequest request;
+
+ public ReorientExecutionSpecificationEndCommand(ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), request.getNewRelationshipEnd(), request);
+ this.request = request;
+ }
+
+ public boolean canExecute() {
+ return true;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ // adding new end
+ if(request.getNewRelationshipEnd() instanceof OccurrenceSpecification) {
+ ExecutionSpecificationEndHelper.addConnectionSourceToExecutionSpecificationEnd((OccurrenceSpecification) request.getNewRelationshipEnd(), request.getReferenceOwner());
+ // update uml model reference
+ if(request.getReferenceOwner() instanceof Constraint) {
+ ((Constraint)request.getReferenceOwner()).getConstrainedElements().add((OccurrenceSpecification) request.getNewRelationshipEnd());
+ }else if(request.getReferenceOwner() instanceof Comment) {
+ ((Comment) request.getReferenceOwner()).getAnnotatedElements().add( (OccurrenceSpecification) request.getNewRelationshipEnd());
+ }
+ }
+ // removing old end
+ if(request.getOldRelationshipEnd() instanceof OccurrenceSpecification) {
+ ExecutionSpecificationEndHelper.removeConnectionSourceFromExecutionSpecificationEnd((OccurrenceSpecification) request.getOldRelationshipEnd(), request.getReferenceOwner());
+ // update uml model reference
+ if(request.getReferenceOwner() instanceof Constraint) {
+ ((Constraint)request.getReferenceOwner()).getConstrainedElements().remove((OccurrenceSpecification) request.getOldRelationshipEnd());
+ }else if(request.getReferenceOwner() instanceof Comment) {
+ ((Comment) request.getReferenceOwner()).getAnnotatedElements().remove( (OccurrenceSpecification) request.getOldRelationshipEnd());
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ }
+
+ static class ExecutionSpecificationEndSemanticEditPolicy extends SemanticEditPolicy{
+
+ protected Command getSemanticCommand(
+ final IEditCommandRequest request) {
+ if (request instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest) request);
+ }
+ else if( request instanceof ReorientReferenceRelationshipRequest) {
+ return getGEFWrapper(new ReorientExecutionSpecificationEndCommand((ReorientReferenceRelationshipRequest) request ) ) ;
+ }
+ Command cmd = super.getSemanticCommand(request);
+ return cmd;
+ }
+
+ protected Command getStartCreateRelationshipCommand(
+ CreateRelationshipRequest req) {
+ if (UMLElementTypes.ConstraintConstrainedElement_4011 == req
+ .getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommandEx(
+ req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ protected Command getCompleteCreateRelationshipCommand(
+ CreateRelationshipRequest req) {
+ if (UMLElementTypes.ConstraintConstrainedElement_4011 == req
+ .getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommandEx(
+ req, req.getSource(), req.getTarget()));
+ }else if(UMLElementTypes.CommentAnnotatedElement_4010 == req
+ .getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommandEx(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ protected Command getCreateRelationshipCommand(
+ CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
+ : getCompleteCreateRelationshipCommand(req);
+ return command;
+ }
+
+ protected final Command getGEFWrapper(ICommand cmd) {
+ return new ICommandProxy(cmd);
+ }
+ }
+
+ public static class ExecutionSpecificationEndHelper{
+ public static void removeConnectionSourceFromExecutionSpecificationEnd(OccurrenceSpecification executionOccurrence , EObject connectionSource) {
+ EAnnotation annotation = executionOccurrence
+ .getEAnnotation("Connections");
+ if (annotation != null) {
+ annotation.getReferences().remove( connectionSource);
+ }
+ }
+
+ public static void addConnectionSourceToExecutionSpecificationEnd(OccurrenceSpecification executionOccurrence,EObject connectionSource) {
+ EAnnotation annotation = executionOccurrence
+ .getEAnnotation("Connections");
+ if (annotation == null) {
+ annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource("Connections"); //$NON-NLS-1$
+ executionOccurrence.getEAnnotations().add(annotation);
+ }
+ if( !annotation.getReferences().contains( connectionSource) )
+ annotation.getReferences().add(connectionSource);
+ }
+ }
+
+ static class CommentAnnotatedElementCreateCommandEx extends CommentAnnotatedElementCreateCommand{
+
+ public CommentAnnotatedElementCreateCommandEx(
+ CreateRelationshipRequest request, EObject source,
+ EObject target) {
+ super(request, source, target);
+ }
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ CommandResult res = super.doExecuteWithResult(monitor, info);
+ if (getTarget() instanceof OccurrenceSpecification) {
+ ExecutionSpecificationEndHelper.addConnectionSourceToExecutionSpecificationEnd((OccurrenceSpecification) getTarget(), getSource());
+ }
+ return res;
+ }
+ }
+
+ static class ConstraintConstrainedElementCreateCommandEx extends
+ ConstraintConstrainedElementCreateCommand {
+
+ public ConstraintConstrainedElementCreateCommandEx(
+ CreateRelationshipRequest request, EObject source,
+ EObject target) {
+ super(request, source, target);
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+
+ CommandResult res = super.doExecuteWithResult(monitor, info);
+ if (getTarget() instanceof OccurrenceSpecification) {
+ ExecutionSpecificationEndHelper.addConnectionSourceToExecutionSpecificationEnd((OccurrenceSpecification) getTarget(), getSource());
+ }
+ return res;
+ }
+ }
+
+ public Locator getLocator() {
+ return locator;
+ }
+
+ protected IFigure createFigure() {
+ IFigure fig = new ExecutionSpecificationEndFigure();
+ fig.setForegroundColor(ColorConstants.black);
+// Rectangle b = fig.getBounds();
+// final ExecutionOccurrenceSpecification model = (ExecutionOccurrenceSpecification) this.resolveSemanticElement();
+// Label tooltip = new Label();
+// tooltip.setText(model.getName());
+// fig.setToolTip(tooltip);
+
+ fig.setOpaque(false);
+ return fig;
+ }
+
+ public boolean hasNotationView() {
+ return true;
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(
+ ConnectionEditPart connection) {
+ return null;
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(
+ ConnectionEditPart connEditPart) {
+ final ConnectionNodeEditPart connection = (ConnectionNodeEditPart) connEditPart;
+ String t = ""; //$NON-NLS-1$
+ try {
+ t = (String) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ Anchor a = ((Edge) connection.getModel())
+ .getTargetAnchor();
+ if (a instanceof IdentityAnchor)
+ setResult(((IdentityAnchor) a).getId());
+ else
+ setResult(""); //$NON-NLS-1$
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "getTargetConnectionAnchor", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "getTargetConnectionAnchor", e); //$NON-NLS-1$
+ }
+ IAnchorableFigure fig = ((IAnchorableFigure) getFigure());
+ ConnectionAnchor a = fig.getConnectionAnchor(t);
+ return a;
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ Point center = getFigure().getBounds().getCenter();
+ getFigure().translateToAbsolute(center);
+ Point pt = ((DropRequest) request).getLocation() == null ? center
+ : new Point(((DropRequest) request).getLocation());
+ if (request instanceof CreateRequest) {
+ getFigure().translateToRelative(pt);
+ }
+ ConnectionAnchor a = ((IAnchorableFigure) getFigure())
+ .getTargetConnectionAnchorAt(pt);
+ return a;
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ return null;
+ }
+
+ public boolean canAttachNote() {
+ return true;
+ }
+
+ public String mapConnectionAnchorToTerminal(ConnectionAnchor c) {
+ return ((IAnchorableFigure) getFigure()).getConnectionAnchorTerminal(c);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapTerminalToConnectionAnchor(String)
+ */
+ public ConnectionAnchor mapTerminalToConnectionAnchor(String terminal) {
+ return ((IAnchorableFigure) getFigure()).getConnectionAnchor(terminal);
+ }
+
+ protected List getModelSourceConnections() {
+ return ViewUtil
+ .getSourceConnectionsConnectingVisibleViews((View) getModel());
+ }
+
+ protected List getModelTargetConnections() {
+ List list = ViewUtil
+ .getTargetConnectionsConnectingVisibleViews((View) getModel());
+ return list;
+ }
+
+ @Override
+ public EditPart getTargetEditPart(Request request) {
+ if(request instanceof CreateUnspecifiedTypeConnectionRequest){
+ List types = ((CreateUnspecifiedTypeConnectionRequest) request).getElementTypes();
+ if(types.contains(UMLElementTypes.CommentAnnotatedElement_4010) || types.contains(UMLElementTypes.ConstraintConstrainedElement_4011)){
+ return super.getTargetEditPart(request);
+ }
+ }else if(request instanceof ReconnectRequest){
+ ConnectionEditPart con = ((ReconnectRequest)request).getConnectionEditPart();
+ if(con instanceof CommentAnnotatedElementEditPart || con instanceof ConstraintConstrainedElementEditPart){
+ return super.getTargetEditPart(request);
+ }
+ }
+ return null;
+ }
+
+ static class ExecutionSpecificationEndAnchor extends SlidableOvalAnchor {
+
+ public ExecutionSpecificationEndAnchor(CircleFigure circleFigure, PrecisionPoint p) {
+ super(circleFigure, p);
+ }
+
+ public ExecutionSpecificationEndAnchor(CircleFigure circleFigure) {
+ super(circleFigure);
+ }
+
+ public Point getLocation(Point reference) {
+ return getBox().getCenter();
+ }
+ }
+
+ class ExecutionSpecificationEndFigure extends CircleFigure {
+ ExecutionSpecificationEndFigure() {
+ super(DEFAULT_SIZE, DEFAULT_SIZE);
+ }
+
+ @Override
+ protected void paintFigure(Graphics g) {
+ Rectangle r = Rectangle.SINGLETON;
+ r.setBounds(getBounds());
+ r.width--;
+ r.height--;
+ // Hide
+ //g.drawOval(r);
+ }
+
+ protected ConnectionAnchor createAnchor(PrecisionPoint p) {
+ if (p == null)
+ return createDefaultAnchor();
+ return new ExecutionSpecificationEndAnchor(this, p);
+ }
+
+ protected ConnectionAnchor createDefaultAnchor() {
+ return new ExecutionSpecificationEndAnchor(this);
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchorAt(Point p) {
+ try {
+ return super.getTargetConnectionAnchorAt(p);
+ } catch (Exception e) {
+ return null;
+ }
+ };
+
+ @Override
+ public void validate() {
+ locator.relocate(this); //place figure at north or south, ignore layout manager
+ super.validate();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionFragmentEditPart.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionFragmentEditPart.java
new file mode 100644
index 00000000000..faa739a2ccb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionFragmentEditPart.java
@@ -0,0 +1,206 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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.parts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.sequence.figures.LifelineDotLineCustomFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.PartDecomposition;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public abstract class InteractionFragmentEditPart extends ShapeNodeEditPart {
+
+ public InteractionFragmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * Resize the InteractionFragmentFigure when the covered lifelines are selected in the
+ * properties view.
+ */
+ public void resizeInteractionFragmentFigure() {
+ Object obj = getModel();
+ if(obj instanceof Shape) {
+ // we get the element linked to this editpart
+ EObject element = ((Shape)obj).getElement();
+
+ if(element instanceof InteractionFragment) {
+ // we get the list of the covered lifelinnes by the InteractionUse
+ List<Lifeline> lifelineCoveredList = ((InteractionFragment)element).getCovereds();
+
+ if(lifelineCoveredList != null && getParent() != null) {
+ // we get the interactionCompartimentEditPart to have access to all lifelines
+ // EditParts
+ List<EditPart> childrenEditPart = getParent().getChildren();
+ if(childrenEditPart != null) {
+ // The max value guarantee that the first figure will set the minX value
+ int minX = Integer.MAX_VALUE;
+ int maxX = -Integer.MAX_VALUE;
+ int maxR = -Integer.MAX_VALUE;
+
+ for(EditPart childEditPart : childrenEditPart) {
+ // we check all the EditParts to select only the lifelineEditParts
+ if(childEditPart instanceof LifelineEditPart) {
+ Object childModel = childEditPart.getModel();
+ if(childModel instanceof Shape) {
+ // we get the object Lifeline linked the selected
+ // lifelineEditPart
+ EObject childElement = ((Shape)childModel).getElement();
+ if(childElement instanceof Lifeline) {
+ Lifeline lifeline = (Lifeline)childElement;
+ for(Lifeline lfn : lifelineCoveredList) {
+ // we check if the lifeLine in the intreactionUse's
+ // parent Interaction is a covered Lifeline
+ if(lifeline.equals(lfn)) {
+ LifelineEditPart liflelineEditPart = (LifelineEditPart)childEditPart;
+ if(liflelineEditPart.getFigure().getBounds().x > maxX) {
+ maxX = liflelineEditPart.getFigure().getBounds().x;
+ // the maxR will represent the futur value of
+ // the rectangle right value.
+ maxR = liflelineEditPart.getFigure().getBounds().right();
+
+ }
+ if(liflelineEditPart.getFigure().getBounds().x < minX) {
+ // the min value will represent the rectangle x
+ // value.
+ minX = liflelineEditPart.getFigure().getBounds().x;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(minX != Integer.MAX_VALUE || maxR != -Integer.MAX_VALUE) {
+ // after this loop we have the coordinate of two lifeline figure ,
+ // even if we have more than two covered Lifelne we choose the
+ // extremities.
+ getNewSize(minX, maxR);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * resize the interactinUse figure
+ *
+ * @param min
+ * the min x position of a covered lifline
+ * @param max
+ * the max x position of a coverd lifeline
+ *
+ */
+ private void getNewSize(int min, int max) {
+ int h = getFigure().getBounds().height;
+ int y = getFigure().getBounds().y;
+
+ Dimension size = new Dimension(max - min, h);
+
+ Point loc = new Point(min, y);
+
+ ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * Update covered lifelines of a Interaction fragment
+ *
+ * @param newBounds
+ */
+ public void updateCoveredLifelines(Bounds newBounds) {
+ Rectangle newBound = new Rectangle(newBounds.getX(), newBounds.getY(), newBounds.getWidth(), newBounds.getHeight());
+ InteractionFragment combinedFragment = (InteractionFragment)resolveSemanticElement();
+ EList<Lifeline> coveredLifelines = combinedFragment.getCovereds();
+
+ List<Lifeline> coveredLifelinesToAdd = new ArrayList<Lifeline>();
+ List<Lifeline> coveredLifelinesToRemove = new ArrayList<Lifeline>();
+ EditPart interactionCompartment = getInteractionCompartment();
+ if(interactionCompartment != null) {
+ this.getFigure().translateToAbsolute(newBound);
+ for(Object child : interactionCompartment.getChildren()) {
+ if(child instanceof LifelineEditPart) {
+ LifelineEditPart lifelineEditPart = (LifelineEditPart)child;
+ updateCoveredLifelines(lifelineEditPart, newBound, coveredLifelinesToAdd, coveredLifelinesToRemove, coveredLifelines);
+ }
+ }
+ }
+ if(!coveredLifelinesToAdd.isEmpty()) {
+ CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), combinedFragment, UMLPackage.eINSTANCE.getInteractionFragment_Covered(), coveredLifelinesToAdd), true);
+ }
+ if(!coveredLifelinesToRemove.isEmpty()) {
+ CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), combinedFragment, UMLPackage.eINSTANCE.getInteractionFragment_Covered(), coveredLifelinesToRemove), true);
+ }
+
+ }
+
+ // check lifelines in PartDecomposition, see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=364813
+ private void updateCoveredLifelines(LifelineEditPart lifelineEditPart, Rectangle newBound, List<Lifeline> coveredLifelinesToAdd, List<Lifeline> coveredLifelinesToRemove, EList<Lifeline> coveredLifelines) {
+ Lifeline lifeline = (Lifeline)lifelineEditPart.resolveSemanticElement();
+
+ LifelineDotLineCustomFigure dotLineFigure = lifelineEditPart.getPrimaryShape().getFigureLifelineDotLineFigure();
+ Rectangle dotLineBounds = dotLineFigure.getBounds().getCopy();
+ Rectangle centralLineBounds = new Rectangle(dotLineBounds.x() + dotLineBounds.width() / 2, dotLineBounds.y(), 1, dotLineBounds.height());
+ dotLineFigure.translateToAbsolute(centralLineBounds);
+ if(newBound.intersects(centralLineBounds)) {
+ if(!coveredLifelines.contains(lifeline)) {
+ coveredLifelinesToAdd.add(lifeline);
+ }
+ } else if(coveredLifelines.contains(lifeline)) {
+ coveredLifelinesToRemove.add(lifeline);
+ }
+
+ PartDecomposition partDecomposition = lifeline.getDecomposedAs();
+ if(partDecomposition != null) {
+ List subLifelines = lifelineEditPart.getChildren();
+ for(Object child : subLifelines) {
+ if(child instanceof LifelineEditPart) {
+ updateCoveredLifelines((LifelineEditPart)child, newBound, coveredLifelinesToAdd, coveredLifelinesToRemove, coveredLifelines);
+ }
+ }
+ }
+ }
+
+ /**
+ * Find parent editpart of lifeline
+ * @return EditPart
+ */
+ public EditPart getInteractionCompartment() {
+ EditPart editPart = getParent();
+ while (editPart != null
+ && !(editPart instanceof InteractionInteractionCompartmentEditPart)) {
+ editPart = editPart.getParent();
+ }
+ return editPart;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCreationEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCreationEditPolicy.java
new file mode 100644
index 00000000000..54959d4084b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCreationEditPolicy.java
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ * 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 java.util.Set;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.commands.Command;
+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.CreationEditPolicy;
+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.emf.type.core.IHintedType;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.InteractionFragment;
+
+/**
+ * This creation policy is used to move covered interaction fragments into the interaction operand
+ * when creating a new combined fragment.
+ *
+ * @author mvelten
+ *
+ */
+public class CombinedFragmentCreationEditPolicy extends CreationEditPolicy {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
+
+ Command createElementAndViewCmd = super.getCreateElementAndViewCommand(request);
+
+ if(isDerivedCombinedFragment(request.getViewAndElementDescriptor().getSemanticHint())) {
+
+ Rectangle selectionRect = getSelectionRectangle(request);
+
+ Set<InteractionFragment> coveredInteractionFragments = SequenceUtil.getCoveredInteractionFragments(selectionRect, getHost(), null);
+
+ request.getExtendedData().put(SequenceRequestConstant.COVERED_INTERACTIONFRAGMENTS, coveredInteractionFragments);
+
+ // Add updating bounds command for Combined fragment createment
+ String hint = request.getViewAndElementDescriptor().getSemanticHint();
+ if(OperandBoundsComputeHelper.isDerivedCombinedFragment(hint)){
+ if (createElementAndViewCmd instanceof ICommandProxy) {
+ ICommandProxy commandProxy = (ICommandProxy) createElementAndViewCmd;
+ ICommand realCmd = commandProxy.getICommand();
+ if (realCmd instanceof CompositeCommand) {
+ ICommand createUpdateBoundsCmd = OperandBoundsComputeHelper.createUpdateCFAndIOBoundsForCFCreationCommand(this.getHost(),request);
+ if (createUpdateBoundsCmd != null)
+ ((CompositeCommand) realCmd)
+ .add(createUpdateBoundsCmd);
+ }
+ }
+ }
+ }
+ return createElementAndViewCmd;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateViewRequest request) {
+ Command createViewCmd = super.getCreateCommand(request);
+ if (createViewCmd instanceof ICommandProxy) {
+ ICommandProxy commandProxy = (ICommandProxy) createViewCmd;
+ CompositeCommand compositeCommand = null;
+ ICommand realCmd = commandProxy.getICommand();
+ if (realCmd instanceof CompositeCommand) {
+ compositeCommand = (CompositeCommand) realCmd;
+ } else {
+ compositeCommand = new CompositeCommand(commandProxy.getLabel());
+ compositeCommand.add(realCmd);
+ realCmd = compositeCommand;
+ }
+ for (ViewDescriptor viewDescriptor : request.getViewDescriptors()) {
+ String hint = viewDescriptor.getSemanticHint();
+ if(isDerivedCombinedFragment(hint)) {
+ // Add updating bounds command for Combined fragment createment
+ if(OperandBoundsComputeHelper.isDerivedCombinedFragment(hint)){
+ ICommand createUpdateBoundsCmd = OperandBoundsComputeHelper.createUpdateCFAndIOBoundsForCFCreationCommand(this.getHost(), request);
+ if (createUpdateBoundsCmd != null)
+ ((CompositeCommand) realCmd)
+ .add(createUpdateBoundsCmd);
+ }
+ }
+ }
+
+ createViewCmd = new ICommandProxy(compositeCommand.reduce());
+ }
+ return createViewCmd;
+ }
+
+ /**
+ * Retrieve the selection rectangle associated with the request.
+ *
+ * @param request
+ * the request
+ * @return
+ */
+ private Rectangle getSelectionRectangle(CreateViewAndElementRequest request) {
+ Rectangle selectionRect = new Rectangle();
+
+ Point location = request.getLocation();
+ Dimension size = request.getSize();
+
+ if(location != null) {
+ selectionRect.x = location.x;
+ selectionRect.y = location.y;
+ } else {
+ // default values (should not be triggered)
+ selectionRect.x = 100;
+ selectionRect.y = 100;
+ }
+
+ if(size != null) {
+ selectionRect.height = size.height;
+ selectionRect.width = size.width;
+ } else {
+ // default values hardcoded...
+ selectionRect.height = 61;
+ selectionRect.width = 112;
+ }
+
+ return selectionRect;
+ }
+
+ /**
+ * Check if it is a combined fragment or something similar which needs this policy to move ift in the correct container.
+ *
+ * @param hint
+ * the semantic hint
+ * @return
+ */
+ private static boolean isDerivedCombinedFragment(String hint) {
+ if(((IHintedType)UMLElementTypes.InteractionOperand_3005).getSemanticHint().equals(hint)) {
+ return true;
+ }
+ if(((IHintedType)UMLElementTypes.CombinedFragment_3004).getSemanticHint().equals(hint)) {
+ return true;
+ }
+ if(((IHintedType)UMLElementTypes.ConsiderIgnoreFragment_3007).getSemanticHint().equals(hint)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentItemComponentEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentItemComponentEditPolicy.java
new file mode 100644
index 00000000000..6f533edf68e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentItemComponentEditPolicy.java
@@ -0,0 +1,90 @@
+/*****************************************************************************
+ * 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 org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ComponentEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.util.CombinedFragmentDeleteHelper;
+import org.eclipse.uml2.uml.CombinedFragment;
+
+public class CombinedFragmentItemComponentEditPolicy extends ComponentEditPolicy {
+
+ /**
+ * Delete Combined fragment and child from the view. Also delete message if user wants. {@inheritDoc}
+ */
+ @Override
+ protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
+
+ if(getEditingDomain() != null) {
+ CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
+ cmd.setTransactionNestingEnabled(true);
+
+ CommandProxy deleteView = new CommandProxy(super.createDeleteViewCommand(deleteRequest));
+ if(getEObject() instanceof CombinedFragment) {
+ CombinedFragment cf = (CombinedFragment)getEObject();
+ CombinedFragmentEditPart host = (CombinedFragmentEditPart)getHost();
+
+ ICommand prompt = CombinedFragmentDeleteHelper.createDeleteViewCommand(cf, getEditingDomain(), host);
+ cmd.add(prompt);
+ }
+ cmd.add(deleteView);
+ return new ICommandProxy(cmd.reduce());
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Copy from superclass as visibility is private
+ *
+ * @return the editing domain
+ */
+ private TransactionalEditingDomain getEditingDomain() {
+ if(getHost() instanceof IGraphicalEditPart) {
+ return ((IGraphicalEditPart)getHost()).getEditingDomain();
+ } else if(getHost() instanceof IEditingDomainProvider) {
+ Object domain = ((IEditingDomainProvider)getHost()).getEditingDomain();
+ if(domain instanceof TransactionalEditingDomain) {
+ return (TransactionalEditingDomain)domain;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the EObject of the host
+ *
+ * @return the EObject or null
+ */
+ private EObject getEObject() {
+ if(getHost() instanceof GraphicalEditPart) {
+ return ((GraphicalEditPart)getHost()).resolveSemanticElement();
+ }
+ return null;
+ }
+
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java
new file mode 100644
index 00000000000..9f32b299a1c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * 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 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.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+
+public class CreationOnMessageEditPolicy extends CreationEditPolicy {
+
+ /**
+ * Get the command after updating the request with appropriate occurrences
+ *
+ * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy#getCreateElementAndViewCommand(org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest)
+ *
+ * @param request
+ * the request
+ * @return command or null
+ */
+ @Override
+ protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
+ Map<String, Object> extendedData = request.getExtendedData();
+
+ // record the nearest event if necessary
+ String requestHint = request.getViewAndElementDescriptor().getSemanticHint();
+ if(isCreatedOnOccurrenceSpecification(requestHint)) {
+ EditPart hostPart = getHost();
+ if(hostPart instanceof ConnectionNodeEditPart) {
+ LifelineEditPart sourceLifeline = SequenceUtil.getParentLifelinePart(((ConnectionNodeEditPart)hostPart).getSource());
+ LifelineEditPart targetLifeline = SequenceUtil.getParentLifelinePart(((ConnectionNodeEditPart)hostPart).getTarget());
+ Entry<Point, List<OccurrenceSpecification>> eventAndLocation = null;
+ if(sourceLifeline != null) {
+ eventAndLocation = SequenceUtil.findNearestEvent(request.getLocation(), sourceLifeline);
+ }
+ if(targetLifeline != null && eventAndLocation == null) {
+ eventAndLocation = SequenceUtil.findNearestEvent(request.getLocation(), targetLifeline);
+ }
+ // 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(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);
+ }
+ }
+ }
+ return super.getCreateElementAndViewCommand(request);
+ }
+
+ /**
+ * 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_3021).getSemanticHint();
+ String durCstOnMessage = ((IHintedType)UMLElementTypes.DurationConstraint_3023).getSemanticHint();
+ String durObsOnMessage = ((IHintedType)UMLElementTypes.DurationObservation_3024).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_3019).getSemanticHint();
+ String timeObservationHint = ((IHintedType)UMLElementTypes.TimeObservation_3020).getSemanticHint();
+ return timeConstraintHint.equals(requestHint) || timeObservationHint.equals(requestHint);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomConnectionHandleEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomConnectionHandleEditPolicy.java
new file mode 100644
index 00000000000..552dfa53495
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomConnectionHandleEditPolicy.java
@@ -0,0 +1,64 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.requests.TargetRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConnectionHandleEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.handles.ConnectionHandle;
+import org.eclipse.gmf.runtime.diagram.ui.internal.tools.ConnectionHandleTool;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+
+public final class CustomConnectionHandleEditPolicy extends
+ ConnectionHandleEditPolicy {
+ protected List getHandleFigures() {
+ List list = new ArrayList(2);
+
+ String tooltip;
+ tooltip = buildTooltip(ConnectionHandle.HandleDirection.INCOMING);
+ if (tooltip != null) {
+ list.add(new ConnectionHandle((IGraphicalEditPart) getHost(),
+ ConnectionHandle.HandleDirection.INCOMING, tooltip));
+ }
+
+ tooltip = buildTooltip(ConnectionHandle.HandleDirection.OUTGOING);
+ if (tooltip != null) {
+ ConnectionHandle connectionHandle = new ConnectionHandle(
+ (IGraphicalEditPart) getHost(),
+ ConnectionHandle.HandleDirection.OUTGOING, tooltip);
+ connectionHandle.setDragTracker(new ConnectionHandleTool(
+ connectionHandle) {
+ protected String getCommandName() {
+ if (isInState(STATE_CONNECTION_STARTED
+ | STATE_ACCESSIBLE_DRAG_IN_PROGRESS))
+ return SequenceUtil.OBSERVATION_LINK_REQUEST_END;
+ else
+ return SequenceUtil.OBSERVATION_LINK_REQUEST_START;
+ }
+
+ // see also UMLPaletteFactory.createObservationLinkCreationTool()
+ protected boolean updateTargetUnderMouse() {
+ if (!isTargetLocked()) {
+ EditPart editPart = getCurrentViewer()
+ .findObjectAtExcluding(getLocation(), getExclusionSet(),
+ getTargetingConditional());
+ if (editPart != null)
+ editPart = editPart.getTargetEditPart(getTargetRequest());
+ // fix observation link moving over ExecutionSpecificationEditPart
+ if (getTargetRequest() instanceof TargetRequest)
+ ((TargetRequest) getTargetRequest()).setTargetEditPart(editPart);
+ boolean changed = getTargetEditPart() != editPart;
+ setTargetEditPart(editPart);
+ return changed;
+ } else
+ return false;
+ }
+ });
+ list.add(connectionHandle);
+ }
+
+ return list;
+ }
+} \ No newline at end of file
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java
new file mode 100644
index 00000000000..1d4ca1766c1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java
@@ -0,0 +1,1188 @@
+/*****************************************************************************
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.geometry.Dimension;
+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.CompoundCommand;
+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.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+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.requests.CreateConnectionViewRequest;
+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.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+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.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.commands.wrappers.CommandProxyWithResult;
+import org.eclipse.papyrus.uml.diagram.common.commands.DeferredCreateCommand;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.helper.DurationConstraintHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.DurationObservationHelper;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.command.CreateLocatedConnectionViewCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConsiderIgnoreFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Constraint2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message3EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message5EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message6EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message7EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceLinkMappingHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.CombinedFragment;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+import org.eclipse.uml2.uml.GeneralOrdering;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.InteractionOperand;
+import org.eclipse.uml2.uml.IntervalConstraint;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.TimeObservation;
+
+/**
+ * A policy to support dNd from the Model Explorer in the sequence diagram
+ *
+ */
+public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPolicy {
+ public static final String LIFELINE_MISSING = "There is no representation of lifeline {0}";
+
+ public static final String DIALOG_TITLE = "Element missing";
+
+ public CustomDiagramDragDropEditPolicy() {
+ super(SequenceLinkMappingHelper.getInstance());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Set<Integer> getDroppableElementVisualId() {
+ Set<Integer> elementsVisualId = new HashSet<Integer>();
+ elementsVisualId.add(LifelineEditPart.VISUAL_ID);
+ elementsVisualId.add(ActionExecutionSpecificationEditPart.VISUAL_ID);
+ elementsVisualId.add(BehaviorExecutionSpecificationEditPart.VISUAL_ID);
+
+ elementsVisualId.add(InteractionUseEditPart.VISUAL_ID);
+ elementsVisualId.add(InteractionEditPart.VISUAL_ID);
+ elementsVisualId.add(InteractionOperandEditPart.VISUAL_ID);
+
+ elementsVisualId.add(CombinedFragmentEditPart.VISUAL_ID);
+
+ // CoRegion
+ elementsVisualId.add(CombinedFragment2EditPart.VISUAL_ID);
+
+ elementsVisualId.add(CommentAnnotatedElementEditPart.VISUAL_ID);
+ elementsVisualId.add(ConsiderIgnoreFragmentEditPart.VISUAL_ID);
+
+ elementsVisualId.add(ContinuationEditPart.VISUAL_ID);
+ elementsVisualId.add(StateInvariantEditPart.VISUAL_ID);
+ elementsVisualId.add(CommentEditPart.VISUAL_ID);
+ elementsVisualId.add(CommentBodyEditPart.VISUAL_ID);
+
+ elementsVisualId.add(ConstraintEditPart.VISUAL_ID);
+ elementsVisualId.add(Constraint2EditPart.VISUAL_ID);
+ elementsVisualId.add(ConstraintConstrainedElementEditPart.VISUAL_ID);
+
+ elementsVisualId.add(DurationObservationEditPart.VISUAL_ID);
+ elementsVisualId.add(TimeConstraintEditPart.VISUAL_ID);
+ elementsVisualId.add(TimeObservationEditPart.VISUAL_ID);
+ elementsVisualId.add(DurationConstraintEditPart.VISUAL_ID);
+
+ elementsVisualId.add(PackageEditPart.VISUAL_ID);
+
+ elementsVisualId.add(MessageEditPart.VISUAL_ID);
+ elementsVisualId.add(Message2EditPart.VISUAL_ID);
+ elementsVisualId.add(Message3EditPart.VISUAL_ID);
+ elementsVisualId.add(Message4EditPart.VISUAL_ID);
+ elementsVisualId.add(Message4EditPart.VISUAL_ID);
+ elementsVisualId.add(Message5EditPart.VISUAL_ID);
+ elementsVisualId.add(Message6EditPart.VISUAL_ID);
+ elementsVisualId.add(Message7EditPart.VISUAL_ID);
+ elementsVisualId.add(Message6EditPart.VISUAL_ID);
+ elementsVisualId.add(GeneralOrderingEditPart.VISUAL_ID);
+ elementsVisualId.add(DestructionOccurrenceSpecificationEditPart.VISUAL_ID);
+ elementsVisualId.add(StateInvariantEditPart.VISUAL_ID);
+ elementsVisualId.add(TimeConstraintEditPart.VISUAL_ID);
+ elementsVisualId.add(DurationConstraintEditPart.VISUAL_ID);
+ elementsVisualId.add(DurationConstraintInMessageEditPart.VISUAL_ID);
+ elementsVisualId.add(TimeObservationEditPart.VISUAL_ID);
+ elementsVisualId.add(DurationObservationEditPart.VISUAL_ID);
+ elementsVisualId.add(LifelineEditPart.VISUAL_ID);
+ // handle nodes on messages (no visual ID detected for them)
+ elementsVisualId.add(-1);
+ return elementsVisualId;
+ }
+
+
+ @Override
+ protected IUndoableOperation getDropObjectCommand(
+ DropObjectsRequest dropRequest, final EObject
+ droppedObject) {
+ IUndoableOperation dropObjectCommand = super.getDropObjectCommand(
+ dropRequest, droppedObject);
+ if (dropObjectCommand != null && dropObjectCommand.canExecute()) {
+ return dropObjectCommand;
+ }
+ // fix bug 364696(https://bugs.eclipse.org/bugs/show_bug.cgi?id=364696)
+ if (droppedObject instanceof ConnectableElement) {
+ return doDropConnectableElement(dropRequest,
+ (ConnectableElement) droppedObject);
+ }
+
+ return dropObjectCommand;
+ }
+
+ private IUndoableOperation doDropConnectableElement(
+ DropObjectsRequest dropRequest,
+ final ConnectableElement droppedObject) {
+ Point location = dropRequest.getLocation();
+ CreateViewRequest createShapeRequest = CreateViewRequestFactory
+ .getCreateShapeRequest(UMLElementTypes.Lifeline_3001,
+ UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ createShapeRequest.setLocation(location);
+
+ ViewDescriptor viewDescriptor =createShapeRequest.getViewDescriptors().get(0);
+ CreateElementRequestAdapter elementAdapter =(CreateElementRequestAdapter) viewDescriptor.getElementAdapter();
+ CreateElementRequest createElementRequest = (CreateElementRequest)elementAdapter.getAdapter(CreateElementRequest.class);
+
+ // parameter "ConnectableElement" used in LifelineCreateCommand#doConfigure()
+ createElementRequest.setParameter(SequenceRequestConstant.CONNECTABLE_ELEMENT,droppedObject);
+ EditPart host = getHost();
+ Command theRealCmd = ((IGraphicalEditPart) host)
+ .getCommand(createShapeRequest);
+
+ if (theRealCmd != null && theRealCmd.canExecute()) {
+ return new CommandProxy(theRealCmd);
+ }
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IElementType getUMLElementType(int elementID) {
+ return UMLElementTypes.getElementType(elementID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getNodeVisualID(View containerView, EObject domainElement) {
+ return UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getLinkWithClassVisualID(EObject domainElement) {
+ return UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement);
+ }
+
+ @Override
+ protected Command getSpecificDropCommand(DropObjectsRequest dropRequest, Element semanticElement, int nodeVISUALID, int linkVISUALID) {
+ Point location = dropRequest.getLocation().getCopy();
+
+ // handle specifically the case when node is on a message
+ Command cmd = handleNodeOnMessage(semanticElement, nodeVISUALID, linkVISUALID);
+ if(cmd != null) {
+ return cmd;
+ }
+
+ if(nodeVISUALID != -1) {
+ switch(nodeVISUALID) {
+ case BehaviorExecutionSpecificationEditPart.VISUAL_ID:
+ case ActionExecutionSpecificationEditPart.VISUAL_ID:
+ return dropExecutionSpecification((ExecutionSpecification)semanticElement, nodeVISUALID, location);
+ case DestructionOccurrenceSpecificationEditPart.VISUAL_ID:
+ return dropDestructionOccurrence((DestructionOccurrenceSpecification)semanticElement, nodeVISUALID, location);
+ case StateInvariantEditPart.VISUAL_ID:
+ return dropStateInvariant((StateInvariant)semanticElement, nodeVISUALID, location);
+ case TimeConstraintEditPart.VISUAL_ID:
+ case DurationConstraintEditPart.VISUAL_ID:
+ return dropIntervalConstraintInLifeline((IntervalConstraint)semanticElement, nodeVISUALID);
+ case TimeObservationEditPart.VISUAL_ID:
+ return dropTimeObservationInLifeline((TimeObservation)semanticElement, nodeVISUALID, location);
+ case CombinedFragment2EditPart.VISUAL_ID:
+ return dropCoRegion((CombinedFragment)semanticElement, nodeVISUALID, location);
+ case CommentEditPart.VISUAL_ID:
+ case ConstraintEditPart.VISUAL_ID:
+ case Constraint2EditPart.VISUAL_ID:
+ case InteractionUseEditPart.VISUAL_ID:
+ case LifelineEditPart.VISUAL_ID:
+ return dropNodeElement(semanticElement, nodeVISUALID, location);
+ case ConsiderIgnoreFragmentEditPart.VISUAL_ID:
+ case CombinedFragmentEditPart.VISUAL_ID:
+ return dropCombinedFragment((CombinedFragment)semanticElement, nodeVISUALID, location);
+ case ContinuationEditPart.VISUAL_ID:
+ case InteractionOperandEditPart.VISUAL_ID:
+ return dropCompartmentNodeElement(semanticElement, nodeVISUALID, location);
+ default:
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+
+ if(linkVISUALID != -1) {
+ switch(linkVISUALID) {
+ case MessageEditPart.VISUAL_ID:
+ case Message2EditPart.VISUAL_ID:
+ case Message3EditPart.VISUAL_ID:
+ case Message4EditPart.VISUAL_ID:
+ case Message5EditPart.VISUAL_ID:
+ case Message6EditPart.VISUAL_ID:
+ case Message7EditPart.VISUAL_ID:
+ return dropMessage(dropRequest, semanticElement, linkVISUALID);
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return dropGeneralOrdering(dropRequest, semanticElement, linkVISUALID);
+ default:
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the drop command for the Element
+ *
+ * @param element
+ * the Element
+ * @param nodeVISUALID
+ * the node visual id
+ * @return the drop command if the Element can be dropped
+ */
+ private Command dropNodeElement(Element element, int nodeVISUALID, Point location) {
+ Element parent = element.getOwner();
+ if (getHostObject().equals(parent)) {
+ List<View> existingViews = DiagramEditPartsUtil.findViews(parent, getViewer());
+ if (!existingViews.isEmpty()) {
+ EditPart parentEditPart = lookForEditPart(parent);
+ if (parentEditPart != null) {
+ return new ICommandProxy(getDefaultDropNodeCommand(parentEditPart, nodeVISUALID, location, element));
+ }
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the drop command for the Element
+ *
+ * @param element
+ * the Element
+ * @param nodeVISUALID
+ * the node visual id
+ * @return the drop command if the element can be dropped
+ */
+ private Command dropCombinedFragment(CombinedFragment combinedFragment, int nodeVISUALID, Point location) {
+ Element parent = combinedFragment.getOwner();
+ Element parentContainer = parent.getOwner();
+ if (!(parentContainer instanceof CombinedFragment)) {
+ parentContainer = parent;
+ }
+ if (getHostObject().equals(parentContainer)) {
+ List<View> existingViews = DiagramEditPartsUtil.findViews(parent, getViewer());
+ if (!existingViews.isEmpty()) {
+ EditPart parentEditPart = lookForEditPart(parent);
+ if (parentEditPart instanceof GraphicalEditPart) {
+ // check if all lifelines coversby exist in diagram.
+ Rectangle bounds = null;
+ List<Lifeline> lifelines = combinedFragment.getCovereds();
+ for (Lifeline lifeline : combinedFragment.getCovereds()) {
+ EditPart lifelineEditPart = lookForEditPart(lifeline);
+ if (lifelineEditPart == null) {
+ Shell shell = Display.getCurrent().getActiveShell();
+ MessageDialog.openError(shell, DIALOG_TITLE, NLS.bind(LIFELINE_MISSING, lifeline.getName()));
+ return UnexecutableCommand.INSTANCE;
+ }
+ if (lifelineEditPart instanceof GraphicalEditPart) {
+ GraphicalEditPart graphicalEditPart = (GraphicalEditPart) lifelineEditPart;
+ Rectangle rectangle = graphicalEditPart.getFigure().getBounds().getCopy();
+ graphicalEditPart.getFigure().translateToAbsolute(rectangle);
+ if (bounds == null) {
+ bounds = rectangle;
+ } else {
+ bounds = bounds.union(rectangle);
+ }
+ }
+ }
+ if (bounds == null) {
+ return new ICommandProxy(getDefaultDropNodeCommand(parentEditPart, nodeVISUALID, location, combinedFragment));
+ }
+ location.x = bounds.x;
+
+ return new ICommandProxy(dropCombinedFragment(getHost(), nodeVISUALID, location, new Dimension(bounds.width, 100), combinedFragment));
+ }
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+
+ /*
+ * To extend the method in superclass with an option Dimension size,
+ *
+ *
+ * @param hostEP
+ * @param nodeVISUALID
+ * @param absoluteLocation
+ * @param size
+ * @param droppedObject
+ * @return
+ */
+ protected ICommand dropCombinedFragment(EditPart hostEP, int nodeVISUALID, Point absoluteLocation, Dimension size, EObject droppedObject) {
+ IHintedType type = ((IHintedType)getUMLElementType(nodeVISUALID));
+
+ String semanticHint = null;
+ if (type != null) {
+ semanticHint = type.getSemanticHint();
+ }
+
+ List<View> existingViews = DiagramEditPartsUtil.findViews(droppedObject, getViewer());
+
+ // only allow one view instance of a single element by diagram
+ if(existingViews.isEmpty()) {
+ IAdaptable elementAdapter = new EObjectAdapter(droppedObject);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, semanticHint, ViewUtil.APPEND, true, getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(absoluteLocation);
+ createViewRequest.setSize(size);
+
+ // "ask" the host for a command associated with the
+ // CreateViewRequest
+ Command command = hostEP.getCommand(createViewRequest);
+ if(createViewRequest.getNewObject() instanceof List) {
+ for(Object object : (List<?>)createViewRequest.getNewObject()) {
+ if(object instanceof IAdaptable) {
+ DeferredCreateCommand createCommand2 = new DeferredCreateCommand(getEditingDomain(), droppedObject, (IAdaptable)object, getHost().getViewer());
+ command.chain(new ICommandProxy(createCommand2));
+ }
+ }
+ }
+ // set the viewdescriptor as result
+ // it then can be used as an adaptable to retrieve the View
+ return new CommandProxyWithResult(command, descriptor);
+ }
+
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the drop command in case the element can be handled as an element in a CombinedFragment
+ *
+ * @param element
+ * @param nodeVISUALID
+ * @param location
+ * @return
+ */
+ private Command dropCompartmentNodeElement(Element element, int nodeVISUALID, Point location) {
+ Element parent = element.getOwner();
+ Element directParent = parent;
+ if (parent instanceof InteractionOperand) {
+ parent = parent.getOwner();
+ }
+ if (getHostObject().equals(parent)) {
+ List<View> existingViews = DiagramEditPartsUtil.findViews(directParent, getViewer());
+ if (!existingViews.isEmpty()) {
+ EditPart parentEditPart = lookForEditPart(directParent);
+ if (parentEditPart != null) {
+ return new ICommandProxy(getDefaultDropNodeCommand(parentEditPart, nodeVISUALID, location, element));
+ }
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the drop command in case the element can be handled as a node on a message
+ *
+ * @param semanticElement
+ * the element being dropped from the model
+ * @param nodeVISUALID
+ * node visual id or -1
+ * @param linkVISUALID
+ * link visual id or -1
+ * @return the drop command if the element can be dropped as a message label node, or null otherwise
+ */
+ private Command handleNodeOnMessage(Element semanticElement, int nodeVISUALID, int linkVISUALID) {
+
+ if(nodeVISUALID == -1 && linkVISUALID == -1) {
+ // detect duration observation on a message
+ if(semanticElement instanceof DurationObservation) {
+ List<NamedElement> events = ((DurationObservation)semanticElement).getEvents();
+ if(events.size() >= 2) {
+ return dropMessageNodeBetweenEvents(semanticElement, events.get(0), events.get(1));
+ }
+ }
+ }
+ if(isDurationConstraintHint(nodeVISUALID, linkVISUALID)) {
+ // detect duration constraint on a message
+ if(semanticElement instanceof DurationConstraint) {
+ List<Element> events = ((DurationConstraint)semanticElement).getConstrainedElements();
+ if(events.size() >= 2) {
+ return dropMessageNodeBetweenEvents(semanticElement, events.get(0), events.get(1));
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the command to drop an element between two events in order to create a message label
+ *
+ * @param droppedElement
+ * the dropped element
+ * @param event1
+ * first event (of type MessageOccurrenceSpecification)
+ * @param event2
+ * second event (of type MessageOccurrenceSpecification)
+ * @param element
+ * @return the command or false if the elements can not be dropped as message label
+ */
+ private Command dropMessageNodeBetweenEvents(Element droppedElement, Element event1, Element event2) {
+ if(event1 instanceof MessageOccurrenceSpecification && event2 instanceof MessageOccurrenceSpecification) {
+ if(!event1.equals(event2)) {
+ boolean endsOfSameMessage = false;
+ int visualId = -1;
+ if(droppedElement instanceof DurationConstraint) {
+ visualId = DurationConstraintInMessageEditPart.VISUAL_ID;
+ endsOfSameMessage = DurationConstraintHelper.endsOfSameMessage((OccurrenceSpecification)event1, (OccurrenceSpecification)event2);
+ } else if(droppedElement instanceof DurationObservation) {
+ visualId = DurationObservationEditPart.VISUAL_ID;
+ endsOfSameMessage = DurationObservationHelper.endsOfSameMessage((OccurrenceSpecification)event1, (OccurrenceSpecification)event2);
+ }
+ if(endsOfSameMessage) {
+ Message message = ((MessageOccurrenceSpecification)event1).getMessage();
+ // search a connection which matches the possessing message
+ DiagramEditPart diag = DiagramEditPartsUtil.getDiagramEditPart(getHost());
+ for(Object conn : diag.getConnections()) {
+ if(conn instanceof ConnectionNodeEditPart) {
+ EObject connElt = ((ConnectionNodeEditPart)conn).resolveSemanticElement();
+ if(message.equals(connElt)) {
+ // check that node isn't already represented, or dropping is impossible
+ for(Object child : ((ConnectionNodeEditPart)conn).getChildren()) {
+ if(child instanceof GraphicalEditPart) {
+ EObject childElt = ((GraphicalEditPart)child).resolveSemanticElement();
+ if(droppedElement.equals(childElt)) {
+ return null;
+ }
+ }
+ }
+ return dropNodeOnMessage((PackageableElement)droppedElement, (ConnectionNodeEditPart)conn, visualId);
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Test whether visual ids are compatible with a duration constraint element
+ *
+ * @param nodeVISUALID
+ * the detected node visual id
+ * @param linkVISUALID
+ * the detected link visual id
+ * @return true if element may be a duration constraint
+ */
+ private boolean isDurationConstraintHint(int nodeVISUALID, int linkVISUALID) {
+ if(linkVISUALID != -1) {
+ return false;
+ } else {
+ return nodeVISUALID == -1 || nodeVISUALID == ConstraintEditPart.VISUAL_ID || nodeVISUALID == DurationConstraintEditPart.VISUAL_ID || nodeVISUALID == DurationConstraintInMessageEditPart.VISUAL_ID;
+ }
+ }
+
+ /**
+ * Drop a duration observation or a duration constraint on a message edit part
+ *
+ * @param durationLabelElement
+ * the duration observation or duration constraint to display as message label
+ * @param messageEditPart
+ * the containing message edit part
+ * @param nodeVISUALID
+ * the label node visual id
+ * @return the command or UnexecutableCommand
+ */
+ private Command dropNodeOnMessage(PackageableElement durationLabelElement, ConnectionNodeEditPart messageEditPart, int nodeVISUALID) {
+ IAdaptable elementAdapter = new EObjectAdapter(durationLabelElement);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, false, getDiagramPreferencesHint());
+ return messageEditPart.getCommand(new CreateViewRequest(descriptor));
+ }
+
+ /**
+ * Drop a time observation on a lifeline.
+ *
+ * @param observation
+ * the time constraint
+ * @param nodeVISUALID
+ * the node visual id
+ * @param dropLocation
+ * @return the command if the lifeline is the correct one or UnexecutableCommand
+ */
+ private Command dropTimeObservationInLifeline(TimeObservation observation, int nodeVISUALID, Point dropLocation) {
+ CompoundCommand cc = new CompoundCommand("Drop");
+ IAdaptable elementAdapter = new EObjectAdapter(observation);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, true, getDiagramPreferencesHint());
+ cc.add(getHost().getCommand(new CreateViewRequest(descriptor)));
+
+ LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(getHost());
+ if(lifelinePart != null) {
+ NamedElement occ1 = observation.getEvent();
+ if(occ1 instanceof OccurrenceSpecification) {
+ Point middlePoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification)occ1);
+ if(middlePoint != null) {
+ int height = getDefaultDropHeight(nodeVISUALID);
+ Point startPoint = middlePoint.getCopy();
+ if(height > 0) {
+ startPoint.translate(0, -height / 2);
+ }
+ Rectangle newBounds = new Rectangle(startPoint, new Dimension(-1, height));
+ lifelinePart.getFigure().translateToRelative(newBounds);
+ Point parentLoc = lifelinePart.getLocation();
+ newBounds.translate(parentLoc.getNegated());
+ SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds);
+ cc.add(new ICommandProxy(setBoundsCommand));
+ return cc;
+ }
+ }
+ }
+
+ if(getHost() instanceof InteractionInteractionCompartmentEditPart){
+ Rectangle newBounds = new Rectangle(dropLocation, new Dimension(-1, -1));
+ ((InteractionInteractionCompartmentEditPart)getHost()).getFigure().translateToRelative(newBounds);
+ SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds);
+ cc.add(new ICommandProxy(setBoundsCommand));
+ return cc;
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Drop an interval constraint (duration or time) on a lifeline.
+ *
+ * @param constraint
+ * the interval constraint
+ * @param nodeVISUALID
+ * the node visual id
+ * @return the command if the lifeline is the correct one or UnexecutableCommand
+ */
+ private Command dropIntervalConstraintInLifeline(IntervalConstraint constraint, int nodeVISUALID) {
+ CompoundCommand cc = new CompoundCommand("Drop");
+ IAdaptable elementAdapter = new EObjectAdapter(constraint);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, true, getDiagramPreferencesHint());
+ cc.add(getHost().getCommand(new CreateViewRequest(descriptor)));
+
+ LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(getHost());
+ if(lifelinePart != null && constraint.getConstrainedElements().size() >= 2) {
+ Element occ1 = constraint.getConstrainedElements().get(0);
+ Element occ2 = constraint.getConstrainedElements().get(1);
+ if(occ1 instanceof OccurrenceSpecification && occ2 instanceof OccurrenceSpecification) {
+ Point startPoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification)occ1);
+ Point endPoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification)occ2);
+ if(startPoint != null && endPoint != null) {
+ int height = endPoint.y - startPoint.y;
+ Rectangle newBounds = null;
+ if(height < 0) {
+ newBounds = new Rectangle(endPoint, new Dimension(-1, -height));
+ } else {
+ newBounds = new Rectangle(startPoint, new Dimension(-1, height));
+ }
+ lifelinePart.getFigure().translateToRelative(newBounds);
+ Point parentLoc = lifelinePart.getLocation();
+ newBounds.translate(parentLoc.getNegated());
+ SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds);
+ cc.add(new ICommandProxy(setBoundsCommand));
+ return cc;
+ }
+ }
+ } else if(lifelinePart != null && constraint.getConstrainedElements().size() == 1) {
+ Element occ1 = constraint.getConstrainedElements().get(0);
+ if(occ1 instanceof OccurrenceSpecification) {
+ Point middlePoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification)occ1);
+ if(middlePoint != null) {
+ int height = getDefaultDropHeight(nodeVISUALID);
+ Point startPoint = middlePoint.getCopy();
+ if(height > 0) {
+ startPoint.translate(0, -height / 2);
+ }
+ Rectangle newBounds = new Rectangle(startPoint, new Dimension(-1, height));
+ lifelinePart.getFigure().translateToRelative(newBounds);
+ Point parentLoc = lifelinePart.getLocation();
+ newBounds.translate(parentLoc.getNegated());
+ SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds);
+ cc.add(new ICommandProxy(setBoundsCommand));
+ return cc;
+ }
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the default height to set to a drop object. This method is useful for dropped objects which must be positioned relatively to their center.
+ *
+ * @param nodeVISUALID
+ * the node visual id
+ * @return arbitrary default height for the node visual id (eventually -1)
+ */
+ private int getDefaultDropHeight(int nodeVISUALID) {
+ if(TimeConstraintEditPart.VISUAL_ID == nodeVISUALID || TimeObservationEditPart.VISUAL_ID == nodeVISUALID) {
+ return 2;
+ }
+ return -1;
+ }
+
+ private Command dropStateInvariant(StateInvariant stateInvariant, int nodeVISUALID, Point location) {
+
+ // an StateInvariant covereds systematically a unique lifeline
+ Lifeline lifeline = stateInvariant.getCovereds().get(0);
+ // Check that the container view is the view of the lifeline
+ if(lifeline.equals(getHostObject())) {
+ return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, location, stateInvariant));
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get lifelines element which contains these existingViews
+ *
+ * @param existingViews
+ * the existing views.
+ * @return the list of lifeline.
+ */
+ private List<Lifeline> getLifelines(List<View> existingViews) {
+ List<Lifeline> lifelines = new ArrayList<Lifeline>();
+ for(View view : existingViews) {
+ EObject eObject = ViewUtil.resolveSemanticElement((View)view.eContainer());
+ if(eObject instanceof Lifeline) {
+ lifelines.add((Lifeline)eObject);
+ }
+ }
+ return lifelines;
+ }
+
+ /**
+ * Drop a destructionEvent on a lifeline
+ *
+ * @param destructionOccurence
+ * the destructionEvent to drop
+ * @param nodeVISUALID
+ * the node visualID
+ * @return the command to drop the destructionEvent on a lifeline if allowed.
+ */
+ private Command dropDestructionOccurrence(DestructionOccurrenceSpecification destructionOccurence, int nodeVISUALID, Point location) {
+ // Get all the view of this destructionEvent.
+ List<View> existingViews = DiagramEditPartsUtil.findViews(destructionOccurence, getViewer());
+ // Get the lifelines containing the graphical destructionEvent
+ List<Lifeline> lifelines = getLifelines(existingViews);
+
+ // If the list of lifeline already containing the destructionEvent doesn't contain the lifeline targeted.
+ if(!lifelines.contains(getHostObject())) {
+ Lifeline lifeline = (Lifeline)getHostObject();
+ for(InteractionFragment ift : lifeline.getCoveredBys()) {
+ if(ift instanceof DestructionOccurrenceSpecification) {
+ DestructionOccurrenceSpecification occurrenceSpecification = (DestructionOccurrenceSpecification)ift;
+ // if the event of the occurrenceSpecification is the DestructionEvent, create the command
+ if(destructionOccurence.equals(occurrenceSpecification)) {
+ return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, location, destructionOccurence));
+ }
+ }
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the command to drop an execution specification node
+ *
+ * @param es
+ * execution specification
+ * @param nodeVISUALID
+ * the execution specification's visual id
+ * @param location
+ * the location of the drop request
+ * @return the drop command
+ */
+ private Command dropExecutionSpecification(ExecutionSpecification es, int nodeVISUALID, Point location) {
+ List<View> existingViews = DiagramEditPartsUtil.findViews(es, getViewer());
+ // only allow one view instance of a single element by diagram
+ if(existingViews.isEmpty()) {
+ // Find the lifeline of the ES
+ if(es.getStart() != null && !es.getStart().getCovereds().isEmpty()) {
+ // an Occurrence Specification covers systematically a unique lifeline
+ Lifeline lifeline = es.getStart().getCovereds().get(0);
+ // Check that the container view is the view of the lifeline
+ if(lifeline.equals(getHostObject())) {
+ //return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, location, es));
+
+
+ IHintedType type = ((IHintedType)getUMLElementType(nodeVISUALID));
+
+ String semanticHint = null;
+ if(type != null) {
+ semanticHint = type.getSemanticHint();
+ }
+
+ IAdaptable elementAdapter = new EObjectAdapter(es);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, semanticHint, ViewUtil.APPEND, true, getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ // find best bounds
+ Rectangle bounds = getExecutionSpecificationBounds(es);
+ if(bounds != null) {
+ createViewRequest.setLocation(bounds.getLocation());
+ createViewRequest.setSize(bounds.getSize());
+ } else {
+ createViewRequest.setLocation(location);
+ }
+
+ // "ask" the host for a command associated with the CreateViewRequest
+ Command command = getHost().getCommand(createViewRequest);
+ // set the viewdescriptor as result
+ // it then can be used as an adaptable to retrieve the View
+ return new ICommandProxy(new CommandProxyWithResult(command, descriptor));
+ }
+ }
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the command to drop an code region node
+ *
+ * @param combinedFragment
+ * @param nodeVISUALID
+ * @param location
+ * @return
+ */
+ private Command dropCoRegion(CombinedFragment combinedFragment, int nodeVISUALID, Point location) {
+ List<View> existingViews = DiagramEditPartsUtil.findViews(combinedFragment, getViewer());
+ // only allow one view instance of a single element by diagram
+ if(existingViews.isEmpty()) {
+ IGraphicalEditPart hostEditpart = (IGraphicalEditPart) getHost();
+ EObject element = hostEditpart.getNotationView().getElement();
+ if (element instanceof Lifeline) {
+ IHintedType type = ((IHintedType)getUMLElementType(nodeVISUALID));
+
+ String semanticHint = null;
+ if (type != null) {
+ semanticHint = type.getSemanticHint();
+ }
+
+ IAdaptable elementAdapter = new EObjectAdapter(combinedFragment);
+
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, semanticHint, ViewUtil.APPEND, true, getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(location);
+
+ // "ask" the host for a command associated with the CreateViewRequest
+ Command command = getHost().getCommand(createViewRequest);
+ // set the viewdescriptor as result
+ // it then can be used as an adaptable to retrieve the View
+ return new ICommandProxy(new CommandProxyWithResult(command, descriptor));
+ }
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Get the advised bounds to drop an execution specification
+ *
+ * @param es
+ * the dropped execution specification
+ * @return bounds of the es in absolute coordinates or null
+ */
+ private Rectangle getExecutionSpecificationBounds(ExecutionSpecification es) {
+ Point startLocation = null;
+ Point finishLocation = null;
+ Rectangle possibleStartLocations = null;
+ Rectangle possibleFinishLocations = null;
+ // end events of the link
+ OccurrenceSpecification startEvent = es.getStart();
+ OccurrenceSpecification finishEvent = es.getFinish();
+ if(startEvent != null && finishEvent != null && getHost() instanceof LifelineEditPart) {
+ LifelineEditPart hostLifeline = (LifelineEditPart)getHost();
+ // find location constraints for source
+ startLocation = SequenceUtil.findLocationOfEvent((LifelineEditPart)getHost(), startEvent);
+ if(startLocation == null) {
+ possibleStartLocations = SequenceUtil.findPossibleLocationsForEvent(hostLifeline, startEvent);
+ }
+ // find location constraints for target
+ finishLocation = SequenceUtil.findLocationOfEvent(hostLifeline, finishEvent);
+ if(finishLocation == null) {
+ possibleFinishLocations = SequenceUtil.findPossibleLocationsForEvent(hostLifeline, finishEvent);
+ }
+ // find start and finish locations with correct y (start.y < finish.y) and proportions
+ if(startLocation == null) {
+ if(finishLocation != null) {
+ int top = possibleStartLocations.x;
+ int bottom = possibleStartLocations.bottom();
+ if(top > finishLocation.y) {
+ return null;
+ } else {
+ startLocation = possibleStartLocations.getTop();
+ startLocation.y = (top + Math.min(bottom, finishLocation.y)) / 2;
+ }
+ } else {
+ int topS = possibleStartLocations.y;
+ int bottomS = possibleStartLocations.bottom();
+ int topF = possibleFinishLocations.y;
+ int bottomF = possibleFinishLocations.bottom();
+ if(topS > bottomF) {
+ return null;
+ } else {
+ startLocation = possibleStartLocations.getTop();
+ finishLocation = possibleFinishLocations.getBottom();
+ if(bottomS<topF){
+ startLocation.y = (topS + bottomS) / 2;
+ finishLocation.y = (topF + bottomF) / 2;
+ } else {
+ startLocation.y = (topS + bottomS + topS + topF) / 4;
+ finishLocation.y = (bottomF + topF + bottomF + bottomS) / 4;
+ }
+ }
+ }
+ }
+ if(finishLocation == null) {
+ // startLocation != null
+ int top = possibleFinishLocations.y;
+ int bottom = possibleFinishLocations.bottom();
+ if(bottom < startLocation.y) {
+ return null;
+ } else {
+ finishLocation = possibleFinishLocations.getBottom();
+ finishLocation.y = (bottom + Math.max(top, startLocation.y)) / 2;
+ }
+ }
+ // deduce bounds
+ Rectangle result = new Rectangle(startLocation, finishLocation);
+ result.width = LifelineXYLayoutEditPolicy.EXECUTION_INIT_WIDTH;
+ return result;
+ }
+ return null;
+ }
+
+ /**
+ * Get the command to drop a message link
+ *
+ * @param dropRequest
+ * request to drop
+ * @param semanticLink
+ * message link
+ * @param linkVISUALID
+ * the message's visual id
+ * @return the drop command
+ */
+ private Command dropMessage(DropObjectsRequest dropRequest, Element semanticLink, int linkVISUALID) {
+ Collection<?> sources = SequenceLinkMappingHelper.getInstance().getSource(semanticLink);
+ Collection<?> targets = SequenceLinkMappingHelper.getInstance().getTarget(semanticLink);
+ if(!sources.isEmpty() && !targets.isEmpty()) {
+ Element source = (Element)sources.toArray()[0];
+ Element target = (Element)targets.toArray()[0];
+ return getDropLocatedLinkCommand(dropRequest, source, target, linkVISUALID, semanticLink);
+ } else {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+
+ /**
+ * The method provides command to create the binary link into the diagram. If the source and the
+ * target views do not exist, these views will be created.
+ *
+ * This implementation is very similar to
+ * {@link CommonDiagramDragDropEditPolicy#dropBinaryLink(CompositeCommand, Element, Element, int, Point, Element)}.
+ *
+ * @param dropRequest
+ * the drop request
+ * @param cc
+ * the composite command that will contain the set of command to create the binary
+ * link
+ * @param source
+ * the element source of the link
+ * @param target
+ * the element target of the link
+ * @param linkVISUALID
+ * the link VISUALID used to create the view
+ * @param location
+ * the location the location where the view will be be created
+ * @param semanticLink
+ * the semantic link that will be attached to the view
+ *
+ * @return the composite command
+ */
+ protected Command getDropLocatedLinkCommand(DropObjectsRequest dropRequest, Element source, Element target, int linkVISUALID, Element semanticLink) {
+ // look for editpart
+ GraphicalEditPart sourceEditPart = (GraphicalEditPart)lookForEditPart(source);
+ GraphicalEditPart targetEditPart = (GraphicalEditPart)lookForEditPart(target);
+
+ CompositeCommand cc = new CompositeCommand("Drop");
+
+ // descriptor of the link
+ CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(getUMLElementType(linkVISUALID), ((IHintedType)getUMLElementType(linkVISUALID)).getSemanticHint(), getDiagramPreferencesHint());
+
+ // get source and target adapters, creating the add commands if necessary
+ IAdaptable sourceAdapter = null;
+ IAdaptable targetAdapter = null;
+ if(sourceEditPart == null) {
+ ICommand createCommand = getDefaultDropNodeCommand(getLinkSourceDropLocation(dropRequest.getLocation(), source, target), source);
+ cc.add(createCommand);
+
+ sourceAdapter = (IAdaptable)createCommand.getCommandResult().getReturnValue();
+ } else {
+ sourceAdapter = new SemanticAdapter(null, sourceEditPart.getModel());
+ }
+ if(targetEditPart == null) {
+ ICommand createCommand = getDefaultDropNodeCommand(getLinkTargetDropLocation(dropRequest.getLocation(), source, target), target);
+ cc.add(createCommand);
+
+ targetAdapter = (IAdaptable)createCommand.getCommandResult().getReturnValue();
+ } else {
+ targetAdapter = new SemanticAdapter(null, targetEditPart.getModel());
+ }
+
+ CreateLocatedConnectionViewCommand aLinkCommand = new CreateLocatedConnectionViewCommand(getEditingDomain(), ((IHintedType)getUMLElementType(linkVISUALID)).getSemanticHint(), sourceAdapter, targetAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, null);
+ aLinkCommand.setElement(semanticLink);
+ Point[] sourceAndTarget = getLinkSourceAndTargetLocations(semanticLink, sourceEditPart, targetEditPart);
+ aLinkCommand.setLocations(sourceAndTarget[0], sourceAndTarget[1]);
+ cc.compose(aLinkCommand);
+ return new ICommandProxy(cc);
+ }
+
+ /**
+ * Get the source and target recommended points for creating the link
+ *
+ * @param semanticLink
+ * link to create
+ * @param sourceEditPart
+ * edit part source of the link
+ * @param targetEditPart
+ * edit part target of the link
+ * @return a point array of size 2, with eventually null values (when no point constraint). Index 0 : source location, 1 : target location
+ */
+ private Point[] getLinkSourceAndTargetLocations(Element semanticLink, GraphicalEditPart sourceEditPart, GraphicalEditPart targetEditPart) {
+ // index 0 : source location, 1 : target location
+ Point[] sourceAndTarget = new Point[]{ null, null };
+ // end events of the link
+ OccurrenceSpecification sourceEvent = null;
+ OccurrenceSpecification targetEvent = null;
+ if(semanticLink instanceof Message) {
+ MessageEnd sendEvent = ((Message)semanticLink).getSendEvent();
+ if(sendEvent instanceof OccurrenceSpecification) {
+ sourceEvent = (OccurrenceSpecification)sendEvent;
+ }
+ MessageEnd rcvEvent = ((Message)semanticLink).getReceiveEvent();
+ if(rcvEvent instanceof OccurrenceSpecification) {
+ targetEvent = (OccurrenceSpecification)rcvEvent;
+ }
+ } else if(semanticLink instanceof GeneralOrdering) {
+ sourceEvent = ((GeneralOrdering)semanticLink).getBefore();
+ targetEvent = ((GeneralOrdering)semanticLink).getAfter();
+ }
+ if(sourceEvent != null || targetEvent != null) {
+ Rectangle possibleSourceLocations = null;
+ Rectangle possibleTargetLocations = null;
+ // find location constraints for source
+ if(sourceEvent != null && sourceEditPart instanceof LifelineEditPart) {
+ sourceAndTarget[0] = SequenceUtil.findLocationOfEvent((LifelineEditPart)sourceEditPart, sourceEvent);
+ if(sourceAndTarget[0] == null) {
+ possibleSourceLocations = SequenceUtil.findPossibleLocationsForEvent((LifelineEditPart)sourceEditPart, sourceEvent);
+ }
+ }
+ // find location constraints for target
+ if(targetEvent != null && targetEditPart instanceof LifelineEditPart) {
+ sourceAndTarget[1] = SequenceUtil.findLocationOfEvent((LifelineEditPart)targetEditPart, targetEvent);
+ if(sourceAndTarget[1] == null) {
+ possibleTargetLocations = SequenceUtil.findPossibleLocationsForEvent((LifelineEditPart)targetEditPart, targetEvent);
+ }
+ }
+ // deduce a possibility
+ if(sourceAndTarget[0] == null && possibleSourceLocations != null) {
+ // we must fix the source
+ if(sourceAndTarget[1] == null && possibleTargetLocations == null) {
+ // no target constraint, take center for source
+ sourceAndTarget[0] = possibleSourceLocations.getCenter();
+ } else if(sourceAndTarget[1] != null) {
+ // target is fixed, find arranging source
+ int topSource = possibleSourceLocations.y;
+ int centerSource = possibleSourceLocations.getCenter().y;
+ if(sourceAndTarget[1].y < topSource) {
+ // we would draw an uphill message (forbidden).
+ // return best locations (command will not execute correctly and handle error report)
+ sourceAndTarget[0] = possibleSourceLocations.getTop();
+ } else if(centerSource <= sourceAndTarget[1].y) {
+ // simply fix to the center of constraint
+ sourceAndTarget[0] = possibleSourceLocations.getCenter();
+ } else {
+ // horizontal message makes source as near as possible to the center
+ sourceAndTarget[0] = possibleSourceLocations.getCenter();
+ sourceAndTarget[0].y = sourceAndTarget[1].y;
+ }
+ } else {
+ // possibleTargetLocations !=null
+ // find arranging target and source
+ int centerTarget = possibleTargetLocations.getCenter().y;
+ int bottomTarget = possibleTargetLocations.bottom();
+ int topSource = possibleSourceLocations.y;
+ int centerSource = possibleSourceLocations.getCenter().y;
+ if(bottomTarget < topSource) {
+ // we would draw an uphill message (forbidden).
+ // return best locations (command will not execute correctly and handle error report)
+ sourceAndTarget[0] = possibleSourceLocations.getTop();
+ sourceAndTarget[1] = possibleTargetLocations.getBottom();
+ } else if(centerSource <= centerTarget) {
+ // simply fix to centers
+ sourceAndTarget[0] = possibleSourceLocations.getCenter();
+ sourceAndTarget[1] = possibleTargetLocations.getCenter();
+ } else {
+ // horizontal message makes source and target as near as possible to the centers
+ sourceAndTarget[0] = possibleSourceLocations.getCenter();
+ sourceAndTarget[0].y = (topSource + bottomTarget) / 2;
+ sourceAndTarget[1] = possibleTargetLocations.getCenter();
+ sourceAndTarget[1].y = (topSource + bottomTarget) / 2;
+ }
+ }
+ }
+ if(sourceAndTarget[1] == null && possibleTargetLocations != null) {
+ // we must fix the target
+ // fixedSourceLocation == null => possibleSourceLocations == null
+ // source is fixed, find arranging target
+ int centerTarget = possibleTargetLocations.getCenter().y;
+ int bottomTarget = possibleTargetLocations.bottom();
+ if(sourceAndTarget[0] == null) {
+ // simply fix to the center of constraint
+ sourceAndTarget[1] = possibleTargetLocations.getCenter();
+ } else if(bottomTarget < sourceAndTarget[0].y) {
+ // we would draw an uphill message (forbidden).
+ // return best locations (command will not execute correctly and handle error report)
+ sourceAndTarget[1] = possibleTargetLocations.getBottom();
+ } else if(sourceAndTarget[0].y <= centerTarget) {
+ // simply fix to the center of constraint
+ sourceAndTarget[1] = possibleTargetLocations.getCenter();
+ } else {
+ // horizontal message makes target as near as possible to the center
+ sourceAndTarget[1] = possibleTargetLocations.getCenter();
+ sourceAndTarget[1].y = sourceAndTarget[0].y;
+ }
+ }
+ }
+ return sourceAndTarget;
+ }
+
+ /**
+ * Get the command to drop a general ordering link
+ *
+ * @param dropRequest
+ * request to drop
+ * @param semanticLink
+ * general ordering link
+ * @param linkVISUALID
+ * the link's visual id
+ * @return the drop command
+ */
+ private Command dropGeneralOrdering(DropObjectsRequest dropRequest, Element semanticLink, int linkVISUALID) {
+ Collection<?> sources = SequenceLinkMappingHelper.getInstance().getSource(semanticLink);
+ Collection<?> targets = SequenceLinkMappingHelper.getInstance().getTarget(semanticLink);
+ if(!sources.isEmpty() && !targets.isEmpty()) {
+ Element source = (Element)sources.toArray()[0];
+ Element target = (Element)targets.toArray()[0];
+ return getDropLocatedLinkCommand(dropRequest, source, target, linkVISUALID, semanticLink);
+ } else {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java
new file mode 100644
index 00000000000..f79e0985b19
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+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.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * This policy provides the selection handles, feedback and move command for
+ * external node label.
+ */
+public class CustomExternalLabelPrimaryDragRoleEditPolicy extends ResizableEditPolicyEx {
+
+ @Override
+ protected List<?> createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+
+ @Override
+ protected Command getMoveCommand(ChangeBoundsRequest request) {
+ LabelEditPart editPart = (LabelEditPart)getHost();
+
+ // FeedBack - Port + Delta
+ Rectangle updatedRect = new Rectangle();
+ PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated());
+ updatedRect = updatedRect.getTranslated(request.getMoveDelta());
+
+ // translate the feedback figure
+ PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ getHostFigure().translateToAbsolute(rect);
+ rect.translate(request.getMoveDelta());
+ rect.resize(request.getSizeDelta());
+ getHostFigure().translateToRelative(rect);
+
+ ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedRect);
+ return new ICommandProxy(moveCommand);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java
new file mode 100644
index 00000000000..85f62fa3560
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java
@@ -0,0 +1,461 @@
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - additional features
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import static org.eclipse.papyrus.uml.diagram.common.Activator.log;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+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.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editpolicies.AbstractEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+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.parts.DiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.util.EditPartUtil;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.TimeConstraint;
+import org.eclipse.uml2.uml.TimeObservation;
+
+/**
+ * Edit Policy in charge of the removal of time/duration constraint/observation which no longer have associated events.
+ * <P>
+ * This view checks that the host edit part, a time/duration constraint/observation edit part, has necessary associated events. It listens for model
+ * notifications. As soon as it receives a remove event, it checks whether the time element should be also deleted.<BR/>
+ * </P>
+ */
+public class DeleteTimeElementWithoutEventPolicy extends AbstractEditPolicy implements NotificationListener, IPapyrusListener {
+
+ /** The key to install this edit policy */
+ public static final String KEY = "DeleteTimeElementWithoutEvent";
+
+ /** list of element to listen */
+ protected HashMap<EObject, List<View>> additionalParentToListen = new HashMap<EObject, List<View>>();
+
+ /** stores the host associated semantic element */
+ protected EObject hostSemanticElement;
+
+ /**
+ * Adds additional listeners to the diagram event broker.
+ */
+ @Override
+ public void activate() {
+
+ // retrieve the view and the element associated to the host edit part
+ final View hostView = (View)getHost().getModel();
+ hostSemanticElement = hostView.getElement();
+
+ // adds listener to the event broker, listening for the view and the semantic element associated to the host edit part
+ getDiagramEventBroker().addNotificationListener(hostView, this);
+ getDiagramEventBroker().addNotificationListener(hostSemanticElement, this);
+
+ // retrieve the list of linked view to listen parents
+ for(View linkedView : getLinkedViews()) {
+ getDiagramEventBroker().addNotificationListener(linkedView.eContainer(), this);
+ }
+ super.activate();
+ }
+
+ /**
+ * Removes this edit policy as listener for changes to the specified semanticParent
+ *
+ * @param semanticParent
+ * the semantic parent to stop listen
+ * @param childView
+ * the view that does not requires this additional listener
+ */
+ protected void removeAdditionalParentToListen(EObject semanticParent, View childView) {
+ // removes the view from the list of views that requires a listener for the semantic parent
+ if(additionalParentToListen.containsKey(semanticParent)) {
+ List<View> views = additionalParentToListen.get(semanticParent);
+ assert (views != null) : "list should not be null";
+ views.remove(childView);
+ if(views.isEmpty()) {
+ additionalParentToListen.remove(semanticParent);
+ // check this is not the parent semantic element of the host's semantic element
+ if(!semanticParent.equals(((View)getHost().getModel()).getElement())) {
+ getDiagramEventBroker().removeNotificationListener(semanticParent, this);
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void deactivate() {
+ // retrieve the view and the element associated to the host edit part
+ final View hostView = (View)getHost().getModel();
+
+ // removes all notification listeners for the additional parent to listen
+ for(EObject parent : additionalParentToListen.keySet()) {
+ getDiagramEventBroker().removeNotificationListener(parent, this);
+ }
+ additionalParentToListen.clear();
+ additionalParentToListen = null;
+
+ getDiagramEventBroker().removeNotificationListener(hostView, this);
+ getDiagramEventBroker().removeNotificationListener(hostSemanticElement, this);
+
+ // removes the reference to the semantic element
+ hostSemanticElement = null;
+
+ super.deactivate();
+ }
+
+ /**
+ * Deletes the time element.
+ */
+ protected final void deleteTimeElement() {
+ Command cmd = getDeleteElementCommand(false);
+
+ if(cmd.canExecute()) {
+ executeCommand(cmd);
+ }
+ }
+
+ /**
+ * Deletes a time element view.
+ */
+ protected final void deleteTimeView() {
+ Command cmd = getDeleteElementCommand(true);
+
+ if(cmd.canExecute()) {
+ executeCommand(cmd);
+ }
+ }
+
+ /**
+ * Executes the supplied command inside an <code>unchecked action</code>
+ *
+ * @param cmd
+ * command that can be executed (i.e., cmd.canExecute() == true)
+ */
+ protected void executeCommand(final Command cmd) {
+ Map<String, Boolean> options = null;
+ EditPart ep = getHost();
+ boolean isActivating = true;
+ // use the viewer to determine if we are still initializing the diagram
+ // do not use the DiagramEditPart.isActivating since ConnectionEditPart's
+ // parent will not be a diagram edit part
+ EditPartViewer viewer = ep.getViewer();
+ if(viewer instanceof DiagramGraphicalViewer) {
+ isActivating = ((DiagramGraphicalViewer)viewer).isInitializing();
+ }
+
+ if(isActivating || !EditPartUtil.isWriteTransactionInProgress((IGraphicalEditPart)getHost(), false, false))
+ options = Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
+
+ AbstractEMFOperation operation = new AbstractEMFOperation(((IGraphicalEditPart)getHost()).getEditingDomain(), StringStatics.BLANK, options) {
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ ((IGraphicalEditPart)getHost()).getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ cmd.undo();
+ return Status.OK_STATUS;
+ }
+ };
+ try {
+ operation.execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ log.error(e);
+ }
+ }
+
+ /**
+ * Check if time element is correctly defined
+ *
+ * @return true if it has necessary information, false if it is to be deleted
+ */
+ protected boolean isTimeElementDefined() {
+ if(hostSemanticElement instanceof TimeObservation) {
+ return ((TimeObservation)hostSemanticElement).getEvent() != null;
+ } else if(hostSemanticElement instanceof DurationObservation) {
+ return ((DurationObservation)hostSemanticElement).getEvents().size() >= 2;
+ } else if(hostSemanticElement instanceof TimeConstraint) {
+ return ((TimeConstraint)hostSemanticElement).getConstrainedElements().size() > 0;
+ } else if(hostSemanticElement instanceof DurationConstraint) {
+ /*
+ * Note that DurationConstraint may have only one ConstrainedElement.
+ * But in such a case, we suppose it has not been created as one of the concerned edit parts.
+ */
+ return ((DurationConstraint)hostSemanticElement).getConstrainedElements().size() >= 2;
+ }
+ return true;
+ }
+
+ /**
+ * Get the list of other required figures
+ *
+ * @return list of views
+ */
+ protected List<View> getLinkedViews() {
+ if(getHost() instanceof TimeObservationEditPart && hostSemanticElement instanceof TimeObservation) {
+ LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
+ NamedElement occ = ((TimeObservation)hostSemanticElement).getEvent();
+ if(occ instanceof OccurrenceSpecification) {
+ EditPart part = SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occ);
+ if(part != null) {
+ return Collections.singletonList((View)part.getModel());
+ }
+ }
+ return Collections.emptyList();
+ } else if(getHost() instanceof TimeConstraintEditPart && hostSemanticElement instanceof TimeConstraint) {
+ LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
+ List<Element> occs = ((TimeConstraint)hostSemanticElement).getConstrainedElements();
+ if(occs.size() > 0 & occs.get(0) instanceof OccurrenceSpecification) {
+ EditPart part = SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(0));
+ if(part != null) {
+ return Collections.singletonList((View)part.getModel());
+ }
+ }
+ return Collections.emptyList();
+ } else if(getHost() instanceof DurationConstraintEditPart && hostSemanticElement instanceof TimeConstraint) {
+ LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
+ List<Element> occs = ((TimeConstraint)hostSemanticElement).getConstrainedElements();
+ if(occs.size() >= 2 && occs.get(0) instanceof OccurrenceSpecification && occs.get(1) instanceof OccurrenceSpecification) {
+ EditPart part1 = SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(0));
+ EditPart part2 = SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(1));
+ List<View> list = new ArrayList<View>(2);
+ if(part1 != null) {
+ list.add((View)part1.getModel());
+ }
+ if(part2 != null) {
+ list.add((View)part2.getModel());
+ }
+ return list;
+ }
+ return Collections.emptyList();
+ }
+ // a label on a message always has its parent message
+ return Collections.emptyList();
+ }
+
+ /**
+ * Check if time element has required other figures
+ *
+ * @return true if the time element figure miss one of the figure representing its ends.
+ */
+ protected boolean timeElementMissAnEventFigure() {
+ if(getHost() instanceof TimeObservationEditPart && hostSemanticElement instanceof TimeObservation) {
+ LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
+ NamedElement occ = ((TimeObservation)hostSemanticElement).getEvent();
+ if(occ instanceof OccurrenceSpecification) {
+ return SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occ) == null;
+ }
+ return true;
+ } else if(getHost() instanceof TimeConstraintEditPart && hostSemanticElement instanceof TimeConstraint) {
+ LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
+ List<Element> occs = ((TimeConstraint)hostSemanticElement).getConstrainedElements();
+ if(occs.size() > 0 && occs.get(0) instanceof OccurrenceSpecification) {
+ return SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(0)) == null;
+ }
+ return true;
+ } else if(getHost() instanceof DurationConstraintEditPart && hostSemanticElement instanceof DurationConstraint) {
+ LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
+ List<Element> occs = ((DurationConstraint)hostSemanticElement).getConstrainedElements();
+ if(occs.size() >= 2 && occs.get(0) instanceof OccurrenceSpecification && occs.get(1) instanceof OccurrenceSpecification) {
+ return SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(0)) == null || SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(1)) == null;
+ }
+ return true;
+ }
+ // a label on a message always has its parent message
+ return false;
+ }
+
+ /**
+ * Returns a {@link Command} to delete the host element
+ *
+ * @param graphOnly
+ * true if the view only must be removed
+ * @return the command that destroys the host element
+ */
+ protected Command getDeleteElementCommand(boolean graphOnly) {
+ if(graphOnly) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ return new ICommandProxy(new DeleteCommand(editingDomain, (View)getHost().getModel()));
+ } else {
+ DestroyElementRequest req = new DestroyElementRequest(hostSemanticElement, false);
+ return getDestroyElementCommand(req);
+ }
+ }
+
+ /**
+ * Copied from a generated method from a semantic edit policy which supports the edit element service
+ * @param req the DestroyElementRequest
+ * @return the destroy command
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if(provider != null) {
+ // Retrieve delete command from the Element Edit service
+ ICommand deleteCommand = provider.getEditCommand(req);
+
+ if(deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * Gets the diagram event broker from the editing domain.
+ *
+ * @return the diagram event broker
+ */
+ protected DiagramEventBroker getDiagramEventBroker() {
+ TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ if(theEditingDomain != null) {
+ return DiagramEventBroker.getInstance(theEditingDomain);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void notifyChanged(Notification notification) {
+ Object notifier = notification.getNotifier();
+ if(notifier.equals(hostSemanticElement)) {
+ if(Notification.REMOVE == notification.getEventType() || Notification.SET == notification.getEventType()) {
+ deleteTimeElementIfNeeded();
+ }
+ } else if(notifier instanceof View) {
+ // a view has been modified
+ if(Notification.REMOVE == notification.getEventType()) {
+ deleteTimeElementIfNeeded();
+ }
+ }
+ }
+
+ /**
+ * Removes a listener for the specified view, if it exists.
+ *
+ * @param oldView
+ * the old view to check
+ */
+ protected void removeListenerForView(View oldView) {
+ // create a temp list of elements to delete (iterator concurrent modification..)
+ Map<EObject, List<View>> parentsToDelete = new HashMap<EObject, List<View>>();
+
+ for(EObject parent : additionalParentToListen.keySet()) {
+ List<View> parentViews = additionalParentToListen.get(parent);
+ if(parentViews.contains(oldView)) {
+
+ List<View> views = parentsToDelete.get(parent);
+ if(views == null) {
+ views = new ArrayList<View>();
+ }
+ views.add(oldView);
+ parentsToDelete.put(parent, views);
+ }
+ }
+ }
+
+ /**
+ * Updates the listeners for the specified semantic parent
+ */
+ protected void removeListeners(List<View> impactedViews) {
+ // create a temp list of elements to delete (iterator concurrent modification..)
+ Map<EObject, List<View>> parentsToDelete = new HashMap<EObject, List<View>>();
+
+ // collect the elements to delete
+ for(View view : impactedViews) {
+ for(EObject parent : additionalParentToListen.keySet()) {
+ List<View> parentViews = additionalParentToListen.get(parent);
+ if(parentViews.contains(view)) {
+
+ List<View> views = parentsToDelete.get(parent);
+ if(views == null) {
+ views = new ArrayList<View>();
+ }
+ views.add(view);
+ parentsToDelete.put(parent, views);
+ }
+ }
+ }
+
+ // do the job
+ for(EObject object : parentsToDelete.keySet()) {
+ List<View> views = parentsToDelete.get(object);
+ for(View view : views) {
+ removeAdditionalParentToListen(object, view);
+ }
+ }
+ }
+
+ /**
+ * Check if the time element should be deleted and delete it if necessary.
+ */
+ protected void deleteTimeElementIfNeeded() {
+ if(!isTimeElementDefined()) {
+ // delete the time element
+ deleteTimeElement();
+ }
+ if(timeElementMissAnEventFigure()) {
+ // delete the view
+ deleteTimeView();
+ }
+ }
+
+ /**
+ * launch a weak synchronization. It could be useful in order to clean a diagram by an external tool.
+ */
+ public void forceRefresh() {
+ deleteTimeElementIfNeeded();
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DestructionEventComponentEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DestructionEventComponentEditPolicy.java
new file mode 100644
index 00000000000..429dd145b63
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DestructionEventComponentEditPolicy.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * 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.
+ */
+public class DestructionEventComponentEditPolicy 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/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java
new file mode 100644
index 00000000000..fae1cbee5dd
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * 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.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+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.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.sequence.command.PromptCreateElementAndNodeCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+
+/**
+ * Edit Policy to create an element on a lifeline associated with the creation of a message.
+ * For example it can be used to create a Destruction Event with a Message Delete
+ * or the target Execution Specification with a Message Sync.
+ *
+ * @author Mathieu Velten
+ *
+ */
+public class ElementCreationWithMessageEditPolicy extends LifelineChildGraphicalNodeEditPolicy {
+
+ @Override
+ protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+// CompoundCommand compound = new CompoundCommand();
+
+ Command command = super.getConnectionCompleteCommand(request);
+
+ if(command != null && command.canExecute()) {
+// compound.add(command);
+
+ if(request instanceof CreateConnectionViewAndElementRequest) {
+ CreateConnectionViewAndElementRequest viewRequest = (CreateConnectionViewAndElementRequest)request;
+ EditPart targetEP = getTargetEditPart(viewRequest);
+ EObject target = ViewUtil.resolveSemanticElement((View)targetEP.getModel());
+ EditPart sourceEP = viewRequest.getSourceEditPart();
+ EObject source = ViewUtil.resolveSemanticElement((View)sourceEP.getModel());
+
+ if(getSyncMessageHint().equals(viewRequest.getConnectionViewDescriptor().getSemanticHint()) || getReplyMessageHint().equals(viewRequest.getConnectionViewDescriptor().getSemanticHint())) {
+ if(target instanceof Lifeline ||
+ // handle reflexive synch message by creating a new ES
+ (target instanceof ExecutionSpecification && target.equals(source))) {
+ InteractionFragment ift = SequenceUtil.findInteractionFragmentContainerAt(viewRequest.getLocation(), getHost());
+
+ // retrieve the good execution specification type using the source of the message
+ if(target instanceof ExecutionSpecification) {
+ // retrieve its associated lifeline
+ targetEP = targetEP.getParent();
+ target = ViewUtil.resolveSemanticElement((View)targetEP.getModel());
+ }
+ EditPart sourceEditPart = request.getSourceEditPart();
+ if (sourceEditPart instanceof ActionExecutionSpecificationEditPart || sourceEditPart instanceof BehaviorExecutionSpecificationEditPart) {
+ return new ICommandProxy(new PromptCreateElementAndNodeCommand(command, getEditingDomain(),viewRequest.getConnectionViewDescriptor(),(ShapeNodeEditPart) targetEP, target,sourceEP,request, ift));
+ }
+// IHintedType elementType = null;
+// if(sourceEditPart instanceof ActionExecutionSpecificationEditPart) {
+// elementType = (IHintedType)UMLElementTypes.ActionExecutionSpecification_3006;
+// } else if(request.getSourceEditPart() instanceof BehaviorExecutionSpecificationEditPart) {
+// elementType = (IHintedType)UMLElementTypes.BehaviorExecutionSpecification_3003;
+// }
+//
+//
+// if(elementType != null) {
+// CreateElementAndNodeCommand createExecutionSpecificationCommand = new CreateElementAndNodeCommand(getEditingDomain(), (ShapeNodeEditPart)targetEP, target, elementType, request.getLocation());
+// createExecutionSpecificationCommand.putCreateElementRequestParameter(SequenceRequestConstant.INTERACTIONFRAGMENT_CONTAINER, ift);
+// compound.add(createExecutionSpecificationCommand);
+//
+// // put the anchor at the top of the figure
+// ChangeEdgeTargetCommand changeTargetCommand = new ChangeEdgeTargetCommand(getEditingDomain(), createExecutionSpecificationCommand, viewRequest.getConnectionViewDescriptor(), "(0.5, 0.0)");
+// compound.add(new ICommandProxy(changeTargetCommand));
+// }
+ }
+ }
+ }
+ }
+
+ return command;
+ }
+
+ private static String getSyncMessageHint() {
+ IHintedType message = (IHintedType)UMLElementTypes.Message_4003;
+ return message.getSemanticHint();
+ }
+
+ private static String getReplyMessageHint() {
+ IHintedType message = (IHintedType)UMLElementTypes.Message_4005;
+ return message.getSemanticHint();
+ }
+
+ private TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart)getHost()).getEditingDomain();
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExecutionSpecificationComponentEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExecutionSpecificationComponentEditPolicy.java
new file mode 100644
index 00000000000..f56a16ae63d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExecutionSpecificationComponentEditPolicy.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * 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 java.util.List;
+
+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.requests.GroupRequest;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ComponentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+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.
+ */
+public class ExecutionSpecificationComponentEditPolicy 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.completeDeleteExecutionSpecificationViewCommand(deleteViewsCommand, editingDomain, getHost());
+ addDeleteViewChildrenCommand(deleteViewsCommand, editingDomain, (ShapeNodeEditPart)getHost());
+ }
+ return deleteViewsCommand;
+ }
+
+ // support nested actions and behaviors execution, https://bugs.eclipse.org/bugs/show_bug.cgi?id=384616
+ public static void addDeleteViewChildrenCommand(CompoundCommand deleteViewsCommand, TransactionalEditingDomain editingDomain, ShapeNodeEditPart part) {
+ List<ShapeNodeEditPart> list = LifelineXYLayoutEditPolicy.getAffixedExecutionSpecificationEditParts(part);
+ for(ShapeNodeEditPart p : list){
+ deleteViewsCommand.add( new ICommandProxy(new DeleteCommand(editingDomain, (View) p.getModel())));
+ SequenceDeleteHelper.completeDeleteExecutionSpecificationViewCommand(deleteViewsCommand, editingDomain, p);
+ addDeleteViewChildrenCommand(deleteViewsCommand,editingDomain, p); //recursive delete children
+ }
+ }
+
+ public static void addDestroyElementChildrenCommand(CompoundCommand deleteElementsCommand, TransactionalEditingDomain editingDomain, EditPart part) {
+ List<ShapeNodeEditPart> list = LifelineXYLayoutEditPolicy.getAffixedExecutionSpecificationEditParts((ShapeNodeEditPart)part);
+ for(ShapeNodeEditPart p : list){
+ Request request = new EditCommandRequestWrapper(new DestroyElementRequest(p.resolveSemanticElement(), false));
+ deleteElementsCommand.add(p.getCommand(request));
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
new file mode 100644
index 00000000000..644526d13a0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+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.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * This policy provides the selection handles, feedback and move command for
+ * external node label.
+ * The expected behavior is to provide an external label that can freely move and with a link feedback
+ * towards its parent figure during the move.
+ */
+public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEditPolicy {
+
+ @Override
+ protected List<?> createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+
+ @Override
+ protected Command getMoveCommand(ChangeBoundsRequest request) {
+ LabelEditPart editPart = (LabelEditPart)getHost();
+
+ // FeedBack - Port + Delta
+ Rectangle updatedRect = new Rectangle();
+ PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated());
+ updatedRect = updatedRect.getTranslated(request.getMoveDelta());
+
+ // translate the feedback figure
+ PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ getHostFigure().translateToAbsolute(rect);
+ rect.translate(request.getMoveDelta());
+ rect.resize(request.getSizeDelta());
+ getHostFigure().translateToRelative(rect);
+
+ ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedRect);
+ return new ICommandProxy(moveCommand);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/HighlightConnectionPartEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/HighlightConnectionPartEditPolicy.java
new file mode 100644
index 00000000000..5fcfb78b436
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/HighlightConnectionPartEditPolicy.java
@@ -0,0 +1,46 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import org.eclipse.gef.Request;
+import org.eclipse.gef.editpolicies.AbstractEditPolicy;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.papyrus.uml.diagram.sequence.util.HighlightUtil;
+
+public class HighlightConnectionPartEditPolicy extends AbstractEditPolicy {
+
+ private HighlightUtil sourceHighlighter = new HighlightUtil();
+
+ private HighlightUtil targetHighlighter = new HighlightUtil();
+
+ @Override
+ public void showSourceFeedback(Request request) {
+ if(request instanceof CreateConnectionRequest) {
+ sourceHighlighter.highlight(getHost());
+ }
+ }
+
+ @Override
+ public void showTargetFeedback(Request request) {
+ if(request instanceof CreateConnectionRequest && ((CreateConnectionRequest)request).getSourceEditPart() != null) {
+ targetHighlighter.highlight(getHost());
+ } else if(request instanceof ReconnectRequest && ((ReconnectRequest)request).getTarget() != null) {
+ targetHighlighter.highlight(((ReconnectRequest)request).getTarget());
+ }
+ }
+
+ @Override
+ public void eraseSourceFeedback(Request request) {
+ if(request instanceof CreateConnectionRequest) {
+ sourceHighlighter.unhighlight(getHost());
+ }
+ }
+
+ @Override
+ public void eraseTargetFeedback(Request request) {
+ if(request instanceof CreateConnectionRequest && ((CreateConnectionRequest)request).getSourceEditPart() != null) {
+ targetHighlighter.unhighlight(getHost());
+ } else if(request instanceof ReconnectRequest && ((ReconnectRequest)request).getTarget() != null) {
+ targetHighlighter.unhighlight(((ReconnectRequest)request).getTarget());
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java
new file mode 100644
index 00000000000..d7d3231e5b8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java
@@ -0,0 +1,789 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+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.AlignmentRequest;
+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.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+import org.eclipse.papyrus.uml.diagram.common.commands.PreserveAnchorsPositionCommand;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool.CreateAspectUnspecifiedTypeRequest;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.HighlightUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineMessageCreateHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineResizeHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.CombinedFragment;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.InteractionOperand;
+import org.eclipse.uml2.uml.Lifeline;
+
+/**
+ * The customn XYLayoutEditPolicy for InteractionCompartmentEditPart.
+ */
+public class InteractionCompartmentXYLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ protected Command getCreateCommand(CreateRequest request) {
+ CreateViewRequest req = (CreateViewRequest) request;
+ Command cmd = super.getCreateCommand(request);
+
+ if(cmd != null && req.getSize() != null){ // create lifeline with specific size
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ Iterator iter = req.getViewDescriptors().iterator();
+ while (iter.hasNext()) {
+ CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
+ if (((IHintedType) UMLElementTypes.Lifeline_3001).getSemanticHint().equals(viewDescriptor.getSemanticHint())) {
+ cmd = (new ICommandProxy(LifelineResizeHelper.createManualLabelSizeCommand(editingDomain, viewDescriptor))).chain(cmd);
+ }
+ }
+ }
+ return cmd;
+ }
+
+ /**
+ * Handle lifeline and combined fragment resize
+ */
+ @Override
+ protected Command getResizeChildrenCommand(ChangeBoundsRequest request) {
+ CompoundCommand compoundCmd = new CompoundCommand();
+ compoundCmd.setLabel("Move or Resize");
+
+ IFigure figure = getHostFigure();
+ Rectangle hostBounds = figure.getBounds();
+
+ for(Object o : request.getEditParts()) {
+ GraphicalEditPart child = (GraphicalEditPart)o;
+ Object constraintFor = getConstraintFor(request, child);
+ if (constraintFor instanceof Rectangle) {
+ Rectangle childBounds = (Rectangle) constraintFor;
+ if (childBounds.x < 0 || childBounds.y < 0) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ if(child instanceof LifelineEditPart) {
+ if (isVerticalMove(request)) {
+ addLifelineResizeChildrenCommand(compoundCmd, request, (LifelineEditPart)child, 1);
+ }
+ } else if(child instanceof CombinedFragmentEditPart) {
+ // Add restrictions to change the size
+ if(!OperandBoundsComputeHelper.checkRedistrictOnCFResize(request,child)){
+ return null;
+ }
+ Command resizeChildrenCommand = getCombinedFragmentResizeChildrenCommand(request, (CombinedFragmentEditPart)child);
+ if(resizeChildrenCommand != null && resizeChildrenCommand.canExecute()) {
+ compoundCmd.add(resizeChildrenCommand);
+ }
+// else if(resizeChildrenCommand != null) {
+// return UnexecutableCommand.INSTANCE;
+// }
+ }
+
+ boolean hasCreateLink = LifelineMessageCreateHelper.hasIncomingMessageCreate(child);
+ if(hasCreateLink && !LifelineMessageCreateHelper.canMoveLifelineVertical((LifelineEditPart) child, (Rectangle) translateToModelConstraint(constraintFor)) ){
+ return UnexecutableCommand.INSTANCE;
+ }
+ if(!(child instanceof LifelineEditPart) || isVerticalMove(request) || hasCreateLink) {
+ Command changeConstraintCommand = createChangeConstraintCommand(request, child, translateToModelConstraint(constraintFor));
+
+ // When we change the width by mouse, it passe to manual mode. see https://bugs.eclipse.org/bugs/show_bug.cgi?id=383723
+ if(child instanceof LifelineEditPart && changeConstraintCommand != null && request.getSizeDelta().width != 0){
+ compoundCmd.add(new ICommandProxy(LifelineResizeHelper.createManualLabelSizeCommand((LifelineEditPart)child)));
+ }
+ compoundCmd.add(changeConstraintCommand);
+ }
+
+ if(child instanceof CombinedFragmentEditPart) {
+ OperandBoundsComputeHelper.createUpdateIOBoundsForCFResizeCommand(compoundCmd,request,(CombinedFragmentEditPart)child);
+ }
+
+ int right = childBounds.right();
+ int bottom = childBounds.bottom();
+ int deltaX = 0;
+ int deltaY = 0;
+ if (right > hostBounds.width) {
+ deltaX = right - hostBounds.width;
+ }
+ if (bottom > hostBounds.height) {
+ deltaY = bottom - hostBounds.height;
+ }
+ if (deltaX != 0 || deltaY != 0) {
+ ChangeBoundsRequest boundsRequest = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
+ boundsRequest.setSizeDelta(new Dimension(deltaX, deltaY));
+ EditPart hostParent = getHost().getParent();
+ boundsRequest.setEditParts(hostParent);
+ Command cmd = hostParent.getCommand(boundsRequest);
+ if (cmd != null && cmd.canExecute()) {
+ compoundCmd.add(cmd);
+ }
+ }
+ }
+ }
+ return compoundCmd.unwrap();
+ }
+
+ protected boolean isVerticalMove(ChangeBoundsRequest request) {
+ if (request instanceof AlignmentRequest) {
+ AlignmentRequest alignmentRequest = (AlignmentRequest) request;
+ switch(alignmentRequest.getAlignment()) {
+ case PositionConstants.BOTTOM:
+ case PositionConstants.TOP:
+ case PositionConstants.MIDDLE:
+ case PositionConstants.VERTICAL:
+ case PositionConstants.NORTH_EAST:
+ case PositionConstants.NORTH_WEST:
+ case PositionConstants.SOUTH_EAST:
+ case PositionConstants.SOUTH_WEST:
+ return false;
+ }
+ }
+
+ Point point = request.getMoveDelta();
+ return point.y == 0;
+ }
+
+ /**
+ * Resize children of LifelineEditPart (Execution specification and lifeline)
+ *
+ * @param compoundCmd
+ * The command
+ * @param request
+ * The request
+ * @param lifelineEditPart
+ * The lifelineEditPart to resize
+ * @param number
+ * The number of brother of the LifelineEditPart
+ */
+ public static void addLifelineResizeChildrenCommand(CompoundCommand compoundCmd, ChangeBoundsRequest request, LifelineEditPart lifelineEditPart, int number) {
+ // If the width increases or decreases, ExecutionSpecification elements need to
+ // be moved
+ int widthDelta;
+ for(ShapeNodeEditPart executionSpecificationEP : lifelineEditPart.getChildShapeNodeEditPart()) {
+ if(executionSpecificationEP.resolveSemanticElement() instanceof ExecutionSpecification) {
+ // Lifeline's figure where the child is drawn
+ Rectangle rDotLine = lifelineEditPart.getContentPane().getBounds();
+
+ // The new bounds will be calculated from the current bounds
+ Rectangle newBounds = executionSpecificationEP.getFigure().getBounds().getCopy();
+
+ widthDelta = request.getSizeDelta().width;
+
+ if(widthDelta != 0) {
+
+ if(rDotLine.getSize().width + widthDelta < newBounds.width * 2) {
+ compoundCmd.add(UnexecutableCommand.INSTANCE);
+ }
+
+ // Apply SizeDelta to the children
+ widthDelta = Math.round(widthDelta / ((float)2 * number));
+
+ newBounds.x += widthDelta;
+
+ // Convert to relative
+ newBounds.x -= rDotLine.x;
+ newBounds.y -= rDotLine.y;
+
+ SetBoundsCommand setBoundsCmd = new SetBoundsCommand(executionSpecificationEP.getEditingDomain(), "Re-location of a ExecutionSpecification due to a Lifeline movement", executionSpecificationEP, newBounds);
+ compoundCmd.add(new ICommandProxy(setBoundsCmd));
+ }
+
+ // update the enclosing interaction of a moved execution specification
+ compoundCmd.add(SequenceUtil.createUpdateEnclosingInteractionCommand(executionSpecificationEP, request.getMoveDelta(), new Dimension(widthDelta, 0)));
+ }
+ }
+
+// List<LifelineEditPart> innerConnectableElementList = lifelineEditPart.getInnerConnectableElementList();
+// for(LifelineEditPart lifelineEP : innerConnectableElementList) {
+// addLifelineResizeChildrenCommand(compoundCmd, request, lifelineEP, number * innerConnectableElementList.size());
+// }
+ // fixed bug (id=364711) when lifeline bounds changed update coveredBys'
+ // bounds.
+ addUpdateInteractionFragmentsLocationCommand(compoundCmd, request,
+ lifelineEditPart);
+
+ }
+
+ /**
+ * Resize InteractionFragments if the Lifeline has CoveredBys, while
+ * Lifeline moving.
+ *
+ * @param compoundCmd
+ * @param request
+ * @param lifelineEditPart
+ */
+ private static void addUpdateInteractionFragmentsLocationCommand(
+ CompoundCommand compoundCmd, ChangeBoundsRequest request,
+ LifelineEditPart lifelineEditPart) {
+ View shape = (View) lifelineEditPart.getModel();
+ Lifeline element = (Lifeline) shape.getElement();
+ EList<InteractionFragment> covereds = element.getCoveredBys();
+ EditPart parent = lifelineEditPart.getParent();
+ List<?> children = parent.getChildren();
+ for (Object obj : children) {
+ EditPart et = (EditPart) obj;
+ View sp = (View) et.getModel();
+ if (!covereds.contains(sp.getElement())) {
+ continue;
+ }
+ ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_MOVE);
+ req.setEditParts(et);
+ req.setMoveDelta(request.getMoveDelta());
+ Command command = et.getCommand(req);
+ if (command != null && command.canExecute()) {
+ compoundCmd.add(command);
+ }
+ }
+ }
+
+ /**
+ * Handle the owning of interaction fragments when moving or resizing a CF.
+ *
+ * @param compoundCmd
+ * The command
+ * @param moveDelta
+ * The move delta (given by the request).
+ * @param sizeDelta
+ * The size delta (given by the request).
+ * @param combinedFragmentEditPart
+ * The CF edit part.
+ */
+ @SuppressWarnings("unchecked")
+ public static Command getCombinedFragmentResizeChildrenCommand(ChangeBoundsRequest request, CombinedFragmentEditPart combinedFragmentEditPart) {
+ Point moveDelta = request.getMoveDelta();
+ Dimension sizeDelta = request.getSizeDelta();
+
+ IFigure cfFigure = combinedFragmentEditPart.getFigure();
+ Rectangle origCFBounds = cfFigure.getBounds().getCopy();
+
+ cfFigure.getParent().translateToAbsolute(origCFBounds);
+ origCFBounds.translate(cfFigure.getParent().getBounds().getLocation());
+
+ CompoundCommand compoundCmd = new CompoundCommand();
+
+ // specific case for move :
+ // we want the execution specifications graphically owned by the lifeline to move with the combined fragment, and the contained messages too
+ if(sizeDelta.equals(0, 0)) {
+ // retrieve all the edit parts in the registry
+ Set<Entry<Object, EditPart>> allEditPartEntries = combinedFragmentEditPart.getViewer().getEditPartRegistry().entrySet();
+ for(Entry<Object, EditPart> epEntry : allEditPartEntries) {
+ EditPart ep = epEntry.getValue();
+
+ // handle move of object graphically owned by the lifeline
+ if(ep instanceof ShapeEditPart) {
+ ShapeEditPart sep = (ShapeEditPart)ep;
+ EObject elem = sep.getNotationView().getElement();
+
+ if(elem instanceof InteractionFragment) {
+ IFigure figure = sep.getFigure();
+
+ Rectangle figureBounds = figure.getBounds().getCopy();
+ figure.getParent().translateToAbsolute(figureBounds);
+
+ if(origCFBounds.contains(figureBounds)) {
+ EditPart parentEP = sep.getParent();
+
+ if(parentEP instanceof LifelineEditPart) {
+ ChangeBoundsRequest esRequest = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
+ esRequest.setEditParts(sep);
+ esRequest.setMoveDelta(moveDelta);
+
+ Command moveESCommand = LifelineXYLayoutEditPolicy.getResizeOrMoveChildrenCommand((LifelineEditPart)parentEP, esRequest, true, false, true);
+
+ if(moveESCommand != null && !moveESCommand.canExecute()) {
+ // forbid move if the es can't be moved correctly
+ return UnexecutableCommand.INSTANCE;
+ } else if(moveESCommand != null) {
+ compoundCmd.add(moveESCommand);
+ }
+ }
+ }
+
+ }
+ }
+
+ // handle move of messages directly attached to a lifeline
+ if(ep instanceof ConnectionEditPart) {
+ ConnectionEditPart cep = (ConnectionEditPart)ep;
+
+ Connection msgFigure = cep.getConnectionFigure();
+
+ ConnectionAnchor sourceAnchor = msgFigure.getSourceAnchor();
+ ConnectionAnchor targetAnchor = msgFigure.getTargetAnchor();
+
+ Point sourcePoint = sourceAnchor.getReferencePoint();
+ Point targetPoint = targetAnchor.getReferencePoint();
+
+ Edge edge = (Edge)cep.getModel();
+
+ if(origCFBounds.contains(sourcePoint) && cep.getSource() instanceof LifelineEditPart) {
+ IdentityAnchor gmfAnchor = (IdentityAnchor)edge.getSourceAnchor();
+ Rectangle figureBounds = sourceAnchor.getOwner().getBounds();
+ compoundCmd.add(new ICommandProxy(getMoveAnchorCommand(moveDelta.y, figureBounds, gmfAnchor)));
+ }
+ if(origCFBounds.contains(targetPoint) && cep.getTarget() instanceof LifelineEditPart) {
+ IdentityAnchor gmfAnchor = (IdentityAnchor)edge.getTargetAnchor();
+ Rectangle figureBounds = targetAnchor.getOwner().getBounds();
+ compoundCmd.add(new ICommandProxy(getMoveAnchorCommand(moveDelta.y, figureBounds, gmfAnchor)));
+ }
+ }
+
+ if (ep instanceof DurationConstraintEditPart) {
+ DurationConstraintEditPart dcp = (DurationConstraintEditPart) ep;
+ moveCoveredDurationConstraint(dcp, compoundCmd, origCFBounds, moveDelta);
+ }
+ }
+
+ } else {
+ // calculate the new CF bounds
+ Rectangle newBoundsCF = origCFBounds.getCopy();
+ newBoundsCF.translate(moveDelta);
+ newBoundsCF.resize(sizeDelta);
+
+ CombinedFragment cf = (CombinedFragment)((CombinedFragmentEditPart)combinedFragmentEditPart).resolveSemanticElement();
+
+ if(combinedFragmentEditPart.getChildren().size() > 0 && combinedFragmentEditPart.getChildren().get(0) instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
+
+ CombinedFragmentCombinedFragmentCompartmentEditPart compartment = (CombinedFragmentCombinedFragmentCompartmentEditPart)combinedFragmentEditPart.getChildren().get(0);
+ List<EditPart> combinedFragmentChildrenEditParts = compartment.getChildren();
+ List<InteractionOperandEditPart> interactionOperandEditParts = new ArrayList<InteractionOperandEditPart>();
+
+ InteractionOperand firstOperand = cf.getOperands().get(0);
+
+ // interaction fragments which will not be covered by the operands
+ Set<InteractionFragment> notCoveredAnymoreInteractionFragments = new HashSet<InteractionFragment>();
+ int headerHeight = 0;
+
+ for(EditPart ep : combinedFragmentChildrenEditParts) {
+ if(ep instanceof InteractionOperandEditPart) {
+ InteractionOperandEditPart ioEP = (InteractionOperandEditPart)ep;
+ InteractionOperand io = (InteractionOperand)ioEP.resolveSemanticElement();
+
+ if(cf.getOperands().contains(io)) {
+ interactionOperandEditParts.add(ioEP);
+ // fill with all current fragments (filter later)
+ notCoveredAnymoreInteractionFragments.addAll(io.getFragments());
+
+ if(firstOperand.equals(io)) {
+ Rectangle boundsIO = ioEP.getFigure().getBounds().getCopy();
+ ioEP.getFigure().getParent().translateToAbsolute(boundsIO);
+ headerHeight = boundsIO.y - origCFBounds.y;
+ }
+ }
+ }
+ }
+
+ double heightRatio = (double)(newBoundsCF.height - headerHeight) / (double)(origCFBounds.height - headerHeight);
+ double widthRatio = (double)newBoundsCF.width / (double)origCFBounds.width;
+
+ for(InteractionOperandEditPart ioEP : interactionOperandEditParts) {
+ InteractionOperand io = (InteractionOperand)ioEP.resolveSemanticElement();
+
+ Rectangle newBoundsIO = SequenceUtil.getAbsoluteBounds(ioEP);
+
+ // apply the move delta which will impact all operands
+ newBoundsIO.translate(moveDelta);
+
+ // calculate the new bounds of the interaction operand
+ // scale according to the ratio
+ newBoundsIO.height = (int)(newBoundsIO.height * heightRatio);
+ newBoundsIO.width = (int)(newBoundsIO.width * widthRatio);
+
+ if(firstOperand.equals(io)) {
+ // used to compensate the height of the "header" where the OperandKind is stored
+ newBoundsIO.y -= headerHeight;
+ newBoundsIO.height += headerHeight;
+ }
+
+ // ignore current CF and enclosed IO
+ Set<InteractionFragment> ignoreSet = new HashSet<InteractionFragment>();
+ ignoreSet.add(cf);
+ ignoreSet.addAll(cf.getOperands());
+
+ Set<InteractionFragment> coveredInteractionFragments = SequenceUtil.getCoveredInteractionFragments(newBoundsIO, combinedFragmentEditPart, ignoreSet);
+
+ if(coveredInteractionFragments == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // remove fragments that are covered by this operand from the notCovered set
+ notCoveredAnymoreInteractionFragments.removeAll(coveredInteractionFragments);
+
+ // set the enclosing operand to the moved/resized one if the current enclosing interaction is the enclosing interaction
+ // of the moved/resized operand or of another.
+ // => the interaction fragment that are inside an other container (like an enclosed CF) are not modified
+ for(InteractionFragment ift : coveredInteractionFragments) {
+ if(!cf.equals(ift)) {
+ Interaction interactionOwner = ift.getEnclosingInteraction();
+ InteractionOperand ioOwner = ift.getEnclosingOperand();
+
+ if((ioOwner != null && (ioOwner.equals(cf.getEnclosingOperand()) || cf.equals(ioOwner.getOwner()))) || (interactionOwner != null && (interactionOwner.equals(cf.getEnclosingInteraction()) || cf.equals(interactionOwner.getOwner())))) {
+ compoundCmd.add(new ICommandProxy(SequenceUtil.getSetEnclosingInteractionCommand(ioEP.getEditingDomain(), ift, io)));
+ }
+ }
+ }
+ }
+
+ for(InteractionFragment ift : notCoveredAnymoreInteractionFragments) {
+ if(cf.getEnclosingOperand() != null) {
+ compoundCmd.add(new ICommandProxy(SequenceUtil.getSetEnclosingInteractionCommand(combinedFragmentEditPart.getEditingDomain(), ift, cf.getEnclosingOperand())));
+ } else {
+ compoundCmd.add(new ICommandProxy(SequenceUtil.getSetEnclosingInteractionCommand(combinedFragmentEditPart.getEditingDomain(), ift, cf.getEnclosingInteraction())));
+ }
+ }
+ }
+ }
+
+ // Print a user notification when we are not sure the command is appropriated
+ EObject combinedFragment = combinedFragmentEditPart.resolveSemanticElement();
+ if(combinedFragment instanceof CombinedFragment && !sizeDelta.equals(0, 0)) {
+ if(((CombinedFragment)combinedFragment).getOperands().size() > 1) {
+ // append a command which notifies
+ Command notifyCmd = new Command() {
+
+ @Override
+ public void execute() {
+ NotificationBuilder warning = NotificationBuilder.createAsyncPopup(Messages.Warning_ResizeInteractionOperandTitle, NLS.bind(Messages.Warning_ResizeInteractionOperandTxt, System.getProperty("line.separator")));
+ warning.run();
+ }
+
+ @Override
+ public void undo() {
+ execute();
+ }
+ };
+ if(notifyCmd.canExecute()) {
+ compoundCmd.add(notifyCmd);
+ }
+ }
+ }
+ // return null instead of unexecutable empty compound command
+ if(compoundCmd.isEmpty()) {
+ return null;
+ }
+ return compoundCmd;
+ }
+
+ private static void moveCoveredDurationConstraint(DurationConstraintEditPart dcp, CompoundCommand compoundCmd,
+ Rectangle origCFBounds, Point moveDelta) {
+ Rectangle r = dcp.getFigure().getBounds().getCopy();
+ dcp.getFigure().translateToAbsolute(r);
+ if (origCFBounds.contains(r)) {
+ //see org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy.getMoveCommand(ChangeBoundsRequest)
+ IBorderItemEditPart borderItemEP = (IBorderItemEditPart) dcp;
+ IBorderItemLocator borderItemLocator = borderItemEP
+ .getBorderItemLocator();
+ Rectangle realLocation = borderItemLocator
+ .getValidLocation(dcp.getFigure().getBounds()
+ .getCopy(), borderItemEP.getFigure());
+
+ Point parentOrigin = borderItemEP.getFigure()
+ .getParent().getBounds().getTopLeft();
+ Dimension d = realLocation.getTopLeft().getDifference(
+ parentOrigin);
+ Point location = new Point(d.width, d.height);
+ location = location.translate(0, moveDelta.y);
+
+ ICommandProxy resize = new ICommandProxy(
+ new SetBoundsCommand(dcp.getEditingDomain(),
+ DiagramUIMessages.Commands_MoveElement,
+ new EObjectAdapter((View) dcp.getModel()),
+ location));
+ compoundCmd.add(resize);
+ }
+ }
+
+ private static ICommand getMoveAnchorCommand(int yDelta, Rectangle figureBounds, IdentityAnchor gmfAnchor) {
+ String oldTerminal = gmfAnchor.getId();
+ PrecisionPoint pp = BaseSlidableAnchor.parseTerminalString(oldTerminal);
+
+ int yPos = (int)Math.round(figureBounds.height * pp.preciseY);
+ yPos += yDelta;
+
+ pp.preciseY = (double)yPos / figureBounds.height;
+
+ if(pp.preciseY > 1.0) {
+ pp.preciseY = 1.0;
+ } else if(pp.preciseY < 0.0) {
+ pp.preciseY = 0.0;
+ }
+
+ String newTerminal = (new BaseSlidableAnchor(null, pp)).getTerminal();
+
+ return new SetValueCommand(new SetRequest(gmfAnchor, NotationPackage.Literals.IDENTITY_ANCHOR__ID, newTerminal));
+ }
+
+ /**
+ * Change constraint for comportment by return null if the resize is lower than the minimun
+ * size.
+ */
+ @Override
+ protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) {
+ Rectangle rect = new PrecisionRectangle(child.getFigure().getBounds());
+ child.getFigure().translateToAbsolute(rect);
+ rect = request.getTransformedRectangle(rect);
+ child.getFigure().translateToRelative(rect);
+ rect.translate(getLayoutOrigin().getNegated());
+
+ if(request.getSizeDelta().width == 0 && request.getSizeDelta().height == 0) {
+ Rectangle cons = getCurrentConstraintFor(child);
+ if(cons != null) {
+ rect.setSize(cons.width, cons.height);
+ }
+ } else { // resize editpart
+ boolean skipMinSize = false;
+ if(child instanceof LifelineEditPart)// && LifelineResizeHelper.isManualSize((LifelineEditPart)child))
+ skipMinSize = true;
+
+ Dimension minSize = getMinimumSizeFor(child);
+ if(rect.width < minSize.width && !skipMinSize) { // In manual mode, there is no minimal width
+ return null;
+ }
+ if(rect.height < minSize.height ) {
+ return null;
+ }
+ }
+ rect = (Rectangle)getConstraintFor(rect);
+
+ Rectangle cons = getCurrentConstraintFor(child);
+ if(request.getSizeDelta().width == 0) {
+ rect.width = cons.width;
+ }
+ if(request.getSizeDelta().height == 0) {
+ rect.height = cons.height;
+ }
+
+ return rect;
+ }
+
+ /**
+ * Handle mininum size for lifeline
+ */
+ @Override
+ protected Dimension getMinimumSizeFor(GraphicalEditPart child) {
+ Dimension minimunSize;
+ if(child instanceof LifelineEditPart) {
+ minimunSize = getMinimumSizeFor((LifelineEditPart)child);
+ } else {
+ minimunSize = super.getMinimumSizeFor(child);
+ }
+ return minimunSize;
+ }
+
+ /**
+ * Get minimun for a lifeline
+ *
+ * @param child
+ * The lifeline
+ * @return The minimun size
+ */
+ private Dimension getMinimumSizeFor(LifelineEditPart child) {
+ LifelineEditPart lifelineEditPart = child;
+ Dimension minimunSize = lifelineEditPart.getFigure().getMinimumSize();
+ for(LifelineEditPart lifelineEP : lifelineEditPart.getInnerConnectableElementList()) {
+ minimunSize.union(getMinimumSizeFor(lifelineEP));
+ }
+ for(ShapeNodeEditPart executionSpecificationEP : lifelineEditPart.getChildShapeNodeEditPart()) {
+ int minimunHeight = executionSpecificationEP.getFigure().getBounds().bottom();
+ minimunSize.setSize(new Dimension(minimunSize.width, Math.max(minimunSize.height, minimunHeight)));
+ }
+ return minimunSize;
+ }
+
+ /**
+ * Block adding element by movement on Interaction
+ */
+ @Override
+ public Command getAddCommand(Request request) {
+ if(request instanceof ChangeBoundsRequest) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ return super.getAddCommand(request);
+ }
+
+
+ /**
+ * Overrides to change the policy of connection anchors when resizing the lifeline.
+ * When resizing the lifeline, the connection must not move.
+ *
+ * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy#getCommand(org.eclipse.gef.Request)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Command getCommand(Request request) {
+ if(request instanceof ChangeBoundsRequest) {
+ ChangeBoundsRequest cbr = (ChangeBoundsRequest)request;
+
+ int resizeDirection = cbr.getResizeDirection();
+
+ CompoundCommand compoundCmd = new CompoundCommand("Resize of Interaction Compartment Elements");
+
+ for(EditPart ep : (List<EditPart>)cbr.getEditParts()) {
+ if(ep instanceof LifelineEditPart && isVerticalMove(cbr)) {
+ // Lifeline EditPart
+ LifelineEditPart lifelineEP = (LifelineEditPart)ep;
+
+ int preserveY = PreserveAnchorsPositionCommand.PRESERVE_Y;
+ Dimension newSizeDelta = PreserveAnchorsPositionCommand.getSizeDeltaToFitAnchors(lifelineEP, cbr.getSizeDelta(), preserveY);
+
+ // SetBounds command modifying the sizeDelta
+ compoundCmd.add(getSetBoundsCommand(lifelineEP, cbr, newSizeDelta));
+
+ // PreserveAnchors command
+ compoundCmd.add(new ICommandProxy(new LifelineEditPart.PreserveAnchorsPositionCommandEx(lifelineEP, newSizeDelta, preserveY, lifelineEP.getPrimaryShape().getFigureLifelineDotLineFigure(), resizeDirection)));
+ }
+ }
+
+ if(compoundCmd.size() == 0) {
+ return super.getCommand(request);
+ } else {
+ return compoundCmd;
+ }
+ }
+
+ return super.getCommand(request);
+ }
+
+ /**
+ * It obtains an appropriate SetBoundsCommand for a LifelineEditPart. The
+ * newSizeDelta provided should be equal o less than the one contained in
+ * the request. The goal of this newDelta is to preserve the anchors'
+ * positions after the resize. It is recommended to obtain this newSizeDelta
+ * by means of calling
+ * PreserveAnchorsPositionCommand.getSizeDeltaToFitAnchors() operation
+ *
+ * @param lifelineEP
+ * The Lifeline that will be moved or resized
+ * @param cbr
+ * The ChangeBoundsRequest for moving or resized the lifelineEP
+ * @param newSizeDelta
+ * The sizeDelta to used instead of the one contained in the
+ * request
+ * @return The SetBoundsCommand
+ */
+ @SuppressWarnings("rawtypes")
+ protected Command getSetBoundsCommand(LifelineEditPart lifelineEP, ChangeBoundsRequest cbr, Dimension newSizeDelta) {
+ // Modify request
+ List epList = cbr.getEditParts();
+ Dimension oldSizeDelta = cbr.getSizeDelta();
+ cbr.setEditParts(lifelineEP);
+ cbr.setSizeDelta(newSizeDelta);
+
+ // Obtain the command with the modified request
+ Command cmd = super.getCommand(cbr);
+
+ // Restore the request
+ cbr.setEditParts(epList);
+ cbr.setSizeDelta(oldSizeDelta);
+
+ // Return the SetBoundsCommand only for the Lifeline and with the
+ // sizeDelta modified in order to preserve the links' anchors positions
+ return cmd;
+ }
+
+ /**
+ * Align lifeline in vertical direction
+ * Fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=364688
+ */
+ protected Rectangle getBoundsOffest(CreateViewRequest request,
+ Rectangle bounds, CreateViewRequest.ViewDescriptor viewDescriptor) {
+ int translate = request.getViewDescriptors().indexOf(viewDescriptor) * 10;
+ Rectangle target = bounds.getCopy().translate(translate, translate);
+
+ if (((IHintedType) UMLElementTypes.Lifeline_3001).getSemanticHint()
+ .equals(viewDescriptor.getSemanticHint())) {
+ target.setY(SequenceUtil.LIFELINE_VERTICAL_OFFSET);
+ }
+
+ return target;
+ }
+
+ @Override
+ protected void showSizeOnDropFeedback(CreateRequest request) {
+ super.showSizeOnDropFeedback(request);
+ if(request instanceof CreateAspectUnspecifiedTypeRequest){
+ CreateAspectUnspecifiedTypeRequest req = (CreateAspectUnspecifiedTypeRequest)request;
+ if(req.getElementTypes().contains(UMLElementTypes.CombinedFragment_3004) || req.getElementTypes().contains(UMLElementTypes.ConsiderIgnoreFragment_3007)){
+ IFigure feedback = getSizeOnDropFeedback(request);
+ Rectangle b = feedback.getBounds().getCopy();
+ feedback.translateToAbsolute(b);
+
+ HighlightUtil.showSizeOnDropFeedback(request, getHost(),feedback,b);
+ }
+ }
+ }
+
+ @Override
+ protected void eraseSizeOnDropFeedback(Request request) {
+ HighlightUtil.eraseSizeOnDropFeedback(request, getHost());
+ super.eraseSizeOnDropFeedback(request);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandComponentEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandComponentEditPolicy.java
new file mode 100644
index 00000000000..32ea7746f2e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandComponentEditPolicy.java
@@ -0,0 +1,90 @@
+/*****************************************************************************
+ * 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.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.GroupRequest;
+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.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ComponentEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceDeleteHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.InteractionOperand;
+
+public class InteractionOperandComponentEditPolicy extends ComponentEditPolicy {
+ /**
+ * Delete Combined fragment and child from the view. Also delete message if user wants. {@inheritDoc}
+ */
+ @Override
+ protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
+
+ if(getEditingDomain() != null) {
+ CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
+ cmd.setTransactionNestingEnabled(false);
+ cmd.add(new CommandProxy(super.createDeleteViewCommand(deleteRequest)));
+
+ if(getEObject() instanceof InteractionOperand) {
+ // Get the elements associated with the CF
+ List<Element> elements = SequenceUtil.getInteractionOperandAssociatedElement((InteractionOperand)getEObject());
+ // Create the delete view commands
+ SequenceDeleteHelper.deleteView(cmd, elements, getEditingDomain());
+ }
+
+ OperandBoundsComputeHelper.addUpdateBoundsCommandForOperandDelelete(this.getHost(),cmd);
+
+ return new ICommandProxy(cmd.reduce());
+ }
+
+ return null;
+ }
+
+ /**
+ * Copy from superclass as visibility is private
+ *
+ * @return the editing domain
+ */
+ private TransactionalEditingDomain getEditingDomain() {
+ if(getHost() instanceof IGraphicalEditPart) {
+ return ((IGraphicalEditPart)getHost()).getEditingDomain();
+ } else if(getHost() instanceof IEditingDomainProvider) {
+ Object domain = ((IEditingDomainProvider)getHost()).getEditingDomain();
+ if(domain instanceof TransactionalEditingDomain) {
+ return (TransactionalEditingDomain)domain;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the EObject of the host
+ *
+ * @return the EObject or null
+ */
+ private EObject getEObject() {
+ if(getHost() instanceof GraphicalEditPart) {
+ return ((GraphicalEditPart)getHost()).resolveSemanticElement();
+ }
+ return null;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
new file mode 100644
index 00000000000..578ef15a6b4
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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.draw2d.PositionConstants;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.ResizableEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper;
+
+/**
+ * The customn DragDropEditPolicy for InteractionOperandEditPart.
+ */
+public class InteractionOperandDragDropEditPolicy extends ResizableEditPolicy {
+
+ /**
+ * Disable drag and allow only south resize. {@inheritDoc}
+ */
+ public InteractionOperandDragDropEditPolicy() {
+ super();
+ setDragAllowed(false);
+ }
+
+ /**
+ * Handle resize InteractionOperand {@inheritDoc}
+ */
+ @Override
+ protected Command getResizeCommand(ChangeBoundsRequest request) {
+ if ((request.getResizeDirection() & PositionConstants.EAST_WEST) != 0) {
+ EditPart parent = getHost().getParent().getParent();
+ return parent.getCommand(request);
+ } else{
+ if (this.getHost() instanceof InteractionOperandEditPart
+ && this.getHost().getParent() instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
+ InteractionOperandEditPart currentIOEP = (InteractionOperandEditPart) this
+ .getHost();
+ CombinedFragmentCombinedFragmentCompartmentEditPart compartEP = (CombinedFragmentCombinedFragmentCompartmentEditPart) this
+ .getHost().getParent();
+ // if first interaction operand and resize direction is NORTH
+ if(this.getHost() == OperandBoundsComputeHelper.findFirstIOEP(compartEP)&&(request.getResizeDirection() & PositionConstants.NORTH) != 0){
+ return getHost().getParent().getParent().getCommand(request);
+ }else{
+ int heightDelta = request.getSizeDelta().height();
+ if ((request.getResizeDirection() & PositionConstants.NORTH) != 0) {
+ return OperandBoundsComputeHelper.createIOEPResizeCommand(currentIOEP, heightDelta,
+ compartEP,PositionConstants.NORTH);
+ } else if ((request.getResizeDirection() & PositionConstants.SOUTH) != 0) {
+ return OperandBoundsComputeHelper.createIOEPResizeCommand(currentIOEP, heightDelta,
+ compartEP,PositionConstants.SOUTH);
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java
new file mode 100644
index 00000000000..a7b0d897b1f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Atos Origin.
+ *
+ *
+ * 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.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+
+/**
+ * The customn LayoutEditPolicy for InteractionOperandEditPart.
+ */
+public class InteractionOperandLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = super.createChildEditPolicy(child);
+ if(result == null) {
+ return new ResizableShapeEditPolicy();
+ }
+ return result;
+ }
+
+ /**
+ * Handle create InteractionOperand hover InteractionOperand {@inheritDoc}
+ */
+ @Override
+ public Command getCommand(Request request) {
+ EditPart combinedFragmentCompartment = getHost().getParent();
+ EditPart combinedFragment = combinedFragmentCompartment.getParent();
+ EditPart interactionCompartment = combinedFragment.getParent();
+ if(REQ_CREATE.equals(request.getType()) && request instanceof CreateUnspecifiedTypeRequest) {
+ if(UMLElementTypes.InteractionOperand_3005.equals(((CreateUnspecifiedTypeRequest)request).getElementTypes().get(0))) {
+ return combinedFragmentCompartment.getCommand(request);
+ } else if(UMLElementTypes.CombinedFragment_3004.equals(((CreateUnspecifiedTypeRequest)request).getElementTypes().get(0))) {
+ return interactionCompartment.getCommand(request);
+ } else if(UMLElementTypes.Lifeline_3001.equals(((CreateUnspecifiedTypeRequest)request).getElementTypes().get(0))) {
+ return interactionCompartment.getCommand(request);
+ }
+ } else if(request instanceof CreateConnectionViewAndElementRequest) {
+ CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest)request;
+ if(getHost().equals(createConnectionRequest.getSourceEditPart())) {
+ createConnectionRequest.setSourceEditPart(combinedFragment);
+ }
+ if(getHost().equals(createConnectionRequest.getTargetEditPart())) {
+ createConnectionRequest.setTargetEditPart(combinedFragment);
+ }
+ return combinedFragment.getCommand(request);
+ } else if (request instanceof CreateViewAndElementRequest ) {
+ //FIXME If necessary
+ return null;
+ }else if (REQ_RESIZE_CHILDREN.equals(request.getType())){
+ return interactionCompartment.getCommand(request);
+ }
+ return super.getCommand(request);
+ }
+
+// /**
+// * Handle combined fragment resize
+// */
+// @Override
+// protected Command getResizeChildrenCommand(ChangeBoundsRequest request) {
+// CompoundCommand compoundCmd = new CompoundCommand();
+// compoundCmd.setLabel("Move or Resize");
+//
+// for(Object o : request.getEditParts()) {
+// GraphicalEditPart child = (GraphicalEditPart)o;
+// Object constraintFor = getConstraintFor(request, child);
+// if(constraintFor != null) {
+// if(child instanceof CombinedFragmentEditPart) {
+// Command resizeChildrenCommand = InteractionCompartmentXYLayoutEditPolicy.getCombinedFragmentResizeChildrenCommand(request, (CombinedFragmentEditPart)child);
+// if(resizeChildrenCommand != null && resizeChildrenCommand.canExecute()) {
+// compoundCmd.add(resizeChildrenCommand);
+// }
+// }
+//
+// Command changeConstraintCommand = createChangeConstraintCommand(request, child, translateToModelConstraint(constraintFor));
+// compoundCmd.add(changeConstraintCommand);
+// }
+// }
+// if(compoundCmd.isEmpty()) {
+// return null;
+// }
+// return compoundCmd.unwrap();
+// }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineAppliedStereotypeNodeLabelDisplayEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineAppliedStereotypeNodeLabelDisplayEditPolicy.java
new file mode 100644
index 00000000000..89d286192d1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineAppliedStereotypeNodeLabelDisplayEditPolicy.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+
+/**
+ * This policy is used to automatically move a lifeline when a stereotype is changed.
+ * this avoids the move of the dash line and its ES.
+ *
+ * @author mvelten
+ *
+ */
+public class LifelineAppliedStereotypeNodeLabelDisplayEditPolicy extends AppliedStereotypeNodeLabelDisplayEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void refreshDisplay() {
+ super.refreshDisplay();
+
+ if(getHost() instanceof LifelineEditPart) {
+ ((LifelineEditPart)getHost()).updateLifelinePosition();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java
new file mode 100644
index 00000000000..e8174e2c052
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java
@@ -0,0 +1,237 @@
+/*****************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Polyline;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+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.RequestConstants;
+import org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers.MessageRouter;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineMessageCreateHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationMoveHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+
+/**
+ * A specific policy to handle :
+ * - Message aspects inherited from {@link SequenceGraphicalNodeEditPolicy}.
+ * - Time/duration move when a message end or an execution is moved.
+ * - Duration constraint/observation creation feedback.
+ * - Creation of general ordering links.
+ * This edit policy is intended to be installed on parts which represent a lifeline or which are contained within a lifeline part.
+ */
+public class LifelineChildGraphicalNodeEditPolicy extends SequenceGraphicalNodeEditPolicy {
+
+ /** the feedback for creating a duration constraint node */
+ private Polyline durationCreationFeedback = null;
+
+ /** the router to use for messages */
+ public static ConnectionRouter messageRouter = new MessageRouter();
+
+ @Override
+ public Command getCommand(Request request) {
+ if(RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
+ if(request instanceof CreateConnectionViewAndElementRequest) {
+ return getConnectionAndRelationshipCreateCommand((CreateConnectionViewAndElementRequest)request);
+ } else if(request instanceof CreateUnspecifiedTypeConnectionRequest) {
+ return getUnspecifiedConnectionCreateCommand((CreateUnspecifiedTypeConnectionRequest)request);
+ }
+ } else if(RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
+ if(request instanceof CreateConnectionViewAndElementRequest) {
+ return getConnectionAndRelationshipCompleteCommand((CreateConnectionViewAndElementRequest)request);
+ } else if(request instanceof CreateUnspecifiedTypeConnectionRequest) {
+ return getUnspecifiedConnectionCompleteCommand((CreateUnspecifiedTypeConnectionRequest)request);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * Gets the command to start the creation of a new connection and
+ * relationship (if applicable) for a unspecified type request. This will
+ * update all the individual requests appropriately.
+ *
+ * @param request
+ * the unspecified type request
+ * @return the command
+ */
+ private Command getUnspecifiedConnectionCreateCommand(final CreateUnspecifiedTypeConnectionRequest request) {
+
+ if(request.isDirectionReversed()) {
+ return new Command() {
+
+ /**
+ * All we know is the target and the possible relationship
+ * types. At this point, there is no way to validate the
+ * commands for this scenario.
+ */
+ public boolean canExecute() {
+ return true;
+ }
+ };
+ } else {
+
+ // Get the start command for each individual request, this will
+ // update each request as required.
+ final List commands = new ArrayList();
+ for(Iterator iter = request.getAllRequests().iterator(); iter.hasNext();) {
+ Request individualRequest = (Request)iter.next();
+ Command cmd = null;
+ if(individualRequest instanceof CreateConnectionViewAndElementRequest) {
+ cmd = getConnectionAndRelationshipCreateCommand((CreateConnectionViewAndElementRequest)individualRequest);
+ } else if(individualRequest instanceof CreateConnectionViewRequest) {
+ cmd = getConnectionCreateCommand((CreateConnectionViewRequest)individualRequest);
+ }
+ if(cmd != null && cmd.canExecute()) {
+ commands.add(cmd);
+ }
+ }
+
+ if(commands.isEmpty()) {
+ // GEF's AbstractConnectionCreationTool expects a null command
+ // when the gesture should be disabled.
+ return null;
+ }
+
+ // return an executable command that does nothing
+ return new Command() {/* do nothing */
+ };
+ }
+ }
+
+ /**
+ * Get the command to reconnect the source and move associated time/duration constraints/observation.
+ *
+ * @see org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy#getReconnectSourceCommand(org.eclipse.gef.requests.ReconnectRequest)
+ *
+ * @param request
+ * the reconnection request
+ * @return the command
+ */
+ @Override
+ protected Command getReconnectSourceCommand(ReconnectRequest request) {
+ Command command = super.getReconnectSourceCommand(request);
+ if(command != null) {
+ command = OccurrenceSpecificationMoveHelper.completeReconnectConnectionCommand(command, request, getConnectableEditPart());
+ if(request.getConnectionEditPart() instanceof Message4EditPart && request.getTarget() instanceof LifelineEditPart){
+ LifelineEditPart newSource = (LifelineEditPart) request.getTarget();
+ LifelineEditPart target = (LifelineEditPart) request.getConnectionEditPart().getTarget();
+ command = LifelineMessageCreateHelper.moveLifelineDown(command, target, newSource.getFigure().getBounds().getLocation().getCopy());
+ }
+ }
+ return command;
+ }
+
+ /**
+ * Get the command to reconnect the target and move associated time/duration constraints/observation.
+ *
+ * @see org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
+ *
+ * @param request
+ * the reconnection request
+ * @return the command
+ */
+ @Override
+ protected Command getReconnectTargetCommand(ReconnectRequest request) {
+ Command command = super.getReconnectTargetCommand(request);
+ if(command != null) {
+ command = OccurrenceSpecificationMoveHelper.completeReconnectConnectionCommand(command, request, getConnectableEditPart());
+ if(request.getConnectionEditPart() instanceof Message4EditPart && request.getTarget() instanceof LifelineEditPart){
+ command = LifelineMessageCreateHelper.reconnectMessageCreateTarget(request, command);
+ }
+ }
+ return command;
+ }
+
+ /**
+ * Show the feedback for creating a duration constraint from this edit part
+ *
+ * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#showSourceFeedback(org.eclipse.gef.Request)
+ * @param request
+ * creation request
+ */
+ @Override
+ public void showSourceFeedback(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ Object hintedType = ((CreateUnspecifiedTypeRequest)request).getElementTypes().get(0);
+ CreateRequest req = null;
+ if(UMLElementTypes.DurationConstraint_3021.equals(hintedType)) {
+ req = ((CreateUnspecifiedTypeRequest)request).getRequestForType(UMLElementTypes.DurationConstraint_3021);
+ } else if(UMLElementTypes.DurationObservation_3024.equals(hintedType)) {
+ req = ((CreateUnspecifiedTypeRequest)request).getRequestForType(UMLElementTypes.DurationObservation_3024);
+ }
+ if(req != null) {
+ Object initLocation = req.getExtendedData().get(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION);
+ if(initLocation instanceof Point) {
+ Point startPoint = ((Point)initLocation).getCopy();
+ Point targetPoint = ((CreateUnspecifiedTypeRequest)request).getLocation().getCopy();
+ getFeedbackLayer().translateToRelative(startPoint);
+ getFeedbackLayer().translateToRelative(targetPoint);
+ if(durationCreationFeedback == null) {
+ durationCreationFeedback = new Polyline();
+ durationCreationFeedback.setLineWidth(1);
+ durationCreationFeedback.setLineStyle(Graphics.LINE_DASHDOT);
+ durationCreationFeedback.setForegroundColor(((IGraphicalEditPart)getHost()).getFigure().getLocalForegroundColor());
+ addFeedback(durationCreationFeedback);
+ }
+ durationCreationFeedback.setStart(startPoint);
+ durationCreationFeedback.setEnd(targetPoint);
+ return;
+ }
+ }
+ }
+ super.showSourceFeedback(request);
+ }
+
+ /**
+ * Erase the feedback for creating a duration constraint from this edit part
+ *
+ * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#eraseSourceFeedback(org.eclipse.gef.Request)
+ * @param request
+ * creation request
+ */
+ @Override
+ public void eraseSourceFeedback(Request request) {
+ super.eraseSourceFeedback(request);
+ if(durationCreationFeedback != null)
+ removeFeedback(durationCreationFeedback);
+ durationCreationFeedback = null;
+ }
+
+ /**
+ * Get the replacing connection router for routing messages correctly
+ *
+ * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getDummyConnectionRouter(org.eclipse.gef.requests.CreateConnectionRequest)
+ */
+ protected ConnectionRouter getDummyConnectionRouter(CreateConnectionRequest req) {
+ return messageRouter;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineCreationEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineCreationEditPolicy.java
new file mode 100644
index 00000000000..81273970770
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineCreationEditPolicy.java
@@ -0,0 +1,202 @@
+/*****************************************************************************
+ * 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.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.commands.SetBoundsCommand;
+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.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.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 LifelineCreationEditPolicy extends CreationEditPolicy {
+
+ @Override
+ protected Command getCreateElementAndViewCommand(CreateViewAndElementRequest request) {
+ // get the element descriptor
+ CreateElementRequestAdapter requestAdapter = request.getViewAndElementDescriptor().getCreateElementRequestAdapter();
+
+ // get the semantic request
+ CreateElementRequest createElementRequest = (CreateElementRequest)requestAdapter.getAdapter(CreateElementRequest.class);
+
+ if(createElementRequest.getContainer() == null) {
+ // complete the semantic request by filling in the host's semantic
+ // element as the context
+ View view = (View)getHost().getModel();
+ EObject hostElement = ViewUtil.resolveSemanticElement(view);
+
+ if(hostElement == null && view.getElement() == null) {
+ hostElement = view;
+ }
+
+ // 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);
+
+ // 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(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_3001;
+ if(type.getSemanticHint().equals(request.getViewAndElementDescriptor().getSemanticHint())) {
+ setChildLifelineBounds(cc, request, parentPart);
+ }
+
+ 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
+
+ SetBoundsCommand cmd = new SetBoundsCommand(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_3021).getSemanticHint();
+ String durCstOnMessage = ((IHintedType)UMLElementTypes.DurationConstraint_3023).getSemanticHint();
+ String durObsOnMessage = ((IHintedType)UMLElementTypes.DurationObservation_3024).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_3019).getSemanticHint();
+ String timeObservationHint = ((IHintedType)UMLElementTypes.TimeObservation_3020).getSemanticHint();
+ return timeConstraintHint.equals(requestHint) || timeObservationHint.equals(requestHint);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineLabelEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineLabelEditPolicy.java
new file mode 100644
index 00000000000..76a3aaf1bb9
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineLabelEditPolicy.java
@@ -0,0 +1,207 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractMaskManagedEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineNameEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.preferences.LifelinePreferencePage;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineLabelHelper;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+
+
+public class LifelineLabelEditPolicy extends AbstractMaskManagedEditPolicy {
+
+ private IPropertyChangeListener preferenceListener;
+
+ @Override
+ public void addAdditionalListeners() {
+ super.addAdditionalListeners();
+
+ if(preferenceListener == null){
+ preferenceListener = new IPropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent event) {
+ handlePreferenceChange(event);
+ }
+ };
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ store.addPropertyChangeListener(this.preferenceListener);
+ }
+
+ Lifeline lifeline = getUMLElement();
+ // check host semantic element is not null
+ if(lifeline == null) {
+ return;
+ }
+ // adds a listener to the element itself, and to linked elements, like Type
+ getDiagramEventBroker().addNotificationListener(lifeline, this);
+
+ ConnectableElement ce = lifeline.getRepresents();
+ if(ce != null){
+ getDiagramEventBroker().addNotificationListener(ce, this);
+ if(ce.getType() != null)
+ getDiagramEventBroker().addNotificationListener(ce.getType(), this);
+ }
+ }
+
+ protected void handlePreferenceChange(PropertyChangeEvent event) {
+ EditPart part = getHost();
+ if(part == null || part.getParent() == null)
+ return;
+
+ String key = event.getProperty();
+ if(key.equals(LifelinePreferencePage.LABEL_DISPLAY_PREFERENCE)){
+ refreshDisplay();
+ }
+ }
+
+ @Override
+ protected void removeAdditionalListeners() {
+ super.removeAdditionalListeners();
+ Lifeline lifeline = getUMLElement();
+ // check host semantic element is not null
+ if(lifeline == null) {
+ return;
+ }
+ getDiagramEventBroker().removeNotificationListener(lifeline, this);
+
+ ConnectableElement ce = lifeline.getRepresents();
+ if(ce != null){
+ getDiagramEventBroker().removeNotificationListener(ce, this);
+ if(ce.getType() != null)
+ getDiagramEventBroker().removeNotificationListener(ce.getType(), this);
+ }
+ }
+
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+
+ Object object = notification.getNotifier();
+ if(object == null || getUMLElement() == null) {
+ return;
+ }
+
+ if(notification.getFeature().equals(UMLPackage.eINSTANCE.getNamedElement_Name())) {
+ refreshDisplay();
+ } else if(notification.getFeature().equals(UMLPackage.Literals.LIFELINE__REPRESENTS)) {
+ // change represent element
+ if(notification.getNewValue() instanceof ConnectableElement){
+ ConnectableElement ce = (ConnectableElement )notification.getNewValue();
+ getDiagramEventBroker().addNotificationListener(ce, this);
+ if(ce.getType() != null)
+ getDiagramEventBroker().addNotificationListener(ce.getType(), this);
+ }
+
+ if(notification.getOldValue() instanceof ConnectableElement){
+ ConnectableElement ce = (ConnectableElement )notification.getOldValue();
+ getDiagramEventBroker().removeNotificationListener(ce, this);
+
+ if(ce.getType() != null)
+ getDiagramEventBroker().removeNotificationListener(ce.getType(), this);
+ }
+
+ refreshDisplay();
+ }else if(isMaskManagedAnnotation(object) || isRemovedMaskManagedLabelAnnotation(object, notification)) {
+ refreshDisplay();
+ } else if(object.equals(getUMLElement().getRepresents()) ){
+ // change represent type
+ if(notification.getNewValue() instanceof Type && notification.getNewValue() instanceof EObject){
+ getDiagramEventBroker().addNotificationListener((EObject)notification.getNewValue(), this);
+ }
+
+ if(notification.getOldValue() instanceof Type && notification.getOldValue() instanceof EObject){
+ getDiagramEventBroker().removeNotificationListener((EObject)notification.getOldValue(), this);
+ }
+
+ refreshDisplay();
+ }
+ }
+
+
+ public void refreshDisplay() {
+ // calls the helper for this edit Part
+ LifelineEditPart lp = (LifelineEditPart)getHost();
+ List children = lp.getChildren();
+ for(Object p : children)
+ if(p instanceof LifelineNameEditPart)
+ LifelineLabelHelper.getInstance().refreshEditPartDisplay((GraphicalEditPart)p);
+ }
+
+ public int getCurrentDisplayValue() {
+ EAnnotation customeDisplayAnnotation = ((View)getHost().getModel()).getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ int displayValue = getDefaultDisplayValue();
+ if(customeDisplayAnnotation != null && customeDisplayAnnotation.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE) != null) {
+ displayValue = Integer.parseInt(customeDisplayAnnotation.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
+ } else {
+ // no specific information => look in preferences
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ int displayValueTemp = store.getInt(LifelinePreferencePage.LABEL_DISPLAY_PREFERENCE);
+ if(displayValueTemp != 0) {
+ displayValue = displayValueTemp;
+ }
+ }
+ return displayValue;
+ }
+
+ public int getDefaultDisplayValue() {
+ return LifelinePreferencePage.DEFAULT_LABEL_DISPLAY;
+ }
+
+ public String getMaskLabel(int value) {
+ return LifelineLabelHelper.getInstance().getMaskLabel(value);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<String> getMaskLabels() {
+ return LifelineLabelHelper.getInstance().getMaskLabels();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Map<Integer, String> getMasks() {
+ return LifelineLabelHelper.getInstance().getMasks();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<Integer> getMaskValues() {
+ return LifelineLabelHelper.getInstance().getMaskValues();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPreferencePageID() {
+ return "org.eclipse.papyrus.uml.diagram.sequence.preferences.LifelinePreferencePage";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Lifeline getUMLElement() {
+ return (Lifeline)hostSemanticElement;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
new file mode 100644
index 00000000000..876f6034ff2
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
@@ -0,0 +1,927 @@
+/*****************************************************************************
+ * 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.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+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.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+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.XYLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+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.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.commands.PreserveAnchorsPositionCommand;
+import org.eclipse.papyrus.uml.diagram.common.draw2d.LifelineDotLineFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.command.CustomZOrderCommand;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantEditPart.StateInvariantResizableEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.HighlightUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationMoveHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+
+/**
+ * The custom LayoutEditPolicy for LifelineEditPart.
+ */
+public class LifelineXYLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ /** Initialization width of Execution Specification. */
+ public final static int EXECUTION_INIT_WIDTH = 16;
+
+ /** Initialization width of CoRegion. */
+ public final static int COREGION_INIT_WIDTH = 30;
+
+ /** Initialization height of Execution Specification. */
+ private final static int EXECUTION_INIT_HEIGHT = 50;
+
+ /** Initialization height of a time bar figure. */
+ private static final int TIME_BAR_HEIGHT = 1;
+
+ /** The default spacing used between Execution Specification */
+ private final static int SPACING_HEIGHT = 5;
+
+ // force location of time/duration elements and ES
+ private static final String TIME_CONSTRAINT_HINT = ((IHintedType)UMLElementTypes.TimeConstraint_3019).getSemanticHint();
+
+ private static final String TIME_OBSERVATION_HINT = ((IHintedType)UMLElementTypes.TimeObservation_3020).getSemanticHint();
+
+ private static final String DURATION_CONSTRAINT_ON_LIFELINE_HINT = ((IHintedType)UMLElementTypes.DurationConstraint_3021).getSemanticHint();
+
+ private static final String ACTION_EXECUTION_SPECIFICATION_HINT = ((IHintedType)UMLElementTypes.ActionExecutionSpecification_3006).getSemanticHint();
+
+ private static final String BEHAVIOR_EXECUTION_SPECIFICATION_HINT = ((IHintedType)UMLElementTypes.BehaviorExecutionSpecification_3003).getSemanticHint();
+
+ private static final String CO_REGION_HINT = ((IHintedType)UMLElementTypes.CombinedFragment_3018).getSemanticHint();
+
+ private HighlightUtil highlightUtil = new HighlightUtil();
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ if(request instanceof CreateViewRequest) {
+ CreateViewRequest cvr = (CreateViewRequest)request;
+ if(cvr.getViewDescriptors().size() > 0) {
+ ViewDescriptor viewDescriptor = cvr.getViewDescriptors().iterator().next();
+ String semanticHint = viewDescriptor.getSemanticHint();
+
+ if(TIME_CONSTRAINT_HINT.equals(semanticHint) || TIME_OBSERVATION_HINT.equals(semanticHint)) {
+ Command cmd = getCommandForTimeObservationOrConstraint(cvr, viewDescriptor);
+ if(cmd != null) {
+ return cmd;
+ }
+ }
+ if(DURATION_CONSTRAINT_ON_LIFELINE_HINT.equals(semanticHint)) {
+ Command cmd = getCommandForDurationConstraint(cvr, viewDescriptor);
+ if(cmd != null) {
+ return cmd;
+ }
+ }
+ if(ACTION_EXECUTION_SPECIFICATION_HINT.equals(semanticHint) || BEHAVIOR_EXECUTION_SPECIFICATION_HINT.equals(semanticHint)) {
+ Command cmd = getCommandForExecutionSpecificationCreation(cvr, viewDescriptor);
+ if(cmd != null) {
+ return cmd;
+ }
+ }
+ if(CO_REGION_HINT.equals(semanticHint)) {
+ Command cmd = getCommandForCoRegionCreation(cvr, viewDescriptor);
+ if(cmd != null) {
+ return cmd;
+ }
+ }
+ }
+ }
+
+ return super.getCreateCommand(request);
+ }
+
+ @Override
+ protected void showLayoutTargetFeedback(Request request) {
+ if(request instanceof CreateUnspecifiedTypeRequest) {
+ CreateUnspecifiedTypeRequest cvr = (CreateUnspecifiedTypeRequest)request;
+ if(!cvr.getElementTypes().isEmpty()) {
+ IHintedType elementType = (IHintedType)cvr.getElementTypes().iterator().next();
+ String semanticHint = elementType.getSemanticHint();
+ EditPart editPartForHighlight = getHost();
+ if(ACTION_EXECUTION_SPECIFICATION_HINT.equals(semanticHint) || BEHAVIOR_EXECUTION_SPECIFICATION_HINT.equals(semanticHint)) {
+ ShapeNodeEditPart parentExecuteSpecification = getParentWhenCreationExecuteSpecification(cvr.getLocation(), cvr.getSize(), semanticHint);
+ if(parentExecuteSpecification != null) {
+ editPartForHighlight = parentExecuteSpecification;
+ }
+ }
+ if(editPartForHighlight != null) {
+ highlightUtil.unhighlight();
+ highlightUtil.highlight(editPartForHighlight);
+ }
+ }
+ }
+ super.showLayoutTargetFeedback(request);
+ }
+
+ @Override
+ protected void eraseLayoutTargetFeedback(Request request) {
+ super.eraseLayoutTargetFeedback(request);
+ highlightUtil.unhighlight();
+ }
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ View childView = (View)child.getModel();
+ switch(UMLVisualIDRegistry.getVisualID(childView)) {
+ case StateInvariantEditPart.VISUAL_ID:
+ return new StateInvariantResizableEditPolicy();
+ case DestructionOccurrenceSpecificationEditPart.VISUAL_ID:
+ return new BorderItemResizableEditPolicy();
+ }
+ return super.createChildEditPolicy(child);
+ }
+
+ @Override
+ protected Rectangle getCurrentConstraintFor(GraphicalEditPart child) {
+ IFigure fig = child.getFigure();
+ Object con = fig.getParent().getLayoutManager().getConstraint(fig);
+ if(con instanceof Rectangle) {
+ return (Rectangle)con;
+ }
+ return fig.getBounds();
+ }
+
+ @Override
+ protected Object getConstraintFor(CreateRequest request) {
+ Rectangle constraint = (Rectangle)super.getConstraintFor(request);
+ if(request instanceof CreateViewAndElementRequest) {
+ CreateViewAndElementRequest req = (CreateViewAndElementRequest)request;
+ IHintedType type = (IHintedType)UMLElementTypes.Lifeline_3001;
+ if(type.getSemanticHint().equals(req.getViewAndElementDescriptor().getSemanticHint())) {
+ constraint.y = 0; // fix layout offset
+ }
+
+ String destructionHint = ((IHintedType)UMLElementTypes.DestructionOccurrenceSpecification_3022).getSemanticHint();
+ if(destructionHint.equals(req.getViewAndElementDescriptor().getSemanticHint()) && constraint.width < 0 && constraint.height < 0) {
+ constraint.width = constraint.height = 20;// set initial size, same as DestructionOccurrenceSpecificationPreferencePage
+ }
+ }
+ return constraint;
+ }
+
+ private static Rectangle getNewBoundsForCoRegion(LifelineEditPart lifelineEP, Rectangle bounds) {
+ Rectangle newBounds = bounds.getCopy();
+
+ // Get the dotline figure
+ LifelineDotLineFigure figureLifelineDotLineFigure = lifelineEP.getPrimaryShape().getFigureLifelineDotLineFigure();
+
+ // Translate the absolute location to relative
+ figureLifelineDotLineFigure.translateToRelative(newBounds);
+ newBounds.translate(figureLifelineDotLineFigure.getBounds().getLocation().getCopy().negate());
+
+ Rectangle dotLineFigureBounds = figureLifelineDotLineFigure.getBounds();
+
+ newBounds.x = dotLineFigureBounds.width / 2 - COREGION_INIT_WIDTH / 2;
+ newBounds.width = COREGION_INIT_WIDTH;
+
+ return newBounds;
+ }
+
+ private Command getCommandForCoRegionCreation(CreateViewRequest cvr, ViewDescriptor viewDescriptor) {
+ Rectangle newBounds = new Rectangle();
+ if(cvr.getLocation() != null) {
+ newBounds.setLocation(cvr.getLocation());
+ }
+ if(cvr.getSize() != null) {
+ newBounds.setSize(cvr.getSize());
+ } else {
+ newBounds.width = -1;
+ newBounds.height = -1;
+ }
+
+ if(newBounds.x < 0 || newBounds.y < 0) {
+ newBounds.x = newBounds.y = 0;
+ }
+
+ newBounds = getNewBoundsForCoRegion((LifelineEditPart)getHost(), newBounds);
+
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds));
+ }
+
+ private Rectangle getCreateExecuteSpecificationBounds(Point location, Dimension size, String semanticHint) {
+ Point newLocation = location == null ? new Point() : location.getCopy();
+
+ if(newLocation.x < 0 || newLocation.y < 0) {
+ newLocation.x = newLocation.y = 0;
+ }
+
+ LifelineEditPart editPart = (LifelineEditPart)getHost();
+
+ // Get the dotline figure
+ LifelineDotLineFigure figureLifelineDotLineFigure = editPart.getPrimaryShape().getFigureLifelineDotLineFigure();
+ List<ShapeNodeEditPart> executionSpecificationList = editPart.getChildShapeNodeEditPart();
+
+ // Translate the absolute location to relative
+ figureLifelineDotLineFigure.translateToRelative(newLocation);
+
+ Rectangle dotLineFigureBounds = figureLifelineDotLineFigure.getBounds();
+ // If we are creating an ES from the popup menu bar
+ // We need to get a valid location to be able to create the ES figure
+ if(newLocation.y < dotLineFigureBounds.y) {
+ int max = dotLineFigureBounds.y;
+ for(ShapeNodeEditPart sp : executionSpecificationList) {
+ int figureBottom = sp.getFigure().getBounds().y + sp.getFigure().getBounds().height;
+ if(figureBottom > max) {
+ max = figureBottom;
+ }
+ }
+ // Vertically, the new ES is located after all existing ES on the lifeline
+ newLocation.y = max + SPACING_HEIGHT;
+ // Horizontally, the figure is placed at the center of the lifeline
+ newLocation.x = dotLineFigureBounds.x + dotLineFigureBounds.width / 2 - EXECUTION_INIT_WIDTH / 2;
+ }
+
+ // Get the height of the Execution specification
+ int newHeight = getFigureHeight(semanticHint, size);
+
+ // Define the bounds of the new Execution specification
+ return new Rectangle(newLocation.x, newLocation.y, -1, newHeight);
+ }
+
+ private ShapeNodeEditPart getParentWhenCreationExecuteSpecification(Point location, Dimension size, String semanticHint) {
+
+ // Define the bounds of the new Execution specification
+ Rectangle newBounds = getCreateExecuteSpecificationBounds(location, size, semanticHint);
+ // Get the dotline figure
+ List<ShapeNodeEditPart> executionSpecificationList = ((LifelineEditPart)getHost()).getChildShapeNodeEditPart();
+
+ return getParent((LifelineEditPart)getHost(), newBounds, executionSpecificationList);
+ }
+
+ private Command getCommandForExecutionSpecificationCreation(CreateViewRequest cvr, ViewDescriptor viewDescriptor) {
+
+ LifelineEditPart editPart = (LifelineEditPart)getHost();
+
+ List<ShapeNodeEditPart> executionSpecificationList = editPart.getChildShapeNodeEditPart();
+
+ Point location = cvr.getLocation();
+ Dimension size = cvr.getSize();
+ String semanticHint = viewDescriptor.getSemanticHint();
+
+ // Define the bounds of the new Execution specification
+ Rectangle newBounds = getCreateExecuteSpecificationBounds(location, size, semanticHint);
+ ShapeNodeEditPart parent = getParentWhenCreationExecuteSpecification(location, size, semanticHint);
+ newBounds = getExecutionSpecificationNewBounds(true, editPart, new Rectangle(), newBounds, new ArrayList<ShapeNodeEditPart>(0), false);
+ if(newBounds == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ Command p = new ICommandProxy(new SetBoundsCommand(editPart.getEditingDomain(), "Creation of an ExecutionSpecification", viewDescriptor, newBounds));
+
+ // resize parent bar
+ if(parent != null) {
+ p = p.chain(resizeParentExecutionSpecification((LifelineEditPart)getHost(), parent, newBounds.getCopy(), executionSpecificationList));
+ }
+ return p;
+ }
+
+ private static Command resizeParentExecutionSpecification(LifelineEditPart lifelinePart, ShapeNodeEditPart part, Rectangle childBounds, List<ShapeNodeEditPart> list) {
+ Rectangle bounds = getRelativeBounds(part.getFigure());
+
+ childBounds.x = bounds.x;
+ childBounds.width = bounds.width;
+ if(bounds.contains(childBounds)) {
+ return null;
+ }
+ bounds.union(childBounds);
+ Command c = new ICommandProxy(new SetBoundsCommand(part.getEditingDomain(), "Resize of Parent Bar", part, bounds.getCopy()));
+
+ list.remove(part);
+ ShapeNodeEditPart parent = getParent(lifelinePart, part.getFigure().getBounds(), list);
+ if(parent == null) {
+ return c;
+ }
+
+ return c.chain(resizeParentExecutionSpecification(lifelinePart, parent, bounds.getCopy(), list));
+ }
+
+ /**
+ * Get the command for setting initial bounds of a Time Observation or Constraint representation
+ *
+ * @param cver
+ * the request
+ * @return command or null if none is appropriate
+ */
+ private Command getCommandForTimeObservationOrConstraint(CreateViewRequest cvr, ViewDescriptor viewDescriptor) {
+ Object loc = cvr.getExtendedData().get(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION);
+ if(loc instanceof Point) {
+ IFigure parentFigure = ((IGraphicalEditPart)getHost()).getFigure();
+ Point referencePoint = ((Point)loc).getCopy();
+ parentFigure.translateToRelative(referencePoint);
+ referencePoint.translate(parentFigure.getBounds().getLocation().getCopy().negate());
+ // Get the height of the element
+ int newHeight = getFigureHeight(viewDescriptor.getSemanticHint(), cvr.getSize());
+ // Define the bounds of the new time element
+ Rectangle newBounds = new Rectangle(referencePoint.x, referencePoint.y - newHeight / 2, -1, newHeight);
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds));
+ }
+ return null;
+ }
+
+ /**
+ * Get the command for setting initial bounds of a Duration Constraint representation
+ *
+ * @param cver
+ * the request
+ * @return command or null if none is appropriate
+ */
+ private Command getCommandForDurationConstraint(CreateViewRequest cvr, ViewDescriptor viewDescriptor) {
+ Object locTop = cvr.getExtendedData().get(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION);
+ Object locBottom = cvr.getExtendedData().get(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION_2);
+ if(locTop instanceof Point && locBottom instanceof Point) {
+ IFigure parentFigure = ((IGraphicalEditPart)getHost()).getFigure();
+ Point referenceTop = ((Point)locTop).getCopy();
+ Point referenceBottom = ((Point)locBottom).getCopy();
+ // Get the height of the element
+ int newHeight = referenceBottom.y - referenceTop.y;
+ if(newHeight > 0) {
+ parentFigure.translateToRelative(referenceTop);
+ Point parentFigDelta = parentFigure.getBounds().getLocation().getCopy().negate();
+ referenceTop.translate(parentFigDelta);
+ // Define the bounds of the new time element
+ Rectangle newBounds = new Rectangle(referenceTop.x, referenceTop.y, -1, newHeight);
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds));
+ } else if(newHeight < 0) {
+ parentFigure.translateToRelative(referenceBottom);
+ Point parentFigDelta = parentFigure.getBounds().getLocation().getCopy().negate();
+ referenceBottom.translate(parentFigDelta);
+ // Define the bounds of the new time element
+ Rectangle newBounds = new Rectangle(referenceBottom.x, referenceBottom.y, -1, -newHeight);
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds));
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the adapted height, taking in account the represented figure
+ *
+ * @param cr
+ * the create request
+ * @return the height defined in the create request or a default value depending on the created figure
+ */
+ private int getFigureHeight(String semanticHint, Dimension size) {
+ int newHeight;
+ if(TIME_OBSERVATION_HINT.equals(semanticHint) || TIME_CONSTRAINT_HINT.equals(semanticHint)) {
+ // height for a time bar (takes precedence on request's size)
+ newHeight = TIME_BAR_HEIGHT;
+ } else if(size != null) {
+ // heigh from request
+ newHeight = size.height;
+ } else {
+ newHeight = EXECUTION_INIT_HEIGHT;
+ }
+ return newHeight;
+ }
+
+ /**
+ * Useful operation to know where the figure of a ExecutionSpecification EditPart should be
+ * positioned within a Lifeline EditPart. The notToCheckList is needed to avoid checking those
+ * ExecutionSpecification EditParts. The returned bounds are relative to the Lifeline figure so
+ * they can be used, directly, within a SetBoundsCommand.
+ *
+ * @param lifelineEP
+ * the lifeline ep
+ * @param oldBounds
+ * The old bounds of the ES
+ * @param newBounds
+ * The new initial bounds
+ * @param notToCheckExecutionSpecificationList
+ * The ExecutionSpecification EditPart's List that won't be checked
+ *
+ * @return The new bounds of the executionSpecificationEP figure
+ */
+ protected final static Rectangle getExecutionSpecificationNewBounds(boolean isMove, LifelineEditPart lifelineEP, Rectangle oldBounds, Rectangle newBounds, List<ShapeNodeEditPart> notToCheckExecutionSpecificationList, boolean useFixedXPos) {
+ // Lifeline's figure where the child is drawn
+ Rectangle dotLineBounds = lifelineEP.getPrimaryShape().getFigureLifelineDotLineFigure().getBounds();
+
+ // if ExecutionSpecification is resize outside of the lifeline bounds
+ if(newBounds.y <= dotLineBounds.y || newBounds.x < dotLineBounds.x || newBounds.x > dotLineBounds.right()) {
+ return null;
+ }
+
+ List<ShapeNodeEditPart> toCheckExecutionSpecificationList = lifelineEP.getChildShapeNodeEditPart();
+ toCheckExecutionSpecificationList.removeAll(notToCheckExecutionSpecificationList);
+
+ if(isMove) {
+ ShapeNodeEditPart parent = getParent(lifelineEP, newBounds, toCheckExecutionSpecificationList);
+
+ if(useFixedXPos) {
+ newBounds.x = oldBounds.x;
+ } else if(parent == null) {
+ // No mother, center position
+ int width = newBounds.width > 0 ? newBounds.width : EXECUTION_INIT_WIDTH;
+ newBounds.x = dotLineBounds.x + dotLineBounds.width / 2 - width / 2;
+ } else {
+ Rectangle parentBounds = parent.getFigure().getBounds();
+ int width = parentBounds.width > 0 ? parentBounds.width : EXECUTION_INIT_WIDTH;
+ newBounds.x = parentBounds.x + width / 2 + 1;
+ }
+ } else {
+ ShapeNodeEditPart oldParent = getParent(lifelineEP, oldBounds, toCheckExecutionSpecificationList);
+ // forbid resize if the new bounds exceed Y-wise the bounds of a non-parent ES
+ for(ShapeNodeEditPart esPart : toCheckExecutionSpecificationList) {
+ Rectangle esBounds = esPart.getFigure().getBounds();
+ int esYBottom = esBounds.y + esBounds.height;
+ if(esPart != oldParent) {
+ if(((oldBounds.y + oldBounds.height) <= esBounds.y && (newBounds.y + newBounds.height) >= esBounds.y) || (oldBounds.y >= esYBottom && newBounds.y <= esYBottom)) {
+ return null;
+ }
+ }
+ }
+ }
+
+ // Change to relative bounds of the LifelineEP
+ newBounds.x -= dotLineBounds.x;
+ newBounds.y -= dotLineBounds.y;
+
+ return newBounds;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getResizeChildrenCommand(ChangeBoundsRequest request) {
+ // This policy is hosted in a LifelineEditPart
+ LifelineEditPart lifelineEP = (LifelineEditPart)getHost();
+ Command command = getResizeOrMoveChildrenCommand(lifelineEP, request, false, true, false);
+
+ if(command == null) {
+ command = super.getResizeChildrenCommand(request);
+ }
+ return command;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ // This policy is hosted in a LifelineEditPart
+ LifelineEditPart lifelineEP = (LifelineEditPart)getHost();
+ Command command = getResizeOrMoveChildrenCommand(lifelineEP, (ChangeBoundsRequest)request, true, true, false);
+
+ if(command == null) {
+ command = super.getMoveChildrenCommand(request);
+ }
+ return command;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Command getResizeOrMoveChildrenCommand(LifelineEditPart lifelineEP, ChangeBoundsRequest request, boolean isMove, boolean updateEnclosingInteraction, boolean useFixedXPos) {
+ List<EditPart> editParts = request.getEditParts();
+
+ if(editParts != null) {
+ CompoundCommand compoundCmd = new CompoundCommand();
+ compoundCmd.setLabel("Move or resize");
+ compoundCmd.setDebugLabel("Debug: Move or resize of an ExecutionSpecification");
+
+ for(EditPart ep : editParts) {
+
+ if(ep instanceof ActionExecutionSpecificationEditPart || ep instanceof BehaviorExecutionSpecificationEditPart) {
+
+ // an execution specification have been moved or resized
+ ShapeNodeEditPart executionSpecificationEP = (ShapeNodeEditPart)ep;
+
+ // Check if height is within the limits of the figure
+ Dimension newSizeDelta = adaptSizeDeltaToMaxHeight(executionSpecificationEP.getFigure(), request.getSizeDelta());
+
+ // Current bounds of the ExecutionSpecification
+ Rectangle oldBounds = executionSpecificationEP.getFigure().getBounds().getCopy();
+
+ Rectangle newBounds = oldBounds.getCopy();
+
+ // According to the parameters, the new bounds would be the following
+ newBounds.x += request.getMoveDelta().x;
+ newBounds.y += request.getMoveDelta().y;
+ newBounds.height += newSizeDelta.height;
+
+ // Not to check list
+ List<ShapeNodeEditPart> notToCheckExecutionSpecificationList = new BasicEList<ShapeNodeEditPart>();
+ // Affixed ExecutionSpecification List
+ notToCheckExecutionSpecificationList.addAll(getAffixedExecutionSpecificationEditParts(executionSpecificationEP));
+ // Add also current ExecutionSpecification EditPart
+ notToCheckExecutionSpecificationList.add(executionSpecificationEP);
+
+ // find parent bar
+ List<ShapeNodeEditPart> executionSpecificationList = lifelineEP.getChildShapeNodeEditPart();
+ executionSpecificationList.remove(executionSpecificationEP);
+ ShapeNodeEditPart parentBar = getParent(lifelineEP, newBounds, executionSpecificationList);
+
+ // change bounds to relative
+ newBounds = getExecutionSpecificationNewBounds(isMove, lifelineEP, oldBounds, newBounds, notToCheckExecutionSpecificationList, useFixedXPos);
+ if(newBounds == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ if(parentBar != null) {
+ compoundCmd.add(resizeParentExecutionSpecification(lifelineEP, parentBar, newBounds.getCopy(), executionSpecificationList));
+ }
+
+ // Create and add the command to the compound command
+ SetBoundsCommand setBoundsCmd = new SetBoundsCommand(executionSpecificationEP.getEditingDomain(), "Resize of a ExecutionSpecification", executionSpecificationEP, newBounds);
+ compoundCmd.add(new ICommandProxy(setBoundsCmd));
+
+ Rectangle realMoveDelta = getRealMoveDelta(getRelativeBounds(executionSpecificationEP.getFigure()), newBounds);
+
+ if(isMove) {
+ // Move also children
+ compoundCmd.add(createMovingAffixedExecutionSpecificationCommand(executionSpecificationEP, realMoveDelta, newBounds));
+
+ compoundCmd.add(createZOrderCommand(lifelineEP, executionSpecificationEP, newBounds, notToCheckExecutionSpecificationList));
+ }
+
+ // Move also linked Time elements
+ compoundCmd = OccurrenceSpecificationMoveHelper.completeMoveExecutionSpecificationCommand(compoundCmd, executionSpecificationEP, newBounds, request);
+
+ IFigure parentFigure = executionSpecificationEP.getFigure().getParent();
+ parentFigure.translateToAbsolute(newBounds);
+ // translateToAbsolute only does half of the work, I don't know why
+ newBounds.translate(parentFigure.getBounds().getLocation());
+
+ if(updateEnclosingInteraction) {
+ // update the enclosing interaction of a moved execution specification
+ compoundCmd.add(SequenceUtil.createUpdateEnclosingInteractionCommand(executionSpecificationEP, request.getMoveDelta(), newSizeDelta));
+ }
+
+ // keep absolute position of anchors
+ compoundCmd.add(new ICommandProxy(new LifelineEditPart.PreserveAnchorsPositionCommandEx(executionSpecificationEP, new Dimension(realMoveDelta.width, realMoveDelta.height), PreserveAnchorsPositionCommand.PRESERVE_Y, executionSpecificationEP.getFigure(), request.getResizeDirection())));
+ }
+
+ if(ep instanceof CombinedFragment2EditPart) {
+ CombinedFragment2EditPart cf2EP = (CombinedFragment2EditPart)ep;
+ IFigure cf2Figure = cf2EP.getFigure();
+ Rectangle bounds = cf2Figure.getBounds().getCopy();
+ cf2Figure.getParent().translateToAbsolute(bounds);
+
+ Dimension sizeDelta = request.getSizeDelta();
+ if(sizeDelta != null) {
+ if(sizeDelta.width != 0) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ bounds.resize(sizeDelta);
+ }
+ Point moveDelta = request.getMoveDelta();
+ if(moveDelta != null) {
+ bounds.translate(moveDelta);
+ }
+
+ // Create and add the set bounds command to the compound command
+ SetBoundsCommand setBoundsCmd = new SetBoundsCommand(cf2EP.getEditingDomain(), "Resize of a CoRegion", cf2EP, getNewBoundsForCoRegion(lifelineEP, bounds));
+ compoundCmd.add(new ICommandProxy(setBoundsCmd));
+ }
+ }
+
+ if(!compoundCmd.isEmpty()) {
+ return compoundCmd;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Command for change ZOrder of ExecutionSpecification ordered from parent to children.
+ *
+ * @param lifelineEP
+ * the lifeline ep
+ * @param executionSpecificationEP
+ * the execution specification ep
+ * @param newBounds
+ * the new bounds
+ * @param notToCheckExecutionSpecificationList
+ * the not to check bes list
+ *
+ * @return the command
+ */
+ protected final static Command createZOrderCommand(LifelineEditPart lifelineEP, ShapeNodeEditPart executionSpecificationEP, Rectangle newBounds, List<ShapeNodeEditPart> notToCheckExecutionSpecificationList) {
+ List<ShapeNodeEditPart> toCheckExecutionSpecificationList = lifelineEP.getChildShapeNodeEditPart();
+ toCheckExecutionSpecificationList.removeAll(notToCheckExecutionSpecificationList);
+ CompoundCommand cmd = new CompoundCommand();
+ for(ShapeNodeEditPart externalExecutionSpecificationEP : toCheckExecutionSpecificationList) {
+ Rectangle externalExecutionSpecificationBounds = getRelativeBounds(externalExecutionSpecificationEP.getFigure());
+ // Check if there is any contact
+ if(externalExecutionSpecificationBounds.touches(newBounds)) {
+ View containerView = ViewUtil.getContainerView(executionSpecificationEP.getPrimaryView());
+ if(containerView != null) {
+ int i = 0;
+ int parentIndex = -1;
+ int childIndex = -1;
+ for(Object child : containerView.getChildren()) {
+ if(child == externalExecutionSpecificationEP.getPrimaryView()) {
+ parentIndex = i;
+ } else if(child == executionSpecificationEP.getPrimaryView()) {
+ childIndex = i;
+ }
+ if(parentIndex != -1 && childIndex != -1) {
+ if(childIndex > parentIndex) {
+ cmd.add(new ICommandProxy(new CustomZOrderCommand(executionSpecificationEP.getEditingDomain(), executionSpecificationEP.getPrimaryView(), parentIndex)));
+ cmd.add(new ICommandProxy(new CustomZOrderCommand(externalExecutionSpecificationEP.getEditingDomain(), externalExecutionSpecificationEP.getPrimaryView(), childIndex)));
+ } else {
+ break;
+ }
+ }
+ i++;
+ }
+ }
+ }
+ }
+
+ if(!cmd.isEmpty()) {
+ return cmd;
+ }
+ return null;
+ }
+
+ /**
+ * Useful operation to know where the figure of a ExecutionSpecification EditPart should be
+ * positioned within a Lifeline EditPart. The notToCheckList is needed to avoid checking those
+ * ExecutionSpecification EditParts. The returned bounds are relative to the Lifeline figure so
+ * they can be used, directly, within a SetBoundsCommand.
+ *
+ * @param lifelineDotLineFigure
+ * TODO
+ * @param newBounds
+ * The new initial bounds
+ * @param executionSpecifactionEditPart
+ * TODO
+ * @param notToCheckExecutionSpecificationList
+ * The ExecutionSpecification EditPart's List that won't be checked
+ *
+ * @return The new bounds of the executionSpecificationEP figure
+ */
+
+
+ /**
+ * Get the (futur) parent of a ExecutionSpecification
+ *
+ * @param lifelinePart
+ *
+ * @param childBounds
+ * the child bounds
+ * @param toCheckExecutionSpecificationList
+ * List of EditPart to check
+ * @return The parent
+ */
+ public final static ShapeNodeEditPart getParent(LifelineEditPart lifelinePart, Rectangle childBounds, List<ShapeNodeEditPart> toCheckExecutionSpecificationList) {
+ ShapeNodeEditPart parent = null;
+ // Loop through the ExecutionSpecification list and try to find the most to the right
+ // ExecutionSpecification within the executionSpecificationEP Y-axis bounds
+ Rectangle externalBounds = childBounds.getCopy();
+ for(ShapeNodeEditPart externalExecutionSpecificationEP : toCheckExecutionSpecificationList) {
+ Rectangle externalExecutionSpecificationBounds = externalExecutionSpecificationEP.getFigure().getBounds();
+ externalBounds.x = externalExecutionSpecificationBounds.x;
+ externalBounds.width = externalExecutionSpecificationBounds.width;
+ if(externalExecutionSpecificationBounds.touches(externalBounds) && externalExecutionSpecificationBounds.x <= childBounds.x) {
+ if(parent == null || externalExecutionSpecificationBounds.x > parent.getFigure().getBounds().x) {
+ parent = externalExecutionSpecificationEP;
+ }
+ }
+ }
+ return parent;
+ }
+
+ /**
+ * Used to modify the sizeDelta if the given value is higher/lower than the highest/lowest
+ * allowed values of the figure.
+ *
+ * @param figure
+ * the figure
+ * @param sizeDelta
+ * the size delta
+ *
+ * @return a corrected sizeDelta
+ */
+ public final static Dimension adaptSizeDeltaToMaxHeight(IFigure figure, Dimension sizeDelta) {
+ Dimension newSizeDelta = new Dimension(sizeDelta);
+
+ int figureHeight = figure.getBounds().height;
+ int maximunFigureHeight = figure.getMaximumSize().height;
+ int minimunFigureHeight = figure.getMinimumSize().height;
+
+ int height = figureHeight + newSizeDelta.height;
+ if(height > maximunFigureHeight) {
+ newSizeDelta.height = maximunFigureHeight - figureHeight;
+ } else if(height < minimunFigureHeight) {
+ newSizeDelta.height = minimunFigureHeight - figureHeight;
+ }
+
+ return newSizeDelta;
+ }
+
+ /**
+ * Returns all the ExecutionSpecification EditParts that are affixed to the right side of the
+ * given ExecutionSpecification EditPart. Not only the ones directly affixed to the
+ * executionSpecificationEP are returned, but the ones that are indirectly affixed as well (this
+ * is done recursively)
+ *
+ * @param executionSpecificationEP
+ * the execution specification ep
+ *
+ * @return the list of affixed ExecutionSpecification. If there is no affixed
+ * ExecutionSpecification, then an empty list will be returned
+ */
+ public final static List<ShapeNodeEditPart> getAffixedExecutionSpecificationEditParts(ShapeNodeEditPart executionSpecificationEP) {
+ List<ShapeNodeEditPart> notToCheckExecutionSpecificationList = new ArrayList<ShapeNodeEditPart>();
+ return getAffixedExecutionSpecificationEditParts(executionSpecificationEP, notToCheckExecutionSpecificationList);
+
+ }
+
+ /**
+ * Operation used by the above operation. It's main goal is to obtain, recursively, all the
+ * affixed ExecutionSpecification. In order to do so, it is needed a ExecutionSpecification
+ * EditPart and the notToCheckList.
+ *
+ * @param executionSpecificationEP
+ * the execution specification ep
+ * @param notToCheckExecutionSpecificationList
+ * the not to check ExecutionSpecification list
+ *
+ * @return the list of affixed ExecutionSpecification. If there is no affixed
+ * ExecutionSpecification, then an empty list will be returned
+ */
+ protected final static List<ShapeNodeEditPart> getAffixedExecutionSpecificationEditParts(ShapeNodeEditPart executionSpecificationEP, List<ShapeNodeEditPart> notToCheckExecutionSpecificationList) {
+ // Add itself to the notToCheck list
+ List<ShapeNodeEditPart> newNotToCheckExecutionSpecificationList = new ArrayList<ShapeNodeEditPart>(notToCheckExecutionSpecificationList);
+ newNotToCheckExecutionSpecificationList.add(executionSpecificationEP);
+
+ // LifelineEditPart where the ExecutionSpecification EditPart is contained
+ LifelineEditPart lifelineEP = (LifelineEditPart)executionSpecificationEP.getParent();
+
+ // ExecutionSpecification EditParts list
+ List<ShapeNodeEditPart> executionSpecificationList = lifelineEP.getChildShapeNodeEditPart();
+ executionSpecificationList.remove(newNotToCheckExecutionSpecificationList);
+
+ // List to store the Affixed ExecutionSpecification
+ List<ShapeNodeEditPart> affixedExecutionSpecificationList = new ArrayList<ShapeNodeEditPart>();
+
+ // Loop ExecutionSpecificationough the ExecutionSpecification list
+ for(ShapeNodeEditPart childExecutionSpecificationEP : executionSpecificationList) {
+ if(isAffixedToRight(executionSpecificationEP.getFigure().getBounds(), childExecutionSpecificationEP.getFigure().getBounds())) {
+ affixedExecutionSpecificationList.add(childExecutionSpecificationEP);
+ // Add also it's affixed ExecutionSpecification
+ affixedExecutionSpecificationList.addAll(getAffixedExecutionSpecificationEditParts(childExecutionSpecificationEP, newNotToCheckExecutionSpecificationList));
+ }
+ }
+
+ // To the ExecutionSpecification list
+ return affixedExecutionSpecificationList;
+ }
+
+ /**
+ * Checks whether the right EditPart is affixed to the left EditPart. In order to do so, the
+ * operation checks if the right figure is really on the right and, if so, it just returns true
+ * if figures touch each other.
+ *
+ * @param leftFigure
+ * The left rectangle
+ * @param rightFigure
+ * The right rectangle
+ *
+ * @return true if the rectangles of both figures touch and the right figure is really on the
+ * right. False otherwise
+ */
+ public final static boolean isAffixedToRight(Rectangle leftFigure, Rectangle rightFigure) {
+ return leftFigure.touches(rightFigure) && leftFigure.x < rightFigure.x;
+ }
+
+ /**
+ * If a ExecutionSpecification EditPart is going to be moved according to a moveDelta, this
+ * operation returns a compoundCommand that also moves the affixed ExecutionSpecification
+ * according to that delta.
+ *
+ * @param executionSpecificationEP
+ * The ExecutionSpecification EditPart that is going to be moved
+ * @param moveDelta
+ * The moveDelta of the previous EditPart
+ * @param newBounds
+ * the new bounds
+ *
+ * @return the compound command
+ */
+ protected final static CompoundCommand createMovingAffixedExecutionSpecificationCommand(ShapeNodeEditPart executionSpecificationEP, Rectangle moveDelta, Rectangle newBounds) {
+ if(moveDelta.y != 0 || moveDelta.height != 0) {
+ CompoundCommand compoundCmd = new CompoundCommand();
+ for(ShapeNodeEditPart childExecutionSpecificationEP : getAffixedExecutionSpecificationEditParts(executionSpecificationEP)) {
+ // Get Relative Bounds
+ Rectangle childBounds = getRelativeBounds(childExecutionSpecificationEP.getFigure());
+ // Apply delta
+ childBounds.y += moveDelta.y;
+ childBounds.x += moveDelta.x;
+
+ // Create the child's SetBoundsCommand
+ SetBoundsCommand childSetBoundsCmd = new SetBoundsCommand(executionSpecificationEP.getEditingDomain(), "Movement of affixed ExecutionSpecification", childExecutionSpecificationEP, childBounds);
+ compoundCmd.add(new ICommandProxy(childSetBoundsCmd));
+
+
+ IFigure parentFigure = childExecutionSpecificationEP.getFigure().getParent();
+ parentFigure.translateToAbsolute(newBounds);
+ // translateToAbsolute only does half of the work, I don't know why
+ newBounds.translate(parentFigure.getBounds().getLocation());
+
+ // change the enclosing interaction of the moved affixed child if necessary
+ compoundCmd.add(SequenceUtil.createUpdateEnclosingInteractionCommand(childExecutionSpecificationEP, moveDelta.getLocation(), moveDelta.getSize()));
+
+ // Move it's children as well
+ if(!getAffixedExecutionSpecificationEditParts(childExecutionSpecificationEP).isEmpty()) {
+ compoundCmd.add(createMovingAffixedExecutionSpecificationCommand(childExecutionSpecificationEP, moveDelta, childBounds));
+ }
+ }
+ if(!compoundCmd.isEmpty()) {
+ return compoundCmd;
+ }
+ }
+ return null;
+ }
+
+
+
+ /**
+ * Given an AbstractGraphialEditPart and the new relative bounds that the EditPart will have, it
+ * returns the real delta applied to the movement.
+ *
+ * @param oldRelativeBounds
+ * The old position of the mentioned EditPart
+ * @param newRelativeBounds
+ * The new position of the mentioned EditPart
+ *
+ * @return The real MoveDelta applied
+ */
+ public final static Rectangle getRealMoveDelta(Rectangle oldRelativeBounds, Rectangle newRelativeBounds) {
+ Rectangle realMoveDelta = new Rectangle();
+ realMoveDelta.x = newRelativeBounds.x - oldRelativeBounds.x;
+ realMoveDelta.y = newRelativeBounds.y - oldRelativeBounds.y;
+ realMoveDelta.height = newRelativeBounds.height - oldRelativeBounds.height;
+ realMoveDelta.width = newRelativeBounds.width - oldRelativeBounds.width;
+ return realMoveDelta;
+ }
+
+ /**
+ * It returns the relative bounds of an Figure.
+ *
+ * @param figure
+ * The Figure
+ *
+ * @return The relative bounds regarding it's parent figure
+ */
+ public final static Rectangle getRelativeBounds(IFigure figure) {
+ Rectangle relBounds = figure.getBounds().getCopy();
+ Rectangle parentRectangle = figure.getParent().getBounds();
+ relBounds.x -= parentRectangle.x;
+ relBounds.y -= parentRectangle.y;
+ return relBounds;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionEditPolicy.java
new file mode 100644
index 00000000000..4f9a23d7ce0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionEditPolicy.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * 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.
+ */
+public class MessageConnectionEditPolicy extends ConnectionEditPolicy {
+
+ @Override
+ protected Command createDeleteSemanticCommand(GroupRequest deleteRequest) {
+ CompoundCommand deleteSemanticsCommand = new CompoundCommand();
+ Command deleteSemanticCommand = super.createDeleteSemanticCommand(deleteRequest);
+ deleteSemanticsCommand.add(deleteSemanticCommand);
+
+ return LifelineMessageCreateHelper.restoreLifelineOnMessageDelete(deleteSemanticsCommand, getHost());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ 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());
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java
new file mode 100644
index 00000000000..a2e57f864b0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java
@@ -0,0 +1,332 @@
+/*****************************************************************************
+ * 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 java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractRouter;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+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.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.BendpointRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConnectionBendpointEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.util.SelectInDiagramHelper;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.LineMode;
+import org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers.MessageRouter.RouterKind;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart.MessageCreate;
+import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineMessageCreateHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationMoveHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+/**
+ * This bendpoint edit policy is used to allow drag of horizontal messages and forbid drag otherwise.
+ *
+ * @author mvelten
+ *
+ */
+@SuppressWarnings("restriction")
+public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditPolicy {
+
+ public MessageConnectionLineSegEditPolicy() {
+ super(LineMode.ORTHOGONAL_FREE);
+ }
+
+ @Override
+ public Command getCommand(Request request) {
+ RouterKind kind = RouterKind.getKind(getConnection(), getConnection().getPoints());
+ if(kind == RouterKind.SELF || kind == RouterKind.HORIZONTAL || getConnection() instanceof MessageCreate){
+ return super.getCommand(request);
+ }
+ return null;
+ }
+
+ /**
+ * Move the anchors along with the line and update bendpoints accordingly.
+ */
+ @Override
+ protected Command getBendpointsChangedCommand(BendpointRequest request) {
+ if((getHost().getViewer() instanceof ScrollingGraphicalViewer) && (getHost().getViewer().getControl() instanceof FigureCanvas)) {
+ SelectInDiagramHelper.exposeLocation((FigureCanvas)getHost().getViewer().getControl(), request.getLocation().getCopy());
+ }
+
+ if(getHost() instanceof ConnectionNodeEditPart) {
+ ConnectionNodeEditPart connectionPart = (ConnectionNodeEditPart)getHost();
+ EObject message = connectionPart.resolveSemanticElement();
+ if(message instanceof Message) {
+ MessageEnd send = ((Message)message).getSendEvent();
+ MessageEnd rcv = ((Message)message).getReceiveEvent();
+ EditPart srcPart = connectionPart.getSource();
+ LifelineEditPart srcLifelinePart = SequenceUtil.getParentLifelinePart(srcPart);
+ EditPart tgtPart = connectionPart.getTarget();
+ LifelineEditPart tgtLifelinePart = SequenceUtil.getParentLifelinePart(tgtPart);
+ if(send instanceof OccurrenceSpecification && rcv instanceof OccurrenceSpecification && srcLifelinePart != null && tgtLifelinePart != null) {
+ RouterKind kind = RouterKind.getKind(getConnection(), getConnection().getPoints());
+ if(getHost() instanceof Message2EditPart && kind == RouterKind.SELF){
+ return getSelfLinkMoveCommand(request, connectionPart, send, rcv, srcLifelinePart);
+ }else if(getHost() instanceof Message4EditPart){
+ IFigure fig = tgtLifelinePart.getPrimaryShape().getFigureLifelineNameContainerFigure();
+ Rectangle bounds = fig.getBounds().getCopy();
+ fig.translateToAbsolute(bounds);
+
+ PointList points = getConnection().getPoints();
+ Point sourceRefPoint = points.getFirstPoint().getCopy();;
+ getConnection().translateToAbsolute(sourceRefPoint);
+
+ int dy = sourceRefPoint.y - bounds.getCenter().y;
+ Point location = tgtLifelinePart.getFigure().getBounds().getLocation().getCopy().translate(0, dy);
+ Command moveCmd = new ICommandProxy(new SetBoundsCommand(tgtLifelinePart.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(tgtLifelinePart.getNotationView()), location));
+
+ // Take care of the order of commands, to make sure target is always bellow the source.
+ if(dy < 0){ // move up
+ return LifelineMessageCreateHelper.moveCascadeLifeline(tgtLifelinePart,moveCmd,dy);
+ }else{ // move down
+ Command cmd = LifelineMessageCreateHelper.moveCascadeLifeline(tgtLifelinePart,null,dy);
+ cmd = cmd == null? moveCmd: cmd.chain(moveCmd);
+ return cmd;
+ }
+ }else{
+ int y = request.getLocation().y;
+ List<EditPart> empty = Collections.emptyList();
+ Command srcCmd = OccurrenceSpecificationMoveHelper.getMoveOccurrenceSpecificationsCommand((OccurrenceSpecification)send, null, y, -1, srcLifelinePart, empty);
+ Command tgtCmd = OccurrenceSpecificationMoveHelper.getMoveOccurrenceSpecificationsCommand((OccurrenceSpecification)rcv, null, y, -1, tgtLifelinePart, empty);
+ CompoundCommand compoudCmd = new CompoundCommand(Messages.MoveMessageCommand_Label);
+ /*
+ * Take care of the order of commands, to make sure target is always bellow the source.
+ * Otherwise, moving the target above the source would cause order conflict with existing CF.
+ */
+ Point oldLocation = SequenceUtil.getAbsoluteEdgeExtremity(connectionPart, true);
+ if(oldLocation != null) {
+ int oldY = oldLocation.y;
+ if(oldY < y) {
+ compoudCmd.add(tgtCmd);
+ compoudCmd.add(srcCmd);
+ } else {
+ compoudCmd.add(srcCmd);
+ compoudCmd.add(tgtCmd);
+ }
+ return compoudCmd;
+ }
+ }
+ }
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ protected Command getSelfLinkMoveCommand(BendpointRequest request, ConnectionNodeEditPart connectionPart, MessageEnd send, MessageEnd rcv, LifelineEditPart srcLifelinePart) {
+ CompoundCommand compoudCmd = new CompoundCommand(Messages.MoveMessageCommand_Label);
+ PointList points = getConnection().getPoints();
+ Point sourceRefPoint = points.getFirstPoint();;
+ Point targetRefPoint = points.getLastPoint();;
+ getConnection().translateToAbsolute(sourceRefPoint);
+ getConnection().translateToAbsolute(targetRefPoint);
+
+ Point oldSourcePoint = SequenceUtil.findLocationOfEvent(srcLifelinePart, (OccurrenceSpecification)send);
+ int dy = sourceRefPoint.y - oldSourcePoint.y;
+ int dx = request.getLocation().x > sourceRefPoint.x ? 3 : -3;
+
+ // check bounds
+ NodeFigure fig = srcLifelinePart.getPrimaryShape().getFigureLifelineDotLineFigure().getDashLineRectangle();
+ Rectangle bounds = fig.getBounds().getCopy();
+ fig.translateToAbsolute(bounds);
+
+ bounds.expand(6, 0);
+ if(!bounds.contains(sourceRefPoint) || !bounds.contains(targetRefPoint)){
+ return UnexecutableCommand.INSTANCE; // cannot move outside lifeline part
+ }
+ sourceRefPoint = sourceRefPoint.translate(dx, 0);
+ targetRefPoint = targetRefPoint.translate(dx, 0);
+ Command srcCmd = getReconnectCommand(connectionPart, srcLifelinePart, sourceRefPoint, RequestConstants.REQ_RECONNECT_SOURCE);
+ Command tgtCmd = getReconnectCommand(connectionPart, srcLifelinePart, targetRefPoint, RequestConstants.REQ_RECONNECT_TARGET);
+
+ if(dy < 0){ // move up
+ compoudCmd.add(srcCmd);
+ compoudCmd.add(tgtCmd);
+ }else{ // move down
+ compoudCmd.add(tgtCmd);
+ compoudCmd.add(srcCmd);
+ }
+ return compoudCmd;
+ }
+
+ protected Command getReconnectCommand(ConnectionNodeEditPart connectionPart, LifelineEditPart targetPart, Point location, String requestType) {
+ // Create and set the properties of the request
+ ReconnectRequest reconnReq = new ReconnectRequest();
+ reconnReq.setConnectionEditPart(connectionPart);
+ reconnReq.setLocation(location);
+ reconnReq.setTargetEditPart(targetPart);
+ reconnReq.setType(requestType);
+ // add a parameter to bypass the move impact to avoid infinite loop
+ reconnReq.getExtendedData().put(SequenceRequestConstant.DO_NOT_MOVE_EDIT_PARTS, true);
+ Command cmd = targetPart.getCommand(reconnReq);
+ return cmd;
+ }
+
+ /**
+ * don't show feedback if the drag is forbidden (message not horizontal).
+ */
+ @Override
+ public void showSourceFeedback(Request request) {
+ if(request instanceof BendpointRequest) {
+ RouterKind kind = RouterKind.getKind(getConnection(), getConnection().getPoints());
+ if(kind == RouterKind.SELF || kind == RouterKind.HORIZONTAL || getConnection() instanceof MessageCreate){
+ super.showSourceFeedback(request);
+ }
+ }
+ }
+
+ private ConnectionRouter router;
+
+ static class DummyRouter extends AbstractRouter {
+
+ public void route(Connection conn) {
+ }
+ }
+
+ protected void showMoveLineSegFeedback(BendpointRequest request) {
+ RouterKind kind = RouterKind.getKind(getConnection(), getConnection().getPoints());
+ if(getHost() instanceof Message2EditPart && kind == RouterKind.SELF ){
+ if(router == null){
+ router = getConnection().getConnectionRouter();
+ getConnection().setConnectionRouter( new DummyRouter());
+ }
+ PointList linkPoints = getConnection().getPoints().getCopy();
+
+ Point ptLoc = new Point(request.getLocation());
+ getConnection().translateToRelative(ptLoc);
+ int dy = 0;
+ if(request.getIndex() == 0)
+ dy = ptLoc.y - linkPoints.getFirstPoint().y;
+ else if(request.getIndex() == 2)
+ dy = ptLoc.y - linkPoints.getLastPoint().y;
+
+ // move each point on link
+ int size = linkPoints.size();
+ for(int i = 0; i < size; i ++){
+ Point p = linkPoints.getPoint(i).translate(0, dy);
+ linkPoints.setPoint(p, i);
+ }
+
+ // link should not exceed lifeline bounds
+ if(checkBounds(linkPoints)){
+ getConnection().setPoints(linkPoints);
+ getConnection().getLayoutManager().layout(getConnection());
+ }
+ return;
+ }
+ if(getHost() instanceof Message4EditPart){
+ if(router == null){
+ router = getConnection().getConnectionRouter();
+ getConnection().setConnectionRouter( new DummyRouter());
+ }
+ PointList linkPoints = getConnection().getPoints().getCopy();
+
+ Point ptLoc = new Point(request.getLocation());
+ getConnection().translateToRelative(ptLoc);
+ int dy = ptLoc.y - linkPoints.getFirstPoint().y;
+ int size = linkPoints.size();
+ for(int i = 0; i < size; i ++){
+ Point p = linkPoints.getPoint(i).translate(0, dy);
+ linkPoints.setPoint(p, i);
+ }
+ if(checkBounds(linkPoints)){
+ getConnection().setPoints(linkPoints);
+ getConnection().getLayoutManager().layout(getConnection());
+ }
+ return;
+ }
+ super.showMoveLineSegFeedback(request);
+ }
+
+ protected boolean checkBounds(PointList linkPoints) {
+ EditPart sourcePart = ((ConnectionNodeEditPart)getHost()).getSource();
+ if(sourcePart instanceof LifelineEditPart){
+ LifelineEditPart lep = (LifelineEditPart)sourcePart;
+ NodeFigure fig = lep.getPrimaryShape().getFigureLifelineDotLineFigure().getDashLineRectangle();
+ Rectangle bounds = fig.getBounds().getCopy();
+ fig.translateToAbsolute(bounds);
+
+ Rectangle conBounds = linkPoints.getBounds();
+ getConnection().translateToAbsolute(conBounds);
+ // check top and bottom y limit
+ if(conBounds.y <= bounds.y || conBounds.getBottom().y >= bounds.getBottom().y)
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void eraseConnectionFeedback(BendpointRequest request, boolean removeFeedbackFigure) {
+ getConnection().setVisible(true);
+ super.eraseConnectionFeedback(request, removeFeedbackFigure);
+
+ if(router != null)
+ getConnection().setConnectionRouter(router);
+ router = null;
+ }
+
+// private boolean isHorizontal() {
+// Connection connection = getConnection();
+// RouterKind kind = RouterKind.getKind(connection, connection.getPoints());
+//
+// if(kind.equals(RouterKind.HORIZONTAL)) {
+// return true;
+// }
+// return false;
+// }
+//
+// final private static char TERMINAL_START_CHAR = '(';
+//
+// final private static char TERMINAL_DELIMITER_CHAR = ',';
+//
+// final private static char TERMINAL_END_CHAR = ')';
+//
+// private static String composeTerminalString(PrecisionPoint p) {
+// StringBuffer s = new StringBuffer(24);
+// s.append(TERMINAL_START_CHAR); // 1 char
+// s.append(p.preciseX); // 10 chars
+// s.append(TERMINAL_DELIMITER_CHAR); // 1 char
+// s.append(p.preciseY); // 10 chars
+// s.append(TERMINAL_END_CHAR); // 1 char
+// return s.toString(); // 24 chars max (+1 for safety, i.e. for string termination)
+// }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageLabelEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageLabelEditPolicy.java
new file mode 100644
index 00000000000..9c68048832a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageLabelEditPolicy.java
@@ -0,0 +1,1000 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+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.gef.ConnectionEditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractMaskManagedEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.sequence.preferences.MessagePreferencePage;
+import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
+import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.papyrus.uml.tools.utils.ParameterUtil;
+import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
+import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
+import org.eclipse.papyrus.uml.tools.utils.TypedElementUtil;
+import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+
+public class MessageLabelEditPolicy extends AbstractMaskManagedEditPolicy {
+
+ public static interface ICustomMessageLabel{
+
+ }
+
+ private DefaultValueListener defaultValueListener;
+
+ /**
+ * Refreshes the display of the edit part
+ */
+ @Override
+ public void refreshDisplay() {
+ // calls the helper for this edit Part
+ ConnectionEditPart lp = (ConnectionEditPart)getHost();
+ List children = lp.getChildren();
+ for(Object p : children)
+ if(p instanceof ICustomMessageLabel){
+ MessageLabelHelper.getInstance().refreshEditPartDisplay((GraphicalEditPart)p);
+ }
+ }
+
+ public int getCurrentDisplayValue() {
+ EAnnotation customeDisplayAnnotation = ((View)getHost().getModel()).getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ int displayValue = getDefaultDisplayValue();
+ if(customeDisplayAnnotation != null) {
+ displayValue = Integer.parseInt(customeDisplayAnnotation.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE));
+ } else {
+ // no specific information => look in preferences
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ int displayValueTemp = store.getInt(MessagePreferencePage.LABEL_DISPLAY_PREFERENCE);
+ if(displayValueTemp != 0) {
+ displayValue = displayValueTemp;
+ }
+ }
+ return displayValue;
+ }
+
+ public int getDefaultDisplayValue() {
+ return MessagePreferencePage.DEFAULT_LABEL_DISPLAY;
+ }
+
+ public String getMaskLabel(int value) {
+ return MessageLabelHelper.getInstance().getMaskLabel(value);
+ }
+
+ public Collection<String> getMaskLabels() {
+ return MessageLabelHelper.getInstance().getMaskLabels();
+ }
+
+ public Map<Integer, String> getMasks() {
+ return MessageLabelHelper.getInstance().getMasks();
+ }
+
+ public Collection<Integer> getMaskValues() {
+ return MessageLabelHelper.getInstance().getMaskValues();
+ }
+
+ public String getPreferencePageID() {
+ return "org.eclipse.papyrus.uml.diagram.sequence.preferences.MessagePreferencePage";
+ }
+
+ @Override
+ public Message getUMLElement() {
+ if(hostSemanticElement instanceof Message)
+ return ((Message)hostSemanticElement);
+ return null;
+ }
+
+ @Override
+ public void addAdditionalListeners() {
+ super.addAdditionalListeners();
+ this.defaultValueListener = new DefaultValueListener();
+ Message e = getUMLElement();
+ // check host semantic element is not null
+ if(e == null || e.getSignature() == null) {
+ return;
+ }
+ NamedElement sig = e.getSignature();
+ if(sig instanceof Operation){
+ Operation operation = (Operation)sig;
+ getDiagramEventBroker().addNotificationListener(operation, this);
+ // adds a listener to the element itself, and to linked elements, like Type
+ for(Parameter parameter : operation.getOwnedParameters()) {
+ getDiagramEventBroker().addNotificationListener(parameter, this);
+ getDiagramEventBroker().addNotificationListener(parameter.getDefaultValue(), defaultValueListener);
+
+ // should also add this element as a listener of parameter type
+ getDiagramEventBroker().addNotificationListener(parameter.getType(), this);
+ }
+ }else if(sig instanceof Signal){
+ Signal signal = (Signal)sig;
+ getDiagramEventBroker().addNotificationListener(signal, this);
+ for(Property property : signal.getOwnedAttributes()) {
+ getDiagramEventBroker().addNotificationListener(property, this);
+ getDiagramEventBroker().addNotificationListener(property.getDefaultValue(), defaultValueListener);
+
+ // should also add this element as a listener of parameter type
+ getDiagramEventBroker().addNotificationListener(property.getType(), this);
+ }
+ }
+
+ EList<ValueSpecification> argments = e.getArguments();
+ for(ValueSpecification v : argments)
+ if(v instanceof EObject) {
+ getDiagramEventBroker().addNotificationListener((EObject)v, this);
+ }
+ }
+
+ @Override
+ protected void removeAdditionalListeners() {
+ super.removeAdditionalListeners();
+ Message e = getUMLElement();
+ // check host semantic element is not null
+ if(e == null || e.getSignature() == null) {
+ return;
+ }
+ NamedElement sig = e.getSignature();
+ if(sig instanceof Operation){
+ Operation operation = (Operation)sig;
+ getDiagramEventBroker().removeNotificationListener(operation, this);
+ for(Parameter parameter : operation.getOwnedParameters()) {
+ getDiagramEventBroker().removeNotificationListener(parameter, this);
+ getDiagramEventBroker().removeNotificationListener(parameter.getDefaultValue(), defaultValueListener);
+
+ // remove parameter type listener
+ getDiagramEventBroker().removeNotificationListener(parameter.getType(), this);
+ }
+ }else if(sig instanceof Signal){
+ Signal signal = (Signal)sig;
+ getDiagramEventBroker().removeNotificationListener(signal, this);
+ for(Property property : signal.getOwnedAttributes()) {
+ getDiagramEventBroker().removeNotificationListener(property, this);
+ getDiagramEventBroker().removeNotificationListener(property.getDefaultValue(), defaultValueListener);
+
+ // remove parameter type listener
+ getDiagramEventBroker().removeNotificationListener(property.getType(), this);
+ }
+ }
+
+ EList<ValueSpecification> argments = e.getArguments();
+ for(ValueSpecification v : argments)
+ if(v instanceof EObject) {
+ getDiagramEventBroker().removeNotificationListener((EObject)v, this);
+ }
+ }
+
+ @Override
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ final Object object = notification.getNotifier();
+ Message e = getUMLElement();
+ // check host semantic element is not null
+ if(e == null) {
+ return;
+ }
+ if(UMLPackage.Literals.MESSAGE__ARGUMENT.equals( notification.getFeature())){
+ parameterListChange(notification);
+ return;
+ }else if(e.getArguments().contains(object)){
+ refreshDisplay();
+ return;
+ }
+
+ NamedElement sig = e.getSignature();
+ if(sig instanceof Operation){
+ Operation operation = (Operation)sig;
+
+ if(object.equals(operation)) {
+ notifyOperationChanged(operation, notification);
+ } else if(isParameter(object, operation)) {
+ notifyParameterChanged(notification);
+ } else if(isParameterType(object, operation)) {
+ notifyTypeChanged(notification);
+ }
+ }else if(sig instanceof Signal){
+ Signal signal = (Signal)sig;
+ if(object.equals(signal)) {
+ notifySignalChanged(signal, notification);
+ }else if(isProperty(object, signal)) {
+ notifyPropertyChanged(notification);
+ }else if(isPropertyType(object, signal)) {
+ notifyTypeChanged(notification);
+ }else if(object instanceof ValueSpecification){
+ Element own = ((ValueSpecification)object).getOwner();
+ if(isProperty(own, signal)){
+ refreshDisplay(); // may be default value
+ }
+ }
+ }
+
+ if(isMaskManagedAnnotation(object) ){
+ refreshDisplay();
+ }else if(isRemovedMaskManagedLabelAnnotation(object, notification)) {
+ refreshDisplay();
+ }else if(sig == null && object instanceof Message && notification.getFeature().equals(UMLPackage.eINSTANCE.getNamedElement_Name())){
+ refreshDisplay();
+ }
+ }
+
+ class DefaultValueListener implements NotificationListener{
+
+ public void notifyChanged(Notification notification) {
+ refreshDisplay();
+ }
+ }
+
+ private void notifyPropertyChanged(Notification notification) {
+ switch(notification.getFeatureID(Property.class)) {
+ case UMLPackage.PROPERTY__DEFAULT_VALUE: // set or unset default value
+ if(notification.getOldValue() instanceof EObject)
+ getDiagramEventBroker().removeNotificationListener((EObject)notification.getOldValue(), defaultValueListener);
+ if(notification.getNewValue() instanceof EObject)
+ getDiagramEventBroker().addNotificationListener((EObject)notification.getNewValue(), defaultValueListener);
+ refreshDisplay();
+ break;
+ case UMLPackage.PROPERTY__NAME:
+ case UMLPackage.PROPERTY__IS_ORDERED:
+ case UMLPackage.PROPERTY__LOWER:
+ case UMLPackage.PROPERTY__UPPER:
+ case UMLPackage.PROPERTY__LOWER_VALUE:
+ case UMLPackage.PROPERTY__UPPER_VALUE:
+ refreshDisplay();
+ break;
+ case UMLPackage.PROPERTY__TYPE:
+ parameterListChange(notification);
+
+ break;
+ default:
+ // does nothing in other cases
+ break;
+ }
+ }
+
+ /**
+ * notifies that a parameter of the operation has changed.
+ *
+ * @param parameter
+ * the {@link Parameter} that has changed
+ * @param notification
+ * the notification send when the element has been changed
+ */
+ protected void notifyParameterChanged(Notification notification) {
+ switch(notification.getFeatureID(Parameter.class)) {
+ case UMLPackage.PARAMETER__DEFAULT_VALUE:
+ if(notification.getOldValue() instanceof EObject)
+ getDiagramEventBroker().removeNotificationListener((EObject)notification.getOldValue(), defaultValueListener);
+ if(notification.getNewValue() instanceof EObject)
+ getDiagramEventBroker().addNotificationListener((EObject)notification.getNewValue(), defaultValueListener);
+ refreshDisplay();
+ break;
+ case UMLPackage.PARAMETER__NAME:
+ case UMLPackage.PARAMETER__DIRECTION:
+ case UMLPackage.PARAMETER__IS_STREAM:
+ case UMLPackage.PARAMETER__IS_ORDERED:
+ case UMLPackage.PARAMETER__LOWER:
+ case UMLPackage.PARAMETER__UPPER:
+ case UMLPackage.PARAMETER__LOWER_VALUE:
+ case UMLPackage.PARAMETER__UPPER_VALUE:
+ refreshDisplay();
+ break;
+ case UMLPackage.PARAMETER__TYPE:
+ parameterListChange(notification);
+
+ break;
+ default:
+ // does nothing in other cases
+ break;
+ }
+ }
+
+ protected void parameterListChange(Notification notification) {
+ switch(notification.getEventType()) {
+ // if it is added => adds listener to the type element
+ case Notification.ADD:
+ getDiagramEventBroker().addNotificationListener((EObject)notification.getNewValue(), this);
+ refreshDisplay();
+ // if it is removed => removes listener from the type element
+ break;
+ case Notification.ADD_MANY:
+ if(notification.getNewValue() instanceof List<?>) {
+ List<?> addedElements = (List<?>)notification.getNewValue();
+ for(Object addedElement : addedElements) {
+ if(addedElement instanceof EObject) {
+ getDiagramEventBroker().addNotificationListener((EObject)addedElement, this);
+ }
+ }
+ }
+ refreshDisplay();
+ break;
+ case Notification.REMOVE:
+ getDiagramEventBroker().removeNotificationListener((EObject)notification.getOldValue(), this);
+ refreshDisplay();
+ break;
+ case Notification.REMOVE_MANY:
+ if(notification.getOldValue() instanceof List<?>) {
+ List<?> removedElements = (List<?>)notification.getOldValue();
+ for(Object removedElement : removedElements) {
+ if(removedElement instanceof EObject) {
+ getDiagramEventBroker().removeNotificationListener((EObject)removedElement, this);
+ }
+ }
+ }
+ refreshDisplay();
+ break;
+ // if it is set, remove the old one and adds the new one. this is the method use when
+ // the type is set or removed...
+ case Notification.SET:
+ if(notification.getNewValue() != null) {
+ getDiagramEventBroker().addNotificationListener((EObject)notification.getNewValue(), this);
+ }
+ if(notification.getOldValue() != null) {
+ getDiagramEventBroker().removeNotificationListener((EObject)notification.getOldValue(), this);
+ }
+ refreshDisplay();
+
+ default:
+ break;
+
+ }
+ }
+
+ /**
+ * notifies that a parameter of the operation has changed.
+ *
+ * @param parameter
+ * the {@link Parameter} that has changed
+ * @param notification
+ * the notification send when the element has been changed
+ */
+ protected void notifyTypeChanged(Notification notification) {
+ // should be type.class, but seems to be a bug if this is put instead.
+ switch(notification.getFeatureID(notification.getNotifier().getClass())) {
+ case UMLPackage.TYPE__NAME:
+ case UMLPackage.TYPE__TEMPLATE_PARAMETER:
+ case UMLPackage.TYPE__VISIBILITY:
+ refreshDisplay();
+ break;
+ default:
+ // does nothing in other cases
+ break;
+ }
+ }
+
+ /**
+ * notifies that the the property has changed.
+ *
+ * @param operation
+ * the operation that has changed
+ * @param notification
+ * the notification send when the element has been changed
+ */
+ protected void notifyOperationChanged(Operation operation, Notification notification) {
+ switch(notification.getFeatureID(Operation.class)) {
+ case UMLPackage.OPERATION__NAME:
+ case UMLPackage.OPERATION__VISIBILITY:
+ case UMLPackage.OPERATION__IS_UNIQUE:
+ case UMLPackage.OPERATION__REDEFINED_OPERATION:
+ case UMLPackage.OPERATION__IS_ORDERED:
+ case UMLPackage.OPERATION__LOWER:
+ case UMLPackage.OPERATION__UPPER:
+ case UMLPackage.OPERATION__IS_STATIC:
+ refreshDisplay();
+ break;
+ case UMLPackage.OPERATION__OWNED_PARAMETER:
+ parameterListChange(notification);
+ break;
+ default:
+ // does nothing in other cases
+ break;
+ }
+ }
+
+
+ private void notifySignalChanged(Signal signal, Notification notification) {
+ switch(notification.getFeatureID(Signal.class)) {
+ case UMLPackage.SIGNAL__NAME:
+ case UMLPackage.SIGNAL__VISIBILITY:
+ refreshDisplay();
+ break;
+ case UMLPackage.SIGNAL__OWNED_ATTRIBUTE:
+ parameterListChange(notification);
+ break;
+ default:
+ // does nothing in other cases
+ break;
+ }
+ }
+
+ /**
+ * Checks if the given object is one of the parameter type of the operation
+ *
+ * @param object
+ * the object to test
+ * @param operation
+ * @return <code>true</code> if the object corresponds to the type of a parameter of the
+ * operation
+ */
+ protected boolean isParameterType(Object object, Operation operation) {
+ if(!(object instanceof Type)) {
+ return false;
+ }
+
+ for(Parameter parameter : operation.getOwnedParameters()) {
+ if(object.equals(parameter.getType())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the given object is one of the parameter of the operation
+ *
+ * @param object
+ * the object to test
+ * @param operation
+ * @return <code>true</code> if the object is a parameter of the operation
+ */
+ protected boolean isParameter(Object object, Operation operation) {
+ if(!(object instanceof Parameter)) {
+ return false;
+ }
+
+ return operation.getOwnedParameters().contains(object);
+ }
+
+ private boolean isPropertyType(Object object, Signal signal) {
+ if(!(object instanceof Type)) {
+ return false;
+ }
+
+ for(Property property :signal.getOwnedAttributes()) {
+ if(object.equals(property.getType())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isProperty(Object object, Signal signal) {
+ if(!(object instanceof Property)) {
+ return false;
+ }
+
+ return signal.getOwnedAttributes().contains(object);
+ }
+
+ static class MessageLabelHelper extends StereotypedElementLabelHelper{
+ /**
+ * singelton instance
+ */
+ private static MessageLabelHelper labelHelper;
+
+ /** Map for masks */
+ protected final Map<Integer, String> masks = new HashMap<Integer, String>(11);
+
+ protected MessageLabelHelper() {
+ // initialize the map
+ masks.put(ICustomAppearence.DISP_VISIBILITY, "Visibility");
+ masks.put(ICustomAppearence.DISP_NAME, "Name");
+ masks.put(ICustomAppearence.DISP_PARAMETER_NAME, "Parameters Name");
+ masks.put(ICustomAppearence.DISP_PARAMETER_DIRECTION, "Parameters Direction");
+ masks.put(ICustomAppearence.DISP_PARAMETER_TYPE, "Parameters Type");
+ masks.put(ICustomAppearence.DISP_RT_TYPE, "Return Type");
+ masks.put(ICustomAppearence.DISP_PARAMETER_MULTIPLICITY, "Parameters Multiplicity");
+ masks.put(ICustomAppearence.DISP_PARAMETER_DEFAULT, "Parameters Default Value");
+ masks.put(ICustomAppearence.DISP_DERIVE, "Parameters Value");
+ masks.put(ICustomAppearence.DISP_PARAMETER_MODIFIERS, "Parameters Modifiers");
+ masks.put(ICustomAppearence.DISP_MOFIFIERS, "Modifiers");
+
+ }
+
+ /**
+ * Returns the singleton instance of this class
+ *
+ * @return the singleton instance.
+ */
+ public static MessageLabelHelper getInstance() {
+ if(labelHelper == null) {
+ labelHelper = new MessageLabelHelper();
+ }
+ return labelHelper;
+ }
+
+ public Message getUMLElement(GraphicalEditPart editPart) {
+ EObject e = ((View)editPart.getModel()).getElement();
+ if(e instanceof Message)
+ return ((Message)e);
+ return null;
+ }
+
+ protected String elementLabel(GraphicalEditPart editPart) {
+ if(editPart instanceof LabelEditPart)
+ editPart = (GraphicalEditPart)editPart.getParent();
+
+ int displayValue = MessagePreferencePage.DEFAULT_LABEL_DISPLAY;
+
+ IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if(policy != null) {
+ displayValue = policy.getCurrentDisplayValue();
+ }
+ Message e = getUMLElement(editPart);
+ NamedElement signature = e.getSignature();
+
+ if(signature instanceof Operation) {
+ return OperationUtil.getCustomLabel(e, (Operation)signature, displayValue);
+ }else if(signature instanceof Signal) {
+ return SignalUtil.getCustomLabel(e, (Signal)signature, displayValue);
+ } else if(signature != null) {
+ return signature.getName();
+ }
+
+ return e.getName();
+ }
+
+ public String getMaskLabel(int value) {
+ return masks.get(value);
+ }
+
+ public Collection<String> getMaskLabels() {
+ return masks.values();
+ }
+
+ public Map<Integer, String> getMasks() {
+ return masks;
+ }
+
+ public Set<Integer> getMaskValues() {
+ return masks.keySet();
+ }
+ }
+
+ static public class SignalUtil {
+ private static String getCustomPropertyLabel(Message e, Property property, int style) {
+ StringBuffer buffer = new StringBuffer();
+ // visibility
+
+ buffer.append(" ");
+ if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ buffer.append(NamedElementUtil.getVisibilityAsSign(property));
+ }
+
+ // derived property
+ if((style & ICustomAppearence.DISP_DERIVE) != 0) {
+ if(property.isDerived()) {
+ buffer.append("/");
+ }
+ }
+
+ boolean showEqualMark = false;
+ // name
+ if((style & ICustomAppearence.DISP_PARAMETER_NAME) != 0) {
+ buffer.append(" ");
+ String name = trimToEmpty(property.getName());
+ if(name.trim().length() > 0)
+ showEqualMark = true;
+ buffer.append(name);
+ }
+
+ if((style & ICustomAppearence.DISP_PARAMETER_TYPE) != 0) {
+ // type
+ if(property.getType() != null) {
+ buffer.append(": " + trimToEmpty(property.getType().getName()));
+ } else {
+ buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
+ }
+ showEqualMark = true;
+ }
+
+ if((style & ICustomAppearence.DISP_MULTIPLICITY) != 0) {
+ // multiplicity -> do not display [1]
+ String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
+ buffer.append(multiplicity);
+ }
+
+ if((style & ICustomAppearence.DISP_DERIVE) != 0) {
+ String value = getValue(e, property);
+ if(value != null){
+ if(showEqualMark)
+ buffer.append(" = ");
+ buffer.append(value);
+ }
+ }else if((style & ICustomAppearence.DISP_PARAMETER_DEFAULT) != 0) {
+ // default value
+ if(property.getDefault() != null) {
+ if(showEqualMark)
+ buffer.append(" = ");
+ buffer.append(property.getDefault());
+ }
+ }
+
+ if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
+ boolean multiLine = ((style & ICustomAppearence.DISP_MULTI_LINE) != 0);
+ // property modifiers
+ String modifiers = PropertyUtil.getModifiersAsString(property, multiLine);
+ if(!modifiers.equals("")) {
+ if(multiLine) {
+ buffer.append("\n");
+ }
+
+ if (!buffer.toString().endsWith(" ")){
+ buffer.append(" ");
+ }
+
+ buffer.append(modifiers);
+ }
+ }
+ return buffer.toString();
+ }
+
+ private static String getValue(Message e, Property property) {
+ try {
+ Signal signal = (Signal)property.getOwner();
+ int index = signal.getOwnedAttributes().indexOf(property);
+ EList<ValueSpecification> arguments = e.getArguments();
+ if(arguments.size() > index){
+ return ValueSpecificationUtil.getSpecificationValue( arguments.get(index) );
+ }
+ } catch (Exception e1) {
+ }
+ return null;
+ }
+
+ /**
+ * return the custom label of the signal, given UML2 specification and a custom style.
+ * @param e
+ *
+ * @param style
+ * the integer representing the style of the label
+ *
+ * @return the string corresponding to the label of the signal
+ */
+ public static String getCustomLabel(Message e, Signal signal, int style) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(" "); // adds " " first for correct display considerations
+
+ // visibility
+ if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ buffer.append(NamedElementUtil.getVisibilityAsSign(signal));
+ }
+
+ // name
+ if((style & ICustomAppearence.DISP_NAME) != 0) {
+ buffer.append(" ");
+ buffer.append(trimToEmpty(signal.getName()));
+ }
+
+ //
+ // parameters : '(' parameter-list ')'
+ buffer.append("(");
+ buffer.append(getPropertiesAsString(e, signal, style));
+ buffer.append(")");
+
+ return buffer.toString();
+ }
+
+ /**
+ * Returns signal properties as a string, the label is customized using a bit mask
+ *
+ * @return a string containing all properties separated by commas
+ */
+ private static String getPropertiesAsString(Message e, Signal signal, int style) {
+ StringBuffer propertiesString = new StringBuffer();
+ boolean firstProperty = true;
+ for(Property property : signal.getOwnedAttributes()) {
+ // get the label for this property
+ String propertyString = getCustomPropertyLabel(e, property, style);
+ if(!propertyString.trim().equals("")) {
+ if(!firstProperty) {
+ propertiesString.append(", ");
+ }
+ propertiesString.append(propertyString);
+ firstProperty = false;
+ }
+ }
+ return propertiesString.toString();
+ }
+ }
+
+ static class OperationUtil {
+ public static String getCustomLabel(Message e, int paramIndex, Parameter parameter, int style) {
+ StringBuffer buffer = new StringBuffer();
+ // visibility
+ buffer.append(" ");
+ if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
+ }
+
+ // direction property
+ if((style & ICustomAppearence.DISP_PARAMETER_DIRECTION) != 0) {
+ buffer.append(" ");
+ buffer.append(parameter.getDirection().getLiteral());
+ }
+
+ boolean showEqualMark = false;
+ // name
+ if((style & ICustomAppearence.DISP_PARAMETER_NAME) != 0) {
+ buffer.append(" ");
+ String name = trimToEmpty(parameter.getName());
+ if(name.trim().length() > 0)
+ showEqualMark = true;
+ buffer.append(name);
+ }
+
+ if((style & ICustomAppearence.DISP_PARAMETER_TYPE) != 0) {
+ // type
+ if(parameter.getType() != null) {
+ buffer.append(": " + trimToEmpty(parameter.getType().getName()));
+ } else {
+ buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
+ }
+ showEqualMark = true;
+ }
+
+ if((style & ICustomAppearence.DISP_PARAMETER_MULTIPLICITY) != 0) {
+ // multiplicity -> do not display [1]
+ String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
+ buffer.append(multiplicity);
+ }
+
+ if((style & ICustomAppearence.DISP_DERIVE) != 0) {
+ String value = getValue(e, paramIndex, parameter);
+ if(value != null){
+ if(showEqualMark)
+ buffer.append(" = ");
+ buffer.append(value);
+ }
+ }else if((style & ICustomAppearence.DISP_PARAMETER_DEFAULT) != 0) {
+ // default value
+ if(parameter.getDefault() != null) {
+ if(showEqualMark)
+ buffer.append(" = ");
+ buffer.append(parameter.getDefault());
+ }
+ }
+
+ if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
+ boolean multiLine = ((style & ICustomAppearence.DISP_MULTI_LINE) != 0);
+ // property modifiers
+ String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine);
+ if(!modifiers.equals("")) {
+ if(multiLine) {
+ buffer.append("\n");
+ }
+ buffer.append(modifiers);
+ }
+ }
+ return buffer.toString();
+ }
+
+ private static String getValue(Message e, int paramIndex, Parameter parameter) {
+ try {
+ EList<ValueSpecification> arguments = e.getArguments();
+ if(arguments.size() > paramIndex){
+ return ValueSpecificationUtil.getSpecificationValue( arguments.get(paramIndex) );
+ }
+ } catch (Exception e1) {
+ }
+ return null;
+ }
+
+ public static String getCustomLabel(Message e, Operation operation, int style) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(" "); // adds " " first for correct display considerations
+
+ // visibility
+ if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ buffer.append(NamedElementUtil.getVisibilityAsSign(operation));
+ }
+
+ // name
+ if((style & ICustomAppearence.DISP_NAME) != 0) {
+ buffer.append(" ");
+ buffer.append(trimToEmpty(operation.getName()));
+ }
+
+ //
+ // parameters : '(' parameter-list ')'
+ buffer.append("(");
+ buffer.append(getParametersAsString(e, operation, style));
+ buffer.append(")");
+
+ // return type
+ if((style & ICustomAppearence.DISP_RT_TYPE) != 0) {
+ buffer.append(getReturnTypeAsString(operation, style));
+ }
+
+ // modifiers
+ if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
+ String modifiers = getModifiersAsString(operation);
+ if(!modifiers.equals("")) {
+ buffer.append("{");
+ buffer.append(modifiers);
+ buffer.append("}");
+ }
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Returns operation modifiers as string, separated with comma.
+ *
+ * @return a string containing the modifiers
+ */
+ private static String getModifiersAsString(Operation operation) {
+ StringBuffer buffer = new StringBuffer();
+ boolean needsComma = false;
+
+ // Return parameter modifiers
+ Parameter returnParameter = OperationUtil.getReturnParameter(operation);
+ if(returnParameter != null) {
+ // non unique parameter
+ if(!returnParameter.isUnique()) {
+ buffer.append("nonunique");
+ needsComma = true;
+ }
+
+ // return parameter has ordered values
+ if(returnParameter.isOrdered()) {
+ if(needsComma) {
+ buffer.append(", ");
+ }
+ buffer.append("ordered");
+ needsComma = true;
+ }
+ }
+
+ // is the operation a query ?
+ if(operation.isQuery()) {
+ if(needsComma) {
+ buffer.append(", ");
+ }
+ buffer.append("query");
+ needsComma = true;
+ }
+
+ // is the operation redefining another operation ?
+ Iterator<Operation> it = operation.getRedefinedOperations().iterator();
+ while(it.hasNext()) {
+ Operation currentOperation = it.next();
+ if(needsComma) {
+ buffer.append(", ");
+ }
+ buffer.append("redefines ");
+ buffer.append(currentOperation.getName());
+ needsComma = true;
+ }
+
+ // has the operation a constraint ?
+ Iterator<Constraint> it2 = operation.getOwnedRules().iterator();
+ while(it2.hasNext()) {
+ Constraint constraint = it2.next();
+ if(needsComma) {
+ buffer.append(", ");
+ }
+ if(constraint.getSpecification() != null) {
+ buffer.append(constraint.getSpecification().stringValue());
+ }
+ needsComma = true;
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ * Returns return parameter label as a string, string parametrized with a style mask.
+ *
+ * @param style
+ * the mask that indicates which element to display
+ * @return a string containing the return parameter type
+ */
+ private static String getReturnTypeAsString(Operation operation, int style) {
+ boolean displayType = ((style & ICustomAppearence.DISP_RT_TYPE) != 0);
+ boolean displayMultiplicity = ((style & ICustomAppearence.DISP_RT_MULTIPLICITY) != 0);
+ StringBuffer label = new StringBuffer("");
+
+ // Retrieve the return parameter (assume to be unique if defined)
+ Parameter returnParameter = getReturnParameter(operation);
+ // Create the string for the return type
+ if(returnParameter == null) {
+ // no-operation: label = ""
+
+ } else if(!displayType && !displayMultiplicity) {
+ // no-operation: label = ""
+
+ } else {
+ label.append(": ");
+ if(displayType) {
+ label.append(TypedElementUtil.getTypeAsString(returnParameter));
+ }
+
+ if(displayMultiplicity) {
+ label.append(MultiplicityElementUtil.getMultiplicityAsString(returnParameter));
+ }
+ }
+ return label.toString();
+ }
+
+ /**
+ * Gives the return parameter for this operation, or <code>null</code> if none exists.
+ *
+ * @return the return parameter of the operation or <code>null</code>
+ */
+ private static Parameter getReturnParameter(Operation operation) {
+ // Retrieve the return parameter (assume to be unique if defined)
+ Parameter returnParameter = null;
+
+ Iterator<Parameter> it = operation.getOwnedParameters().iterator();
+ while((returnParameter == null) && (it.hasNext())) {
+ Parameter parameter = it.next();
+ if(parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
+ returnParameter = parameter;
+ }
+ }
+ return returnParameter;
+ }
+
+ /**
+ * Returns operation parameters as a string, the label is customized using a bit mask
+ * @param e
+ *
+ * @return a string containing all parameters separated by commas
+ */
+ private static String getParametersAsString(Message e, Operation operation, int style) {
+ StringBuffer paramString = new StringBuffer();
+ Iterator<Parameter> paramIterator = operation.getOwnedParameters().iterator();
+ boolean firstParameter = true;
+ int paramIndex = 0;
+ while(paramIterator.hasNext()) {
+ Parameter parameter = paramIterator.next();
+ // Do not include return parameters
+ if(!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
+ // get the label for this parameter
+ String parameterString = getCustomLabel(e, paramIndex, parameter, style);
+ paramIndex ++;
+ if (!parameterString.trim().equals("")) {
+ if (!firstParameter) {
+ paramString.append(", ");
+ }
+ paramString.append(parameterString);
+ firstParameter = false;
+ }
+ }
+ }
+ return paramString.toString();
+ }
+ }
+
+ static String trimToEmpty(String str){
+ return str == null? "" : str;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java
new file mode 100644
index 00000000000..70dd691b1e6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java
@@ -0,0 +1,184 @@
+/*****************************************************************************
+ * 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 java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Polyline;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+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.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+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.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.internal.figures.LabelHelper;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.geometry.PointListUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * This class offers the same features as {@link NonResizableLabelEditPolicy}, except that move is privileged instead of drag and drop.
+ * It is useful for edit parts on messages.
+ */
+public class MoveableNonResizableLabelEditPolicy extends NonResizableEditPolicyEx {
+
+ @Override
+ protected List<?> createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ mh.setDragTracker(createSelectionHandleDragTracker());
+ return Collections.singletonList(mh);
+ }
+
+ private Polyline tether = null;
+
+ protected void eraseChangeBoundsFeedback(ChangeBoundsRequest request) {
+ super.eraseChangeBoundsFeedback(request);
+ if(tether != null)
+ removeFeedback(tether);
+ tether = null;
+ }
+
+ protected IFigure createDragSourceFeedbackFigure() {
+ IFigure feedback = super.createDragSourceFeedbackFigure();
+ tether = new Polyline();
+ tether.setLineStyle(Graphics.LINE_DASHDOT);
+ tether.setForegroundColor(((IGraphicalEditPart)getHost()).getFigure().getForegroundColor());
+ addFeedback(tether);
+ return feedback;
+ }
+
+ /**
+ * Calculates a point located at the middel of the parent connection
+ *
+ * @return the point
+ */
+ private Point getReferencePoint() {
+ if(getHost().getParent() instanceof AbstractConnectionEditPart) {
+ PointList ptList = ((Connection)((ConnectionEditPart)getHost().getParent()).getFigure()).getPoints();
+ Point refPoint = PointListUtilities.calculatePointRelativeToLine(ptList, 0, 50, true);
+ return refPoint;
+ } else if(getHost().getParent() instanceof GraphicalEditPart) {
+ return ((AbstractGraphicalEditPart)getHost().getParent()).getFigure().getBounds().getCenter();
+ }
+ return null;
+ }
+
+ protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
+ super.showChangeBoundsFeedback(request);
+
+ IFigure p = getDragSourceFeedbackFigure();
+ Rectangle r = p.getBounds();
+ Point refPoint = getReferencePoint();
+
+ // translate the feedback figure
+ PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ getHostFigure().translateToAbsolute(rect);
+ rect.translate(request.getMoveDelta());
+ rect.resize(request.getSizeDelta());
+ p.translateToRelative(rect);
+ p.setBounds(rect);
+
+ Rectangle centerMain = null;
+ // TODO: remove this hack. We should be using the reference point for
+ // the teher end, however,
+ // the reference point is causing miscaculation when positioning. This
+ // has to be redone in version 2.
+ if(((IGraphicalEditPart)getHost().getParent()).getFigure() instanceof Connection) {
+ centerMain = new Rectangle(refPoint.x, refPoint.y, 0, 0);
+ getHostFigure().translateToAbsolute(centerMain);
+ p.translateToRelative(centerMain);
+ } else {
+ centerMain = ((IGraphicalEditPart)getHost().getParent()).getFigure().getBounds().getCopy();
+ centerMain.translate(centerMain.width / 2, centerMain.height / 2);
+ getHostFigure().translateToAbsolute(centerMain);
+ p.translateToRelative(centerMain);
+ }
+
+ PrecisionRectangle ref = new PrecisionRectangle(centerMain);
+
+ Point midTop = new Point(r.x + r.width / 2, r.y);
+ Point midBottom = new Point(r.x + r.width / 2, r.y + r.height);
+ Point midLeft = new Point(r.x, r.y + r.height / 2);
+ Point midRight = new Point(r.x + r.width, r.y + r.height / 2);
+
+ Point startPoint = midTop;
+
+ int x = r.x + r.width / 2 - refPoint.x;
+ int y = r.y + r.height / 2 - refPoint.y;
+
+ if(y > 0 && y > x && y > -x)
+ startPoint = midTop;
+ else if(y < 0 && y < x && y < -x)
+ startPoint = midBottom;
+ else if(x < 0 && y > x && y < -x)
+ startPoint = midRight;
+ else
+ startPoint = midLeft;
+
+ tether.setStart(startPoint);
+ tether.setEnd(ref.getLocation());
+ }
+
+ protected Command getMoveCommand(ChangeBoundsRequest request) {
+ GraphicalEditPart editPart = (GraphicalEditPart)getHost();
+ Point refPoint = getReferencePoint();
+
+ // translate the feedback figure
+ PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
+ getHostFigure().translateToAbsolute(rect);
+ rect.translate(request.getMoveDelta());
+ rect.resize(request.getSizeDelta());
+ getHostFigure().translateToRelative(rect);
+
+ Point normalPoint = LabelHelper.offsetFromRelativeCoordinate(getHostFigure(), rect, refPoint);
+
+ ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), normalPoint);
+ return new ICommandProxy(moveCommand);
+ }
+
+ /**
+ * Overridden to use a customized drag tracker for the handles. The <code>isMove()</code> method of the drag tracker needs to be overridden
+ * as the parent of the label and connection will not be the same as the
+ * target editpart, instead it returns true always since labels can only be
+ * moved and not resized.
+ *
+ * @return a drag tracker
+ */
+ protected DragTracker createSelectionHandleDragTracker() {
+ return new DragEditPartsTrackerEx(getHost()) {
+
+ protected boolean isMove() {
+ return true;
+ }
+ };
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java
new file mode 100644
index 00000000000..f5cd849fe7b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java
@@ -0,0 +1,728 @@
+package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.emf.common.util.EList;
+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.editpolicies.FeedbackHelper;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.DropRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+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.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.gmf.runtime.notation.impl.ConnectorImpl;
+import org.eclipse.papyrus.uml.diagram.sequence.ObservationLinkMetamodelType;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ObservationLinkEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.MessageSort;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.TimeObservation;
+
+/**
+ * This policy is to process observation link creating, reconnecting
+ *
+ */
+public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
+ private final EditPart editPart;
+
+ public ObservationLinkPolicy(EditPart editPart) {
+ this.editPart = editPart;
+ }
+
+ public Command getCommand(Request request) {
+ if(request instanceof CreateUnspecifiedTypeConnectionRequest){
+ if(((CreateUnspecifiedTypeConnectionRequest) request).getElementTypes().contains(ObservationLinkMetamodelType.getInstance())){
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_START.equals(request.getType()))
+ return getConnectionCreateCommand((CreateConnectionRequest) request);
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_END.equals(request.getType()))
+ return getConnectionCompleteCommand((CreateConnectionRequest) request);
+ }
+ return null;
+ }
+ if(request instanceof CreateConnectionRequest){
+ CreateConnectionRequest cc = (CreateConnectionRequest) request;
+ if(cc.getNewObject()!=null){
+ if(cc.getNewObject() instanceof ObservationLink){
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_START.equals(request.getType()))
+ return getConnectionCreateCommand((CreateConnectionRequest) request);
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_END.equals(request.getType()))
+ return getConnectionCompleteCommand((CreateConnectionRequest) request);
+ }
+ }
+ return null;
+ }
+ if(request instanceof ReconnectRequest){
+ ReconnectRequest rr = (ReconnectRequest) request;
+ if(rr.getConnectionEditPart() instanceof ObservationLinkEditPart){
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_SOURCE.equals(request.getType()))
+ return getReconnectSourceCommand((ReconnectRequest) request);
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_TARGET.equals(request.getType()))
+ return getReconnectTargetCommand((ReconnectRequest) request);
+ }
+
+ }
+
+ return null;
+ }
+
+ public EditPart getTargetEditPart(Request request) {
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_START.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_END.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_SOURCE.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_TARGET.equals(request.getType())){
+ if (request instanceof CreateConnectionRequest) {
+ if (((CreateConnectionRequest) request).getSourceEditPart() instanceof TimeObservationLabelEditPart) {
+ if (getHost() instanceof AbstractMessageEditPart) {
+ return null;
+ }
+ }
+ }
+ if(SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_TARGET.equals(request.getType())){
+ if (request instanceof ReconnectRequest) {
+ if (((ReconnectRequest) request).getConnectionEditPart().getSource() instanceof TimeObservationLabelEditPart) {
+ if (getHost() instanceof AbstractMessageEditPart) {
+ return null;
+ }
+ }
+ }
+ }
+ return getHost();
+ }
+ return null;
+ }
+
+ @Override
+ protected Command getConnectionCreateCommand(
+ CreateConnectionRequest request) {
+ EditPart host = getHost();
+ if(host instanceof TimeObservationLabelEditPart){
+ TimeObservationLabelEditPart timeObservationLabelEditPart = (TimeObservationLabelEditPart)host;
+ if(timeObservationLabelEditPart.getSourceConnections().size()>0){
+ return null;
+ }
+ }else if(host instanceof DurationObservationEditPart){
+ DurationObservationEditPart durationObservationEditPart = (DurationObservationEditPart)host;
+ if(durationObservationEditPart.getSourceConnections().size()>0){
+ return null;
+ }
+ }else{
+ return null;
+ }
+
+ CompositeCommand cc = new CompositeCommand(
+ DiagramUIMessages.Commands_CreateCommand_Connection_Label);
+
+ CreateObservationLinkCommand cmd = new CreateObservationLinkCommand(((GraphicalEditPart) editPart).getEditingDomain(), "Create connection command", null);
+
+ cmd.setSourceEditPart(host);
+ cmd.setRequest(request);
+
+ cc.compose(cmd);
+ Command c = new ICommandProxy(cc);
+ request.setStartCommand(c);
+ return c;
+ }
+
+ @Override
+ protected Command getConnectionCompleteCommand(
+ final CreateConnectionRequest request) {
+ EditPart sourceEditPart = request.getSourceEditPart();
+
+ if((sourceEditPart instanceof TimeObservationLabelEditPart)&&!(getHost() instanceof LifelineEditPart)){
+ return null;
+ }else if(sourceEditPart instanceof DurationObservationEditPart&&!(getHost() instanceof AbstractMessageEditPart)){
+ return null;
+ }
+
+ ICommandProxy proxy = (ICommandProxy) request
+ .getStartCommand();
+ if (proxy == null) {
+ return null;
+ }
+
+ CompositeCommand result = new CompositeCommand("Add observation link command");
+
+ if(sourceEditPart instanceof TimeObservationLabelEditPart){
+ result.add(new UpdateTimeObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request,getHost()));
+ }else if(sourceEditPart instanceof DurationObservationEditPart){
+ result.add(new UpdateDurationObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request,getHost()));
+ }
+
+ //1:
+ CompositeCommand cc = (CompositeCommand) proxy.getICommand();
+ Iterator commandItr = cc.iterator();
+ CreateObservationLinkCommand createConnectorViewCommand = (CreateObservationLinkCommand) commandItr.next();
+ createConnectorViewCommand.setSourceEditPart(request.getSourceEditPart());
+ createConnectorViewCommand.setTargetEditPart(request.getTargetEditPart());
+
+ result.add(cc);
+ return new ICommandProxy(result);
+ }
+
+ @Override
+ protected Command getReconnectSourceCommand(final ReconnectRequest request) {
+ Command reconnectSourceCommand = super
+ .getReconnectSourceCommand(request);
+ ICommandProxy proxy = (ICommandProxy) reconnectSourceCommand;
+ CompositeCommand cc = (CompositeCommand) proxy.getICommand();
+
+ // update semantic model
+ if(request.getConnectionEditPart().getSource() instanceof TimeObservationLabelEditPart && getHost() instanceof TimeObservationLabelEditPart){
+ TimeObservationLabelEditPart timeObservationLabelEditPart = (TimeObservationLabelEditPart)getHost();
+ if(timeObservationLabelEditPart.getSourceConnections().size()>0){
+ return null;
+ }
+ cc.add(new UpdateTimeObservationLinkSourceElementCommand(
+ ((IGraphicalEditPart) getHost()).getEditingDomain(),
+ "Update semantic model", null, request, getHost()));
+ }else if(request.getConnectionEditPart().getSource() instanceof DurationObservationEditPart && getHost() instanceof DurationObservationEditPart){
+ DurationObservationEditPart durationObservationEditPart = (DurationObservationEditPart)getHost();
+ if(durationObservationEditPart.getSourceConnections().size()>0){
+ return null;
+ }
+ cc.add(new UpdateDurationObservationLinkSourceElementCommand(
+ ((IGraphicalEditPart) getHost()).getEditingDomain(),
+ "Update semantic model", null, request, getHost()));
+ }
+
+ return reconnectSourceCommand;
+ }
+
+ @Override
+ protected Command getReconnectTargetCommand(final ReconnectRequest request) {
+ Command reconnectTargetCommand = super
+ .getReconnectTargetCommand(request);
+ ICommandProxy proxy = (ICommandProxy) reconnectTargetCommand;
+ CompositeCommand cc = (CompositeCommand) proxy.getICommand();
+
+ // update semantic model
+ if(request.getConnectionEditPart().getSource() instanceof TimeObservationLabelEditPart){
+ cc.add(new UpdateTimeObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request,getHost()));
+ }else if(request.getConnectionEditPart().getSource() instanceof DurationObservationEditPart){
+ cc.add(new UpdateDurationObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request,getHost()));
+ }
+
+ return proxy;
+ }
+
+ @Override
+ public void showSourceFeedback(Request request) {
+ if ((SequenceUtil.OBSERVATION_LINK_REQUEST_END).equals(request.getType()))
+ showCreationFeedback((CreateConnectionRequest) request);
+ }
+
+ protected FeedbackHelper getFeedbackHelper(CreateConnectionRequest request) {
+ if (feedbackHelper == null) {
+ feedbackHelper = new FeedbackHelper();
+ Point p = request.getLocation();
+ connectionFeedback = createDummyConnection(request);
+ connectionFeedback
+ .setConnectionRouter(getDummyConnectionRouter(request));
+ connectionFeedback
+ .setSourceAnchor(getSourceConnectionAnchor(request));
+ connectionFeedback.setForegroundColor(ColorConstants.black);
+ feedbackHelper.setConnection(connectionFeedback);
+ addFeedback(connectionFeedback);
+ feedbackHelper.update(null, p);
+ }
+ return feedbackHelper;
+ }
+
+ @Override
+ public void showTargetFeedback(Request request) {
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_START.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_END.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_SOURCE.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_TARGET.equals(request.getType()))
+ showTargetConnectionFeedback((DropRequest) request);
+ }
+
+ @Override
+ public void eraseSourceFeedback(Request request) {
+ if ( SequenceUtil.OBSERVATION_LINK_REQUEST_END.equals(request.getType()))
+ eraseCreationFeedback((CreateConnectionRequest) request);
+ }
+
+ @Override
+ public void eraseTargetFeedback(Request request) {
+ if (SequenceUtil.OBSERVATION_LINK_REQUEST_START.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_END.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_SOURCE.equals(request.getType())
+ || SequenceUtil.OBSERVATION_LINK_REQUEST_RECONNECT_TARGET.equals(request.getType()))
+ eraseTargetConnectionFeedback((DropRequest) request);
+ }
+
+ private class UpdateDurationObservationLinkSourceElementCommand extends
+ AbstractTransactionalCommand {
+ private final ReconnectRequest request;
+ private EditPart hostPart;
+ private DurationObservationEditPart sourceTolEP;
+
+ List<OccurrenceSpecification> occList = Collections.emptyList();
+
+ public UpdateDurationObservationLinkSourceElementCommand(
+ TransactionalEditingDomain domain, String label,
+ List affectedFiles, ReconnectRequest request, EditPart hostPart) {
+ super(domain, label, affectedFiles);
+ this.request = request;
+ sourceTolEP = (DurationObservationEditPart) request
+ .getConnectionEditPart().getSource();
+ this.hostPart = hostPart;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ if (sourceTolEP == hostPart) {
+ return CommandResult.newCancelledCommandResult();
+ }
+
+ View sourceView = (View) sourceTolEP.getModel();
+ DurationObservation sourceDurationObservation = (DurationObservation) sourceView
+ .getElement();
+
+ DurationObservationEditPart targetDoEP = (DurationObservationEditPart) hostPart;
+ View targetView = (View) targetDoEP.getModel();
+ DurationObservation targetDurationObservation = (DurationObservation) targetView
+ .getElement();
+ targetDurationObservation.getEvents().addAll(
+ sourceDurationObservation.getEvents());
+
+ sourceDurationObservation.getEvents().clear();
+ return CommandResult.newOKCommandResult();
+ }
+
+ @Override
+ public boolean canExecute() {
+ if (hostPart instanceof DurationObservationEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ }
+
+ public class UpdateDurationObservationLinkTargetElementCommand extends
+ AbstractTransactionalCommand {
+ private final Request request;
+ private EditPart hostPart;
+
+ public UpdateDurationObservationLinkTargetElementCommand(
+ TransactionalEditingDomain domain, String label,
+ List affectedFiles, Request request, EditPart hostPart) {
+ super(domain, label, affectedFiles);
+ this.request = request;
+ this.hostPart = hostPart;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ DurationObservationEditPart doEP = null;
+ if (request instanceof CreateConnectionRequest) {
+ doEP = (DurationObservationEditPart) (((CreateConnectionRequest) request).getSourceEditPart());
+ } else if (request instanceof ReconnectRequest) {
+ doEP = (DurationObservationEditPart) (((ReconnectRequest) request).getConnectionEditPart().getSource());
+ }
+ View view = (View) doEP.getModel();
+ DurationObservation durationObservation = (DurationObservation) view.getElement();
+ EList<NamedElement> events = durationObservation.getEvents();
+ // if is reconnect operation, first remove orginal message event of DurationObservation
+ if (request instanceof ReconnectRequest) {
+ events.clear();
+ }
+ Map<String, Object> extendedData = request.getExtendedData();
+ // assign the occurrence specification
+ Object paramOcc1 = extendedData
+ .get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION);
+ Object paramOcc2 = extendedData
+ .get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2);
+ if (paramOcc1 != null && paramOcc2 != null) {
+ events.add((OccurrenceSpecification) paramOcc1);
+ events.add((OccurrenceSpecification) paramOcc2);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ @Override
+ public boolean canExecute() {
+ if (hostPart instanceof ConnectionNodeEditPart) {
+ Map<String, Object> extendedData = request.getExtendedData();
+
+ if (hostPart instanceof AbstractMessageEditPart) {
+ AbstractMessageEditPart messageEP = (AbstractMessageEditPart) hostPart;
+ View view = (View) messageEP.getModel();
+ Message message = (Message) view.getElement();
+
+ if (message.getSendEvent() != null)
+ extendedData
+ .put(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION,
+ message.getSendEvent());
+ if (message.getReceiveEvent() != null)
+ extendedData
+ .put(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2,
+ message.getReceiveEvent());
+ }
+
+ if (extendedData
+ .containsKey(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION)
+ && extendedData
+ .containsKey(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ }
+
+ private class UpdateTimeObservationLinkSourceElementCommand extends
+ AbstractTransactionalCommand {
+ private final ReconnectRequest request;
+ private EditPart hostPart;
+ private TimeObservationLabelEditPart sourceTolEP;
+
+ List<OccurrenceSpecification> occList = Collections.emptyList();
+
+ public UpdateTimeObservationLinkSourceElementCommand(
+ TransactionalEditingDomain domain, String label,
+ List affectedFiles, ReconnectRequest request, EditPart hostPart) {
+ super(domain, label, affectedFiles);
+ this.request = request;
+ sourceTolEP = (TimeObservationLabelEditPart) request
+ .getConnectionEditPart().getSource();
+ this.hostPart = hostPart;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ if (sourceTolEP == hostPart) {
+ return CommandResult.newCancelledCommandResult();
+ }
+
+ View sourceView = (View) sourceTolEP.getModel();
+ TimeObservation sourceTimeObservation = (TimeObservation) sourceView
+ .getElement();
+
+ TimeObservationLabelEditPart targetTolEP = (TimeObservationLabelEditPart) hostPart;
+ View targetView = (View) targetTolEP.getModel();
+ TimeObservation targetTimeObservation = (TimeObservation) targetView
+ .getElement();
+ targetTimeObservation.setEvent(sourceTimeObservation.getEvent());
+
+ sourceTimeObservation.setEvent(null);
+ return CommandResult.newOKCommandResult();
+ }
+
+ @Override
+ public boolean canExecute() {
+ if (hostPart instanceof TimeObservationLabelEditPart) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private class UpdateTimeObservationLinkTargetElementCommand extends
+ AbstractTransactionalCommand {
+ private final Request request;
+ private EditPart hostPart;
+
+ List<OccurrenceSpecification> occList = Collections.emptyList();
+
+ public UpdateTimeObservationLinkTargetElementCommand(
+ TransactionalEditingDomain domain, String label,
+ List affectedFiles, Request request, EditPart hostPart) {
+ super(domain, label, affectedFiles);
+ this.request = request;
+ this.hostPart = hostPart;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ TimeObservationLabelEditPart tolEP = null;
+ if (request instanceof CreateConnectionRequest) {
+ tolEP = (TimeObservationLabelEditPart) (((CreateConnectionRequest) request)
+ .getSourceEditPart());
+ } else if (request instanceof ReconnectRequest) {
+ tolEP = (TimeObservationLabelEditPart) (((ReconnectRequest) request)
+ .getConnectionEditPart().getSource());
+ }
+ View view = (View) tolEP.getModel();
+ TimeObservation timeObservation = (TimeObservation) view
+ .getElement();
+
+ // assign the occurrence specification
+ if (!occList.isEmpty()) {
+ for (OccurrenceSpecification occurrence : occList) {
+ if (occurrence instanceof MessageOccurrenceSpecification) {
+ Message mess = ((MessageOccurrenceSpecification) occurrence)
+ .getMessage();
+ if (mess.getReceiveEvent().equals(occurrence)
+ && MessageSort.SYNCH_CALL_LITERAL.equals(mess
+ .getMessageSort())) {
+ // filter receive event, we prefer the corresponding
+ // start event at the same location
+ continue;
+ }
+ }
+ // otherwise, first occ is just fine
+ timeObservation.setEvent(occurrence);
+ break;
+ }
+ }
+
+ // reset request vertical location
+ if (timeObservation.getEvent() instanceof MessageOccurrenceSpecification) {
+ Point messageOccurrenceLoc = SequenceUtil
+ .findLocationOfMessageOccurrence(
+ (GraphicalEditPart) hostPart,
+ (MessageOccurrenceSpecification) timeObservation
+ .getEvent());
+ setRequestLocation(messageOccurrenceLoc);
+ } else if (timeObservation.getEvent() instanceof ExecutionOccurrenceSpecification) {
+ Point executionOccurrenceLoc = SequenceUtil
+ .findLocationOfExecutionOccurrence(
+ (GraphicalEditPart) hostPart,
+ (ExecutionOccurrenceSpecification) timeObservation
+ .getEvent());
+ setRequestLocation(executionOccurrenceLoc);
+ }
+
+ return CommandResult.newOKCommandResult();
+ }
+
+ private void setRequestLocation(Point occurrenceLoc) {
+ if(occurrenceLoc == null)
+ return;
+
+ if (request instanceof CreateConnectionRequest) {
+ CreateConnectionRequest req = (CreateConnectionRequest) request;
+ req.setLocation(new Point(req.getLocation().x,
+ occurrenceLoc.y));
+ } else if (request instanceof ReconnectRequest) {
+ ReconnectRequest req = (ReconnectRequest) request;
+ req.setLocation(new Point(req.getLocation().x,
+ occurrenceLoc.y));
+ }
+ }
+
+ @Override
+ public boolean canExecute() {
+ if (hostPart instanceof LifelineEditPart) {
+ Point location = null;
+ if (request instanceof CreateConnectionRequest) {
+ location = ((CreateConnectionRequest) request)
+ .getLocation();
+ } else if (request instanceof ReconnectRequest) {
+ location = ((ReconnectRequest) request).getLocation();
+ }
+
+ Entry<Point, List<OccurrenceSpecification>> eventAndLocation = SequenceUtil
+ .findNearestEvent(location, (LifelineEditPart) hostPart);
+ // find an event near enough to create the
+ // constraint or observation
+ occList = Collections.emptyList();
+ if (eventAndLocation != null) {
+ occList = eventAndLocation.getValue();
+ }
+ if (!occList.isEmpty()) {
+ for (OccurrenceSpecification occurrence : occList) {
+ if (occurrence instanceof MessageOccurrenceSpecification) {
+ Message mess = ((MessageOccurrenceSpecification) occurrence)
+ .getMessage();
+ if (mess.getReceiveEvent().equals(occurrence)
+ && MessageSort.SYNCH_CALL_LITERAL
+ .equals(mess.getMessageSort())) {
+ // filter receive event, we prefer the
+ // corresponding
+ // start event at the same location
+ continue;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+
+ private class CreateObservationLinkCommand extends AbstractTransactionalCommand {
+
+ private EditPart sourceEditPart;
+ private EditPart targetEditPart;
+
+ private CreateConnectionRequest request;
+ private ObservationLink c;
+ private String newSourceTerminal;
+
+ public CreateObservationLinkCommand(TransactionalEditingDomain domain,
+ String label, List affectedFiles) {
+ super(domain, label, affectedFiles);
+ }
+
+ public void setSourceEditPart(EditPart sourceEditPart) {
+ this.sourceEditPart = sourceEditPart;
+ }
+
+ public void setTargetEditPart(EditPart targetEditPart) {
+ this.targetEditPart = targetEditPart;
+ }
+
+ public void setRequest(CreateConnectionRequest request) {
+ this.request = request;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ c = new ObservationLink();
+ c.setType(SequenceUtil.OBSERVATION_LINK_TYPE);
+ c.setElement(null);
+
+ View newSourceView = (View) sourceEditPart.getModel();
+ c.setSource(newSourceView);
+
+ ViewUtil.insertChildView(newSourceView.getDiagram(), c, -1, true);
+
+ INodeEditPart ce = (INodeEditPart) sourceEditPart;
+ ConnectionAnchor sourceAnchor = ce.getSourceConnectionAnchor(request);
+ newSourceTerminal = ce.mapConnectionAnchorToTerminal(sourceAnchor);
+ if (newSourceTerminal != null) {
+ if (newSourceTerminal.length() == 0)
+ c.setSourceAnchor(null);
+ else {
+ IdentityAnchor a = (IdentityAnchor) c.getSourceAnchor();
+ if (a == null)
+ a = NotationFactory.eINSTANCE.createIdentityAnchor();
+ a.setId(newSourceTerminal);
+ c.setSourceAnchor(a);
+ }
+ }
+
+ initCompleteCommand();
+
+ return CommandResult.newOKCommandResult();
+ }
+
+ private void initCompleteCommand() {
+ // reset the target edit-part for the request
+ if (targetEditPart != null) {
+ View newTargetView = ((IGraphicalEditPart) targetEditPart)
+ .getNotationView();
+ c.setTarget(newTargetView);
+ // 3:
+ INodeEditPart ce = (INodeEditPart) targetEditPart;
+
+ ConnectionAnchor targetAnchor = null;
+ if(ce instanceof LifelineEditPart){
+ LifelineEditPart lifelinePart = (LifelineEditPart)ce;
+ targetAnchor = lifelinePart.getNodeFigure().getTargetConnectionAnchorAt(request.getLocation());
+ }else{
+ targetAnchor = ce
+ .getTargetConnectionAnchor(request);
+ }
+
+ String newTargetTerminal = ce
+ .mapConnectionAnchorToTerminal(targetAnchor);
+ if (newTargetTerminal != null) {
+ if (newTargetTerminal.length() == 0)
+ c.setTargetAnchor(null);
+ else {
+ IdentityAnchor a = (IdentityAnchor) c.getTargetAnchor();
+ if (a == null)
+ a = NotationFactory.eINSTANCE.createIdentityAnchor();
+ a.setId(newTargetTerminal);
+ c.setTargetAnchor(a);
+ }
+ }
+ // 4:
+ INodeEditPart sourceEditPart = (INodeEditPart) request
+ .getSourceEditPart();
+ ConnectionAnchor sourceAnchor = sourceEditPart
+ .mapTerminalToConnectionAnchor(newSourceTerminal);
+ PointList pointList = new PointList();
+ if (request.getLocation() == null) {
+ pointList.addPoint(sourceAnchor.getLocation(targetAnchor
+ .getReferencePoint()));
+ pointList.addPoint(targetAnchor.getLocation(sourceAnchor
+ .getReferencePoint()));
+ } else {
+ pointList.addPoint(sourceAnchor.getLocation(request
+ .getLocation()));
+ pointList.addPoint(targetAnchor.getLocation(request
+ .getLocation()));
+ }
+ List newBendpoints = new ArrayList();
+ int numOfPoints = pointList.size();
+ for (short i = 0; i < numOfPoints; i++) {
+ Dimension s = pointList.getPoint(i).getDifference(
+ sourceAnchor.getReferencePoint());
+ Dimension t = pointList.getPoint(i).getDifference(
+ targetAnchor.getReferencePoint());
+ newBendpoints.add(new RelativeBendpoint(s.width, s.height,
+ t.width, t.height));
+ }
+
+ RelativeBendpoints bendpoints = NotationFactory.eINSTANCE
+ .createRelativeBendpoints();
+ bendpoints.setPoints(newBendpoints);
+ c.setBendpoints(bendpoints);
+
+ }
+
+ }
+
+ }
+
+ public static class ObservationLink extends ConnectorImpl {
+ public ObservationLink() {
+ super();
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/RemoveOrphanViewPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/RemoveOrphanViewPolicy.java
new file mode 100644
index 00000000000..981e3c2e9ce
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/RemoveOrphanViewPolicy.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * 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.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineNameEditPart;
+
+/**
+ * this policy is used to suppress orphan node view in GMF view the policy to remove orphan
+ * connection is more complex. It is dependent of the diagram. see remove OrphanConnectionView
+ * policy
+ *
+ */
+public class RemoveOrphanViewPolicy extends OrphanViewPolicy {
+
+ public int[] notOrphanNode = { LifelineNameEditPart.VISUAL_ID };
+
+ public RemoveOrphanViewPolicy() {
+ super();
+ init(notOrphanNode);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java
new file mode 100644
index 00000000000..c0a156820f7
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java
@@ -0,0 +1,517 @@
+/*****************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Polyline;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message3EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message5EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message6EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message7EditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
+import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineMessageCreateHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+
+/**
+ * A specific policy to handle the message :
+ * - Message cannot be uphill.
+ * - Message Occurrence Specification which are created along the message may have a different container than the message.
+ * - Message feedback on creation is always drawn in black (to avoid invisible feedback)
+ *
+ */
+@SuppressWarnings({ "restriction", "unchecked", "rawtypes" })
+public class SequenceGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
+
+ /** A static margin to allow drawing of straight message */
+ private static final int MARGIN = 2;
+
+ /**
+ * Gets the command to start the creation of a new connection and relationship. This will update the request appropriately. Also completes the
+ * request with nearby occurrence specification information.
+ *
+ * @param request
+ * creation request
+ * @return Command
+ */
+ @Override
+ protected Command getConnectionAndRelationshipCreateCommand(CreateConnectionViewAndElementRequest request) {
+ Map<String, Object> extendedData = request.getExtendedData();
+
+ // record the nearest event if necessary
+ String requestHint = request.getConnectionViewAndElementDescriptor().getSemanticHint();
+ if(isCreatedNearOccurrenceSpecification(requestHint)) {
+ LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(getHost());
+ if(lifelinePart != null) {
+ Entry<Point, List<OccurrenceSpecification>> eventAndLocation = SequenceUtil.findNearestEvent(request.getLocation(), lifelinePart);
+ // 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();
+ }
+ extendedData.put(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION, events);
+ extendedData.put(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION, location);
+ if(location != null) {
+ request.setLocation(location);
+ }
+ }
+ }
+ return super.getConnectionAndRelationshipCreateCommand(request);
+ }
+
+ /**
+ * Gets the command to complete the creation of a new connection and relationship. Also completes the request with nearby occurrence specification
+ * information.
+ *
+ * @param request
+ * the creation request
+ * @return Command
+ */
+ @Override
+ protected Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request) {
+ Map<String, Object> extendedData = request.getExtendedData();
+
+ // record the nearest event if necessary
+ String requestHint = request.getConnectionViewAndElementDescriptor().getSemanticHint();
+ if(isCreatedNearOccurrenceSpecification(requestHint)) {
+ LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(getHost());
+ if(lifelinePart != null) {
+ Entry<Point, List<OccurrenceSpecification>> eventAndLocation = SequenceUtil.findNearestEvent(request.getLocation(), lifelinePart);
+ // 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();
+ }
+ extendedData.put(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2, events);
+ extendedData.put(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION_2, location);
+ if(location != null) {
+ request.setLocation(location);
+ }
+ }
+ }
+ return super.getConnectionAndRelationshipCompleteCommand(request);
+ }
+
+ /**
+ * Return true if creation must be performed to or from an occurrence specification
+ *
+ * @param requestHint
+ * the hint of object to create
+ * @return true if creation to or from an occurrence specification
+ */
+ private boolean isCreatedNearOccurrenceSpecification(String requestHint) {
+ String generalOrderingHint = ((IHintedType)UMLElementTypes.GeneralOrdering_4012).getSemanticHint();
+ return generalOrderingHint.equals(requestHint);
+ }
+
+ /**
+ * Return true if a message is being created
+ *
+ * @param requestHint
+ * the hint of object to create
+ * @return true if creation of a message
+ */
+ private boolean isMessageHint(String requestHint) {
+ List<String> messageHints = new ArrayList<String>(7);
+ String messageHint = ((IHintedType)UMLElementTypes.Message_4003).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4004).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4005).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4006).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4007).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4008).getSemanticHint();
+ messageHints.add(messageHint);
+ messageHint = ((IHintedType)UMLElementTypes.Message_4009).getSemanticHint();
+ messageHints.add(messageHint);
+ return messageHints.contains(requestHint);
+ }
+
+ @Override
+ protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ // move source point to the bottom if it is contained in LifelineNameContainerFigure
+ EditPart targetEditPart = request.getTargetEditPart();
+ if (targetEditPart != null
+ && targetEditPart instanceof LifelineEditPart) {
+ LifelineEditPart target = (LifelineEditPart) targetEditPart;
+ if (target.getPrimaryShape() != null) {
+ Rectangle sourceBounds = target.getPrimaryShape()
+ .getFigureLifelineNameContainerFigure().getBounds()
+ .getCopy();
+ Point sourcePointCopy = request.getLocation().getCopy();
+ target.getFigure().translateToRelative(sourcePointCopy);
+ if (sourcePointCopy.y() < sourceBounds.getBottom().y()) {
+ target.getFigure().translateToAbsolute(sourceBounds);
+ request.getLocation()
+ .setY(sourceBounds.getBottom().y()+1);
+ }
+ }
+
+ }
+
+ request.getExtendedData().put(
+ SequenceRequestConstant.SOURCE_LOCATION_DATA,
+ request.getLocation());
+
+ return super.getConnectionCreateCommand(request);
+ }
+
+ /**
+ * Overrides to disable uphill message
+ */
+ @Override
+ protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+ Command command = super.getConnectionCompleteCommand(request);
+ if(command == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // disable the following code if we are not creating a message.
+ String requestHint = null;
+ if(request instanceof CreateConnectionViewRequest) {
+ requestHint = ((CreateConnectionViewRequest)request).getConnectionViewDescriptor().getSemanticHint();
+ if(!isMessageHint(requestHint)) {
+ return command;
+ }
+ }
+ // ICommandProxy proxy = (ICommandProxy)request.getStartCommand();
+ // CompositeCommand cc = (CompositeCommand)proxy.getICommand();
+ // Iterator<?> commandItr = cc.iterator();
+ // while(commandItr.hasNext()) {
+ // Object obj = commandItr.next();
+ // if(obj instanceof SetConnectionBendpointsCommand) {
+ // SetConnectionBendpointsCommand sbbCommand = (SetConnectionBendpointsCommand)obj;
+ //final PointList pointList = sbbCommand.getNewPointList();
+
+ Point sourcePoint = (Point)request.getExtendedData().get(SequenceRequestConstant.SOURCE_LOCATION_DATA);
+ Point targetPoint = request.getLocation();
+
+ // prevent uphill message (leave margin for horizontal messages)
+ boolean messageCreate =((IHintedType)UMLElementTypes.Message_4006).getSemanticHint().equals(requestHint);
+ if(sourcePoint == null || sourcePoint.y >= targetPoint.y + MARGIN) {
+ if(!messageCreate && !isLostFoundMessage(requestHint))
+ return UnexecutableCommand.INSTANCE;
+ }
+ // prevent uphill message (for self recursive message)
+ if(request.getSourceEditPart().equals(request.getTargetEditPart()) && sourcePoint.y >= targetPoint.y) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // prevent uphill message (for reply message)
+ if(request instanceof CreateConnectionViewAndElementRequest) {
+ ConnectionViewAndElementDescriptor desc = ((CreateConnectionViewAndElementRequest)request).getConnectionViewAndElementDescriptor();
+ String replyHint = ((IHintedType)UMLElementTypes.Message_4005).getSemanticHint();
+ if(replyHint.equals(desc.getSemanticHint()) && request.getSourceEditPart() instanceof IGraphicalEditPart) {
+ Rectangle srcBounds = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart)request.getSourceEditPart());
+ int bottom = srcBounds.getBottom().y;
+ if(bottom >= targetPoint.y + MARGIN) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ }
+
+ // prevent duplicate create link
+ if( messageCreate && request.getSourceEditPart() != null && request.getTargetEditPart() != null){
+ if(LifelineMessageCreateHelper.hasMessageCreate((GraphicalEditPart)request.getSourceEditPart(), request.getTargetEditPart()))
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ request.getExtendedData().put(SequenceRequestConstant.SOURCE_MODEL_CONTAINER, SequenceUtil.findInteractionFragmentContainerAt(sourcePoint, getHost()));
+ request.getExtendedData().put(SequenceRequestConstant.TARGET_MODEL_CONTAINER, SequenceUtil.findInteractionFragmentContainerAt(targetPoint, getHost()));
+ // In case we are creating a connection to/from a CoRegion, we will need the lifeline element where is drawn the CoRegion later in the process.
+ EditPart targetEditPart = getTargetEditPart(request);
+ if(targetEditPart instanceof CombinedFragment2EditPart) {
+ request.getExtendedData().put(SequenceRequestConstant.LIFELINE_GRAPHICAL_CONTAINER, ((CombinedFragment2EditPart)targetEditPart).getAttachedLifeline());
+ }
+
+ // change constraint of the target lifeline after added a Create Message
+ if (request.getTargetEditPart() instanceof LifelineEditPart
+ && !(request.getSourceEditPart().equals(request
+ .getTargetEditPart()))) {
+ if (requestHint.equals((((IHintedType) UMLElementTypes.Message_4006).getSemanticHint()))) {
+ LifelineEditPart target = (LifelineEditPart) request
+ .getTargetEditPart();
+ command = LifelineMessageCreateHelper.moveLifelineDown(command, target, sourcePoint.getCopy());
+ }
+ }
+
+ return command;
+ }
+
+ /**
+ * Override to disable uphill message
+ */
+ @Override
+ protected Command getReconnectSourceCommand(ReconnectRequest request) {
+ if(isUphillMessage(request) && !isLostFoundMessage(request)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // prevent duplicate link
+ if(request.getConnectionEditPart() instanceof Message4EditPart && request.getTarget() != null && !LifelineMessageCreateHelper.canReconnectMessageCreate(request)){
+ return UnexecutableCommand.INSTANCE;
+ }
+ return super.getReconnectSourceCommand(request);
+ }
+
+ private boolean isLostFoundMessage(ReconnectRequest request) {
+ ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
+ if(connectionEditPart instanceof Message7EditPart || connectionEditPart instanceof Message6EditPart )
+ return true;
+ return false;
+ }
+
+ private boolean isLostFoundMessage(String requestHint) {
+ if(((IHintedType)UMLElementTypes.Message_4008).getSemanticHint().equals(requestHint) || ((IHintedType)UMLElementTypes.Message_4009).getSemanticHint().equals(requestHint))
+ return true;
+ return false;
+ }
+
+ /**
+ * Override to disable uphill message
+ */
+ @Override
+ protected Command getReconnectTargetCommand(ReconnectRequest request) {
+ if(isUphillMessage(request) && !isLostFoundMessage(request)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // prevent duplicate link
+ if(request.getConnectionEditPart() instanceof Message4EditPart && request.getTarget() != null && !LifelineMessageCreateHelper.canReconnectMessageCreate(request)){
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ return super.getReconnectTargetCommand(request);
+ }
+
+ /**
+ * Check that a message doesn't have its target point above its source point
+ *
+ * @param request
+ * the ReconnectRequest
+ * @return true if the target point is above the source point
+ */
+ protected boolean isUphillMessage(ReconnectRequest request) {
+ ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
+ if(connectionEditPart.getModel() instanceof Edge) {
+ Edge edge = (Edge)connectionEditPart.getModel();
+ if(edge.getElement() instanceof Message) {
+ if(connectionEditPart.getFigure() instanceof Polyline) {
+ // get connection end points translated to absolute
+ Polyline polyline = (Polyline)connectionEditPart.getFigure();
+ Point end = polyline.getEnd().getCopy();
+ Point start = polyline.getStart().getCopy();
+ polyline.getParent().translateToAbsolute(end);
+ polyline.getParent().translateToAbsolute(start);
+
+ // look at the request rather than at both polyline ends which may not be up to date
+ if(REQ_RECONNECT_SOURCE.equals(request.getType())) {
+ return request.getLocation().y >= end.y + MARGIN;
+ } else if(REQ_RECONNECT_TARGET.equals(request.getType())) {
+ return start.y >= request.getLocation().y + MARGIN;
+ } else {
+ return start.y >= end.y + MARGIN;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Overrides to set the color of the dummyConnection to color black.
+ * This allow to see the feedback of the connection when it is created.
+ * By default, the color was the foreground color of the lifeline, which is always blank leading to an invisible feedback.
+ *
+ */
+ @Override
+ protected Connection createDummyConnection(Request req) {
+ Connection conn = super.create