Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-02-04 09:53:14 +0000
committercletavernie2013-02-04 09:53:14 +0000
commitb4f92c06b153f91fbbbfa172e883be364aa55e2b (patch)
tree5111ba4bb111f6dc7f82764dc311ce6114eaa9cb /incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus
parent3d5e6004d9b6977504cf8b1bf8d45f76659e9043 (diff)
downloadorg.eclipse.papyrus-b4f92c06b153f91fbbbfa172e883be364aa55e2b.tar.gz
org.eclipse.papyrus-b4f92c06b153f91fbbbfa172e883be364aa55e2b.tar.xz
org.eclipse.papyrus-b4f92c06b153f91fbbbfa172e883be364aa55e2b.zip
397389: [Timing Diagram] Papyrus shall support UML2 timing diagram
https://bugs.eclipse.org/bugs/show_bug.cgi?id=397389 Move oep.uml.diagram.timing to its final SVN location
Diffstat (limited to 'incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus')
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramCommand.java49
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java21
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java195
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java23
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/SwitchLifelineAction.java42
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java34
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramEditorFactory.java23
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java105
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java79
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractRefreshCommand.java56
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java119
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromCompactToFull.java36
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromFullToCompact.java35
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java89
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java87
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java67
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java52
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java134
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java124
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java84
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java55
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCommand.java138
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCompactLifelineCommand.java165
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForDo.java34
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java589
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java85
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java57
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java258
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java135
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java83
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java31
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java41
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java41
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java151
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java74
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java138
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java130
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java342
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java131
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java36
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java41
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java126
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java148
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java34
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java34
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java31
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java31
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java114
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java61
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java43
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java47
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java137
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java490
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java76
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java228
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java32
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java32
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java107
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java22
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java75
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java52
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java115
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java52
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentLayoutEditPolicy.java14
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java95
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java89
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java69
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java58
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java345
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java78
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java114
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java226
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java56
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java37
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java105
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java363
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java94
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java96
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java177
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java66
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.java67
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java56
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java135
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java62
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.java35
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java59
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java145
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java78
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.java31
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.java37
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java41
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java39
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java52
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java65
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java23
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java39
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java169
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java48
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java61
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java57
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java60
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties93
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java224
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java101
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java89
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java45
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java250
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java327
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java64
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java56
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java48
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java20
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java64
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java152
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java75
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.java22
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java38
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java378
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java138
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java127
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java148
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java45
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java39
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java269
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java331
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java246
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java443
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java78
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java304
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java436
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java172
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java59
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java110
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java148
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java273
167 files changed, 0 insertions, 16714 deletions
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramCommand.java
deleted file mode 100644
index 10bc699759d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-
-/**
- * A command to create a new Timing Diagram. This command is used by all UI (toolbar, model explorer, creation wizards)
- * to create a new Timing Diagram.
- */
-public class CreateTimingDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
-
- /**
- * Name of the Diagram
- */
- protected static final String TIMING_DIAGRAM_NAME = "TimingDiagram"; //$NON-NLS-1$
-
- @Override
- protected String getDefaultDiagramName() {
- return TIMING_DIAGRAM_NAME;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDiagramNotationID() {
- return TimingDiagramEditPart.MODEL_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected PreferencesHint getPreferenceHint() {
- return org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java
deleted file mode 100644
index 8855b26a55b..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateTimingDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateTimingDiagramWithNavigationHandler() {
- super(new CreateTimingDiagramCommand(), new TimingDiagramCreationCondition());
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java
deleted file mode 100644
index 77599c26567..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-public class LifelineVerticalLabelCellEditorLocator implements CellEditorLocator {
-
- private final LifelineVerticalLabel figure;
-
- public LifelineVerticalLabelCellEditorLocator(final LifelineVerticalLabel figure) {
- this.figure = figure;
- }
-
- public void relocate(final CellEditor celleditor) {
- final Text text = (Text)celleditor.getControl();
- // position the cell editor at the top of the vertical text
- final Rectangle rect = this.figure.getBounds().getCopy();
- rect.y -= text.getBounds().height + 5;
- this.figure.translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- final int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java
deleted file mode 100644
index 9f03e2f79a9..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.diagram.timing.custom.messages"; //$NON-NLS-1$
-
- public static String AbstractTimelineLayoutPolicy_MoveOccurrenceSpecification;
-
- public static String AbstractTimelineLayoutPolicy_UpdateLocationOfTimeElements;
-
- public static String AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification;
-
- public static String ChangeLifelineFromCompactToFull_commandLabel;
-
- public static String ChangeLifelineFromFullToCompact_commandLabel;
-
- public static String CompactStateInvariantNameParser_SetStateInvariantName;
-
- public static String CompactStateInvariantNameParser_Unnamed;
-
- public static String CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_CreateStateInvariant;
-
- public static String CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant;
-
- public static String CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement;
-
- public static String CustomCompactLifelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification;
-
- public static String CustomCompactLifelineCompartmentLayoutEditPolicy_ResizeStateInvariant;
-
- public static String CustomCompactStateInvariantEditPartCN_CreateOccurrenceSpecification;
-
- public static String CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition;
-
- public static String CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition;
-
- public static String CustomFullLifelineStateDefinitionCompartmentEditPartCN_AddStateDefinitionsHere;
-
- public static String CustomFullStateInvariantEditPartCN_CreateOccurrenceSpecification;
-
- public static String hideStateInvariant;
-
- public static String CustomInteractionCompartmentCreationEditPolicy_CreateCompactLifeline;
-
- public static String CustomInteractionCompartmentCreationEditPolicy_CreateFullLifeline;
-
- public static String CustomInteractionCreationEditPolicy_CreateGate;
-
- public static String CustomInteractionCreationEditPolicy_PositionGate;
-
- public static String CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation;
-
- public static String CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation;
-
- public static String OccurrenceSpecificationUtils_DestroyOccurrenceSpecification;
-
- public static String OccurrenceSpecificationUtils_HideOccurrenceSpecification;
-
- public static String LifelineUtils_CreationOccurrence;
-
- public static String LifelineUtils_DestructionOccurrence;
-
- public static String LifelineUtils_UpdateFragmentNames;
-
- public static String LifelineUtils_UpdateLifelineFragmentNames;
-
- public static String CustomPaletteFactory_SetFoundMessageTarget;
-
- public static String CustomPaletteFactory_SetLostMessageOrigin;
-
- public static String CustomStateDefinitionEditPart_DeleteStateDefinition;
-
- public static String CustomTimelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification;
-
- public static String CustomTimelineCompartmentLayoutEditPolicy_MoveStateInvariant;
-
- public static String CustomTimelineCompartmentLayoutEditPolicy_MoveVerticalLine;
-
- public static String CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant;
-
- public static String CutAndInsertOccurrenceSpecificationCommand_CreateOccurrenceSpecification;
-
- public static String CutAndInsertOccurrenceSpecificationCompactLifelineCommand_CreateOccurrenceSpecification;
-
- public static String DeleteStateDefinitionCommand_DeleteStateDefinition;
-
- public static String DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification;
-
- public static String DropUtils_DropElement;
-
- public static String DropUtils_DropGate;
-
- public static String DurationCreationTool_ClickEndElement;
-
- public static String DurationCreationTool_ClickStartElement;
-
- public static String ModelValidationUtils_CoveredByFragmentsWereReOrdered;
-
- public static String ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification;
-
- public static String ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification;
-
- public static String ModelValidationUtils_MissingOccurrenceSpecificationAdded;
-
- public static String ModelValidationUtils_MissingOccurrenceSpecificationFound;
-
- public static String ModelValidationUtils_ModelValidation;
-
- public static String OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification;
-
- public static String OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification;
-
- public static String OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName;
-
- public static String StateDefinitionParser_SetStateDefinitionName;
-
- public static String StateDefinitionParser_Unnamed;
-
- public static String StateDefinitionUtils_State;
-
- public static String StateInvariantHelperAdvice_DestroyStateInvariant;
-
- public static String SwitchLifelineCommand_createLifelineFragments;
-
- public static String SwitchLifelineCommand_CreateLinkedElements;
-
- public static String SwitchLifelineCommand_CreateTimeRuler;
-
- public static String SwitchLifelineCommand_createMessages;
-
- public static String SwitchLifelineCommand_createStateDefinitions;
-
- public static String SwitchLifelineCommand_NameUnnamedStateInvariants;
-
- public static String SwitchLifelineCommand_ReAssociateTicks;
-
- public static String SwitchLifelineCommand_switchLifeline;
-
- public static String SwitchLifelineCommand_unnamed;
-
- public static String CreateTickCommand_attachTick;
-
- public static String CreateTickCommand_CreateTick;
-
- public static String ConstraintParser_SetConstraint;
-
- public static String GateHelperAdvice_DestroyGate;
-
- public static String GeneralOrderingCreationTool_ClickAfter;
-
- public static String GeneralOrderingCreationTool_ClickBefore;
-
- public static String TimingDiagramDragDropEditPolicy_Drop;
-
- public static String TimingDiagramDragDropEditPolicy_DropLifeline;
-
- public static String TimingDiagramDragDropEditPolicy_DropLifelineFragments;
-
- public static String TimingDiagramDragDropEditPolicy_DropMessage;
-
- public static String TimingDiagramDragDropEditPolicy_DropStateDefinitions;
-
- public static String ToggleTimeRulerVisibility_ToggleTimeRulerVisibility;
-
- public static String UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage;
-
- public static String UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle;
-
- public static String ValidateInteractionCommand_ValidateInteraction;
-
- public static String ViewUtils_MoveView;
-
- public static String CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler;
-
- public static String CustomTimingDiagramCreationEditPolicy_CreateInteraction;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java
deleted file mode 100644
index 8d5c9eddacf..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-/** An exception indicating that the operation that was asked should not be performed, as it is not allowed. */
-public class OperationForbiddenException extends Exception {
-
- private static final long serialVersionUID = -4972361328078373414L;
-
- public OperationForbiddenException() {
- super();
- }
-
- public OperationForbiddenException(final String message) {
- super(message);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/SwitchLifelineAction.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/SwitchLifelineAction.java
deleted file mode 100644
index 9e7341ad8b7..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/SwitchLifelineAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.SwitchLifelineCommand;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class SwitchLifelineAction implements IObjectActionDelegate {
-
- public final static String ID = "org.eclipse.papyrus.uml.diagram.timing.custom.SwitchLifelineActionID"; //$NON-NLS-1$
-
- public void run(final IAction action) {
- final SwitchLifelineCommand handler = new SwitchLifelineCommand();
- try {
- handler.execute(null);
- } catch (final ExecutionException e) {
- Activator.log.error("Error switching lifeline", e); //$NON-NLS-1$
- }
-
- }
-
- public void selectionChanged(final IAction action, final ISelection selection) {
- // nothing
-
- }
-
- public void setActivePart(final IAction action, final IWorkbenchPart targetPart) {
- // nothing
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java
deleted file mode 100644
index ccb59f22bb9..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-
-/** Checks if a Timing diagram can be added to the selected element. */
-public class TimingDiagramCreationCondition extends PerspectiveContextDependence {
-
- /**
- * @return whether the diagram can be created.
- */
- @Override
- public boolean create(final EObject selectedElement) {
- return true;
-
- // FIXME: condition?
-
- // if (super.create(selectedElement)) {
- // return selectedElement instanceof org.eclipse.uml2.uml.Package;
- // }
- // return false;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramEditorFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramEditorFactory.java
deleted file mode 100644
index 4631d65f045..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramEditorFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-
-public class TimingDiagramEditorFactory extends GmfEditorFactory {
-
- public TimingDiagramEditorFactory() {
- super(UmlTimingDiagramForMultiEditor.class, TimingDiagramEditPart.MODEL_ID);
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java
deleted file mode 100644
index d70fee9babf..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-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.timing.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;
-
-/** An editor to be used in multitabs editor. This editor extends the original UML Diagram. */
-public class UmlTimingDiagramForMultiEditor extends org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditor {
-
- /** The location of diagram icon in the plug-in */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Timing.gif"; //$NON-NLS-1$
-
- /** The image descriptor of the diagram icon */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlTimingDiagramForMultiEditor.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 UmlTimingDiagramForMultiEditor(final ServicesRegistry servicesRegistry, final Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(final IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- final URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (final CoreException x) {
- final String title = Messages.UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle;
- final String msg = Messages.UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage;
- final Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(final Composite parent) {
- this.splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- this.splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.uml.diagram.timing.EditingDomain"; //$NON-NLS-1$
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java
deleted file mode 100644
index 45000ab0f89..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.Lifeline;
-
-public abstract class AbstractChangeLifelineTypeCommand extends AbstractTransactionalCommand {
-
- protected IGraphicalEditPart lifelineEditPart;
-
- /**
- * Constructor of this command
- *
- * @param domain
- * the transactional editing domain to execute the transaction
- * @param lifelineEditPart
- * the editpart that will be transformed
- * @param changeLifelineFromCompactToFull_commandLabel
- */
- public AbstractChangeLifelineTypeCommand(final TransactionalEditingDomain domain, final IGraphicalEditPart lifelineEditPart, final String commandLabel) {
- super(domain, commandLabel, Collections.EMPTY_LIST);
- this.lifelineEditPart = lifelineEditPart;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final EditPart parentEditPart = this.lifelineEditPart.getParent();
- // creation of the node
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Lifeline lifeline = (Lifeline)this.lifelineEditPart.resolveSemanticElement();
- final View view = this.lifelineEditPart.getNotationView();
- final View containerView = (View)view.eContainer();
- final int index = containerView.getChildren().indexOf(view);
- final Node lifelineNode = createTargetLifelineView(umlViewProvider, lifeline, containerView, index);
- lifelineNode.setLayoutConstraint(((Node)this.lifelineEditPart.getNotationView()).getLayoutConstraint());
- // copy all EAnnotations
- final Iterator<EAnnotation> iter = this.lifelineEditPart.getNotationView().getEAnnotations().iterator();
- while(iter.hasNext()) {
- final EAnnotation annotation = EcoreUtil.copy(iter.next());
- lifelineNode.getEAnnotations().add(annotation);
- }
- LifelineUtils.setLifelineType(lifeline, getTargetLifelineType());
-
- // select the new Lifeline View
- parentEditPart.refresh();
- ViewUtils.selectInViewer(lifelineNode, parentEditPart.getViewer());
-
- return CommandResult.newOKCommandResult(lifelineNode);
- }
-
- protected abstract LifelineType getTargetLifelineType();
-
- protected abstract Node createTargetLifelineView(final UMLViewProvider umlViewProvider, final Lifeline lifeline, final View containerView, final int index);
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractRefreshCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractRefreshCommand.java
deleted file mode 100644
index fb13cae6ca7..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractRefreshCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.RootEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Refresh the {@link IFigure} of a given {@link GraphicalEditPart}.
- */
-public abstract class AbstractRefreshCommand extends Command {
-
- private final GraphicalEditPart editPartToRefresh;
-
- private final RootEditPart rootEditPart;
-
- public AbstractRefreshCommand(final GraphicalEditPart editPartToRefresh) {
- this.editPartToRefresh = editPartToRefresh;
- this.rootEditPart = editPartToRefresh.getRoot();
- }
-
- public GraphicalEditPart getEditPartToRefresh() {
- return this.editPartToRefresh;
- }
-
- protected void refresh() {
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- if(AbstractRefreshCommand.this.editPartToRefresh.isActive()) {
- DiagramHelper.refresh(AbstractRefreshCommand.this.editPartToRefresh, true);
- // this is needed in order to update the bounds of the Figures from their layout manager constraints
- AbstractRefreshCommand.this.editPartToRefresh.getFigure().invalidateTree();
- } else if(AbstractRefreshCommand.this.rootEditPart.isActive()) {
- /*
- * If the EditPart we needed to refresh is not active anymore, then it probably means that we undid its
- * creation, and re-created the object as part of a redo, with a different EditPart. In this case, just
- * refresh everything.
- */
- DiagramHelper.refresh(AbstractRefreshCommand.this.rootEditPart, true);
- }
- }
- });
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java
deleted file mode 100644
index 5ffe7ffd3fd..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/** This command adds an OccurrenceSpecification at a given Location. */
-public class AddOccurrenceSpecificationInCompactLifelineCommand extends AbstractTransactionalCommand {
-
- private final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN;
-
- private final Point location;
-
- private final CompactLifelineEditPartCN lifelineEditPart;
-
- private final Lifeline lifeline;
-
- /**
- * @param fullStateInvariantEditPartCN
- * the state invariant on top of which to put the OccurrenceSpecification
- * @param location
- * where the user clicked: the horizontal coordinate indicates where to insert the
- * OccurrenceSpecification
- */
- public AddOccurrenceSpecificationInCompactLifelineCommand(final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN, final Point location) {
- super(getEditingDomain(compactStateInvariantEditPartCN), Messages.AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification, null);
- this.compactStateInvariantEditPartCN = compactStateInvariantEditPartCN;
- this.location = location;
- this.lifelineEditPart = (CompactLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(this.compactStateInvariantEditPartCN, CompactLifelineEditPartCN.VISUAL_ID);
- this.lifeline = (Lifeline)((View)this.lifelineEditPart.getModel()).getElement();
- }
-
- private static TransactionalEditingDomain getEditingDomain(final CompactStateInvariantEditPartCN compactStateInvariantEditPart) {
- final StateInvariant stateInvariant = (StateInvariant)((View)compactStateInvariantEditPart.getModel()).getElement();
- return TransactionUtil.getEditingDomain(stateInvariant);
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(this.lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
-
- final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
-
- // translate the coordinates
- final Point pt = new Point(this.location);
- timelineCompartmentEditPart.getFigure().translateToRelative(pt);
- pt.translate(timelineCompartmentEditPart.getFigure().getBounds().getTopLeft().getNegated());
-
- // find where to insert the OccurrenceSpecification
- final int insertionIndexInCompartment = OccurrenceSpecificationUtils.findInsertionIndexFor(pt, timelineCompartmentView, timelineCompartmentEditPart.getViewer());
- final int insertionIndexInFragments;
- final int insertionIndexInCoveredBys;
- if(insertionIndexInCompartment < timelineCompartmentView.getChildren().size()) {
- final View view = (View)timelineCompartmentView.getChildren().get(insertionIndexInCompartment);
- final EObject element = view.getElement();
- insertionIndexInFragments = this.lifeline.getInteraction().getFragments().indexOf(element);
- insertionIndexInCoveredBys = this.lifeline.getCoveredBys().indexOf(element);
- } else {
- insertionIndexInFragments = -1;
- insertionIndexInCoveredBys = -1;
- }
-
- // create the occurrence specification at the right index
- final OccurrenceSpecification newOccurrenceSpecification = UMLFactory.eINSTANCE.createOccurrenceSpecification();
- if(insertionIndexInFragments == -1) {
- this.lifeline.getInteraction().getFragments().add(newOccurrenceSpecification);
- } else {
- this.lifeline.getInteraction().getFragments().add(insertionIndexInFragments, newOccurrenceSpecification);
- }
- if(insertionIndexInCoveredBys == -1) {
- this.lifeline.getCoveredBys().add(newOccurrenceSpecification);
- } else {
- this.lifeline.getCoveredBys().add(insertionIndexInCoveredBys, newOccurrenceSpecification);
- }
-
- // create the View for the occurrence specification
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
-
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(newOccurrenceSpecification, timelineCompartmentView, insertionIndexInCompartment, true, PreferencesHint.USE_DEFAULTS);
-
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(pt.x);
- loc.setY(pt.y);
- occurrenceSpecificationView.setLayoutConstraint(loc);
-
- return CommandResult.newOKCommandResult(newOccurrenceSpecification);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromCompactToFull.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromCompactToFull.java
deleted file mode 100644
index 5c3ca61760d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromCompactToFull.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.Lifeline;
-
-public class ChangeLifelineFromCompactToFull extends AbstractChangeLifelineTypeCommand {
-
- public ChangeLifelineFromCompactToFull(final TransactionalEditingDomain domain, final IGraphicalEditPart lifelineView) {
- super(domain, lifelineView, Messages.ChangeLifelineFromCompactToFull_commandLabel);
- }
-
- @Override
- protected LifelineType getTargetLifelineType() {
- return LifelineType.full;
- }
-
- @Override
- protected Node createTargetLifelineView(final UMLViewProvider umlViewProvider, final Lifeline lifeline, final View containerView, final int index) {
- return umlViewProvider.createLifeline_19(lifeline, containerView, index, true, this.lifelineEditPart.getDiagramPreferencesHint());
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromFullToCompact.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromFullToCompact.java
deleted file mode 100644
index e01c4e87be2..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromFullToCompact.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.Lifeline;
-
-public class ChangeLifelineFromFullToCompact extends AbstractChangeLifelineTypeCommand {
-
- public ChangeLifelineFromFullToCompact(final TransactionalEditingDomain domain, final IGraphicalEditPart lifelineView) {
- super(domain, lifelineView, Messages.ChangeLifelineFromFullToCompact_commandLabel);
- }
-
- @Override
- protected LifelineType getTargetLifelineType() {
- return LifelineType.compact;
- }
-
- @Override
- protected Node createTargetLifelineView(final UMLViewProvider umlViewProvider, final Lifeline lifeline, final View containerView, final int index) {
- return umlViewProvider.createLifeline_20(lifeline, containerView, index, true, this.lifelineEditPart.getDiagramPreferencesHint());
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
deleted file mode 100644
index 638957b0d83..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.emf.transaction.util.TransactionUtil;
-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.CommandResult;
-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.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TickUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TimeRulerUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-public class CreateTickCommand extends GraphicalCommandHandler {
-
- @Override
- protected Command getCommand() throws ExecutionException {
- final CompoundCommand cmd = new CompoundCommand(Messages.CreateTickCommand_attachTick);
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(!selection.isEmpty() && selection instanceof IStructuredSelection) {
- final IStructuredSelection structSelection = (IStructuredSelection)selection;
- for(final Object object : structSelection.toArray()) {
- if(object instanceof OccurrenceSpecificationEditPartCN || object instanceof MessageOccurrenceSpecificationEditPartCN || object instanceof DestructionOccurrenceSpecificationEditPartCN) {
- cmd.add(attachTick((GraphicalEditPart)object));
- }
- }
- }
- return cmd;
- }
-
- private static Command attachTick(final GraphicalEditPart osEditPart) {
- final IGraphicalEditPart tickContainer = TimeRulerUtils.findClosestTimeRuler(osEditPart);
- if(tickContainer == null) {
- Activator.log.error("No tick container found", new Exception()); //$NON-NLS-1$
- return UnexecutableCommand.INSTANCE;
- }
- final View tickContainerView = (View)tickContainer.getModel();
-
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(osEditPart.getEditingDomain());
- final Node osView = (Node)osEditPart.getModel();
- final OccurrenceSpecification os = (OccurrenceSpecification)osView.getElement();
- // if the Lifeline or Interaction compartment already contains a tick for this occurrence,
- // then don't let a duplicate be created
- if(TickUtils.containsTickFor(tickContainerView, os)) {
- return UnexecutableCommand.INSTANCE;
- }
- final AbstractTransactionalCommand createTickCommand = new AbstractTransactionalCommand(editingDomain, Messages.CreateTickCommand_CreateTick, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node tickNode = umlViewProvider.createNode_26(null, tickContainerView, ViewUtil.APPEND, true, osEditPart.getDiagramPreferencesHint());
- TickUtils.associateTickNodeToOccurrenceNode(tickNode, osView, false);
- tickContainer.refresh();
- ViewUtils.performEditRequest(tickNode, osEditPart.getViewer());
- return CommandResult.newOKCommandResult(tickNode);
- }
- };
- return new ICommandProxy(createTickCommand);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java
deleted file mode 100644
index c7bb7f9abb5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.AbstractTwoPointCreationTool;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.uml2.uml.Duration;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.DurationInterval;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomDurationConstraintCreateCommand extends EditElementCommand {
-
- public CustomDurationConstraintCreateCommand(final CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CreateElementRequest request = (CreateElementRequest)getRequest();
- final EditPart firstTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
- final EditPart secondTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
-
- final DurationConstraint durationConstraint = UMLFactory.eINSTANCE.createDurationConstraint();
- final NamedElement firstTargetElement = (NamedElement)((View)firstTarget.getModel()).getElement();
- final NamedElement secondTargetElement = (NamedElement)((View)secondTarget.getModel()).getElement();
-
- final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if(containingPackage == null) {
- return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
- }
-
- containingPackage.getPackagedElements().add(durationConstraint);
- durationConstraint.getConstrainedElements().clear();
- durationConstraint.getFirstEvents().clear();
- if(firstTargetElement == secondTargetElement) {
- durationConstraint.getConstrainedElements().add(firstTargetElement);
- } else {
- durationConstraint.getConstrainedElements().add(firstTargetElement);
- durationConstraint.getConstrainedElements().add(secondTargetElement);
- durationConstraint.getFirstEvents().add(Boolean.TRUE);
- durationConstraint.getFirstEvents().add(Boolean.FALSE);
- }
-
- final DurationInterval durationInterval = UMLFactory.eINSTANCE.createDurationInterval();
- durationConstraint.setSpecification(durationInterval);
-
- final Duration minTime = UMLFactory.eINSTANCE.createDuration();
- final Duration maxTime = UMLFactory.eINSTANCE.createDuration();
- containingPackage.getPackagedElements().add(minTime);
- containingPackage.getPackagedElements().add(maxTime);
- durationInterval.setMin(minTime);
- durationInterval.setMax(maxTime);
-
- final LiteralString minExpr = UMLFactory.eINSTANCE.createLiteralString();
- final LiteralString maxExpr = UMLFactory.eINSTANCE.createLiteralString();
- minTime.setExpr(minExpr);
- maxTime.setExpr(maxExpr);
- minExpr.setValue("d1"); //$NON-NLS-1$
- maxExpr.setValue("d2"); //$NON-NLS-1$
-
- request.setNewElement(durationConstraint);
- return CommandResult.newOKCommandResult(durationConstraint);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java
deleted file mode 100644
index ef85b9bd198..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.AbstractTwoPointCreationTool;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomDurationObservationCreateCommand extends EditElementCommand {
-
- public CustomDurationObservationCreateCommand(final CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CreateElementRequest request = (CreateElementRequest)getRequest();
- final EditPart firstTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
- final EditPart secondTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
-
- final DurationObservation durationObservation = UMLFactory.eINSTANCE.createDurationObservation();
- final NamedElement firstTargetElement = (NamedElement)((View)firstTarget.getModel()).getElement();
- final NamedElement secondTargetElement = (NamedElement)((View)secondTarget.getModel()).getElement();
-
- final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if(containingPackage == null) {
- return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
- }
-
- containingPackage.getPackagedElements().add(durationObservation);
- durationObservation.getEvents().clear();
- durationObservation.getFirstEvents().clear();
- if(firstTargetElement == secondTargetElement) {
- durationObservation.getEvents().add(firstTargetElement);
- } else {
- durationObservation.getEvents().add(firstTargetElement);
- durationObservation.getEvents().add(secondTargetElement);
- durationObservation.getFirstEvents().add(Boolean.TRUE);
- durationObservation.getFirstEvents().add(Boolean.FALSE);
- }
-
- request.setNewElement(durationObservation);
- return CommandResult.newOKCommandResult(durationObservation);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java
deleted file mode 100644
index 4a9dc0661dc..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.AbstractTwoPointCreationTool;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomGeneralOrderingCreateCommand extends EditElementCommand {
-
- public CustomGeneralOrderingCreateCommand(final CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CreateElementRequest request = (CreateElementRequest)getRequest();
- final EditPart firstTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
- final EditPart secondTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
-
- final GeneralOrdering generalOrdering = UMLFactory.eINSTANCE.createGeneralOrdering();
- final OccurrenceSpecification beforeOccurrence = (OccurrenceSpecification)((View)firstTarget.getModel()).getElement();
- final OccurrenceSpecification afterOccurrence = (OccurrenceSpecification)((View)secondTarget.getModel()).getElement();
-
- beforeOccurrence.getGeneralOrderings().add(generalOrdering);
- generalOrdering.setBefore(beforeOccurrence);
- generalOrdering.setAfter(afterOccurrence);
- beforeOccurrence.getToAfters().add(generalOrdering);
-
- return CommandResult.newOKCommandResult(generalOrdering);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java
deleted file mode 100644
index 567b3ebfe8b..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageKind;
-import org.eclipse.uml2.uml.MessageSort;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * Creates a Message between MessageOccurrenceSpecifications. Converts OccurrenceSpecifications to
- * MessageOccurrenceSpecifications if needed
- */
-public class CustomMessageCreateCommand extends EditElementCommand {
-
- private final Interaction interaction;
-
- private final EObject source;
-
- private final EObject target;
-
- private final MessageKind messageKind;
-
- private final MessageSort messageSort;
-
- public CustomMessageCreateCommand(final CreateRelationshipRequest request) {
- super(request.getLabel(), null, request);
- this.source = request.getSource();
- this.target = request.getTarget();
- this.messageKind = MessageUtils.getMessageKind(request.getElementType());
- this.messageSort = MessageUtils.getMessageSort(request.getElementType());
- this.interaction = EcoreUtils.getContaining(this.source, Interaction.class);
- }
-
- @Override
- public boolean canExecute() {
- if(this.source == null && this.target == null) {
- return false;
- }
-
- // no create or destroy Message to a Gate
- if(this.target instanceof Gate && (this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL || this.messageSort == MessageSort.DELETE_MESSAGE_LITERAL)) {
- return false;
- }
- // no create message can target a destruction
- if(this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL && this.target instanceof DestructionOccurrenceSpecification) {
- return false;
- }
-
- if(this.messageKind == MessageKind.FOUND_LITERAL) {
- if(this.source != null && !(this.source instanceof Lifeline)) {
- return false;
- }
- } else if(this.source != null && !(MessageUtils.isPotentialMessageEnd(this.source))) {
- return false;
- }
-
- if(this.messageKind == MessageKind.LOST_LITERAL) {
- if(this.target != null && !(this.target instanceof Lifeline)) {
- return false;
- }
- } else if(this.target != null && !(MessageUtils.isPotentialMessageEnd(this.target))) {
- return false;
- }
- if(this.source == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- if(this.interaction == null) {
- return false;
- }
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- final boolean destruction = this.messageSort == MessageSort.DELETE_MESSAGE_LITERAL;
- final boolean creation = this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL;
-
- if(destruction) {
- OccurrenceSpecificationUtils.deleteEverythingAfter((OccurrenceSpecification)this.target, null);
- }
- if(creation) {
- OccurrenceSpecificationUtils.deleteEverythingBefore((OccurrenceSpecification)this.target, null);
- }
-
- // a "found" message comes from nowhere
- final MessageEnd messageSource = this.messageKind == MessageKind.FOUND_LITERAL ? null : MessageUtils.convertToMessageOccurrenceSpecification(this.source, false);
- // a "lost" message goes to nowhere
- final MessageEnd messageTarget = this.messageKind == MessageKind.LOST_LITERAL ? null : MessageUtils.convertToMessageOccurrenceSpecification(this.target, destruction);
-
- if(!MessageUtils.isValidMessage(this.messageSort, this.messageKind, messageSource, messageTarget)) {
- throw new ExecutionException("Invalid Message"); //$NON-NLS-1$
- }
-
- final Message newMessage = UMLFactory.eINSTANCE.createMessage();
- this.interaction.getMessages().add(newMessage);
- newMessage.setSendEvent(messageSource);
- newMessage.setReceiveEvent(messageTarget);
- newMessage.setMessageSort(this.messageSort);
- newMessage.setName(""); //$NON-NLS-1$
-
- ((CreateElementRequest)getRequest()).setNewElement(newMessage);
- return CommandResult.newOKCommandResult(newMessage);
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java
deleted file mode 100644
index 27d6f58fc78..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import java.util.HashSet;
-import java.util.List;
-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.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.DropUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageKind;
-import org.eclipse.uml2.uml.MessageSort;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-public class CustomMessageReorientCommand extends EditElementCommand {
-
- private final int reorientDirection;
-
- private final EObject newEnd;
-
- private final EditPartViewer viewer;
-
- public CustomMessageReorientCommand(final ReorientRelationshipRequest request, final EditPartViewer viewer) {
- super(request.getLabel(), request.getRelationship(), request);
- this.viewer = viewer;
- this.reorientDirection = request.getDirection();
- this.newEnd = request.getNewRelationshipEnd();
- }
-
- @Override
- public boolean canExecute() {
- if(!(getElementToEdit() instanceof Message)) {
- return false;
- }
- final Message message = (Message)getElementToEdit();
-
- final EObject source;
- final EObject target;
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- source = this.newEnd;
- target = message.getReceiveEvent();
- } else {
- source = message.getSendEvent();
- target = this.newEnd;
- }
- final MessageSort messageSort = message.getMessageSort();
- final MessageKind messageKind = message.getMessageKind();
- return MessageUtils.isValidMessage(messageSort, messageKind, source, target);
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
- }
-
- final boolean reorientSource = this.reorientDirection == ReorientRequest.REORIENT_SOURCE;
- final boolean reorientTarget = this.reorientDirection == ReorientRequest.REORIENT_TARGET;
-
- final Message message = (Message)getElementToEdit();
- final boolean destruction = reorientTarget && message.getMessageSort() == MessageSort.DELETE_MESSAGE_LITERAL;
- final boolean creation = reorientTarget && message.getMessageSort() == MessageSort.CREATE_MESSAGE_LITERAL;
-
- final MessageEnd newMessageEnd = MessageUtils.convertToMessageOccurrenceSpecification(this.newEnd, destruction);
- if(reorientSource) {
- message.setSendEvent(newMessageEnd);
- } else if(reorientTarget) {
- message.setReceiveEvent(newMessageEnd);
- }
-
- if(destruction || creation) {
- // save the parent View while the message is still in it
- final Set<View> parentInteractionViews = findParentInteractionViews(newMessageEnd);
- // destroying the old target of the message will also delete the Message View
- if(destruction) {
- OccurrenceSpecificationUtils.deleteEverythingAfter((OccurrenceSpecification)newMessageEnd, null);
- }
- if(creation) {
- OccurrenceSpecificationUtils.deleteEverythingBefore((OccurrenceSpecification)newMessageEnd, null);
- }
- // re-create the Message View that was deleted by GMF
- for(final View parentInteractionView : parentInteractionViews) {
- DropUtils.getDropMessageCommand(message, parentInteractionView, this.viewer).execute(new NullProgressMonitor(), null);
- }
- }
-
- return CommandResult.newOKCommandResult(message);
- }
-
- private Set<View> findParentInteractionViews(final EObject eObject) {
- final List<View> views = DiagramEditPartsUtil.findViews(eObject, this.viewer);
- final Set<View> interactionViews = new HashSet<View>();
- for(final View view : views) {
- final View interactionView = ViewUtils.findSuperViewWithId(view, InteractionEditPartTN.VISUAL_ID);
- if(interactionView != null) {
- interactionViews.add(interactionView);
- }
- }
- return interactionViews;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java
deleted file mode 100644
index 1cce0cd04f0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.CustomPaletteFactory;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.TimeExpression;
-import org.eclipse.uml2.uml.TimeInterval;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomTimeConstraintCreateCommand extends EditElementCommand {
-
- public CustomTimeConstraintCreateCommand(final CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final TimeConstraint timeConstraint = UMLFactory.eINSTANCE.createTimeConstraint();
- final CreateElementRequest request = (CreateElementRequest)getRequest();
- final EditPart originalTarget = (EditPart)request.getParameter(CustomPaletteFactory.ORIGINAL_TARGET);
- final NamedElement targetElement = (NamedElement)((View)originalTarget.getModel()).getElement();
-
- // TODO: firstEvent depending on the click location relative to the originalTarget EditPart figure
-
- final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if(containingPackage == null) {
- return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
- }
- final Interaction containingInteraction = EcoreUtils.getContaining(request.getContainer(), Interaction.class);
- if(containingInteraction == null) {
- return CommandResult.newErrorCommandResult("The container must be in an Interaction"); //$NON-NLS-1$
- }
-
- containingInteraction.getOwnedRules().add(timeConstraint);
- timeConstraint.getConstrainedElements().clear();
- timeConstraint.getConstrainedElements().add(targetElement);
-
- final TimeInterval timeInterval = UMLFactory.eINSTANCE.createTimeInterval();
- timeConstraint.setSpecification(timeInterval);
-
- final TimeExpression minTime = UMLFactory.eINSTANCE.createTimeExpression();
- final TimeExpression maxTime = UMLFactory.eINSTANCE.createTimeExpression();
- containingPackage.getPackagedElements().add(minTime);
- containingPackage.getPackagedElements().add(maxTime);
- timeInterval.setMin(minTime);
- timeInterval.setMax(maxTime);
-
- final LiteralString minExpr = UMLFactory.eINSTANCE.createLiteralString();
- final LiteralString maxExpr = UMLFactory.eINSTANCE.createLiteralString();
- minTime.setExpr(minExpr);
- maxTime.setExpr(maxExpr);
- minExpr.setValue("t1"); //$NON-NLS-1$
- maxExpr.setValue("t2"); //$NON-NLS-1$
-
- ((CreateElementRequest)getRequest()).setNewElement(timeConstraint);
- return CommandResult.newOKCommandResult(timeConstraint);
-
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java
deleted file mode 100644
index e0bc540df0d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.CustomPaletteFactory;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomTimeObservationCreateCommand extends EditElementCommand {
-
- public CustomTimeObservationCreateCommand(final CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final TimeObservation timeObservation = UMLFactory.eINSTANCE.createTimeObservation();
- final CreateElementRequest request = (CreateElementRequest)getRequest();
- final EditPart originalTarget = (EditPart)request.getParameter(CustomPaletteFactory.ORIGINAL_TARGET);
- final NamedElement targetElement = (NamedElement)((View)originalTarget.getModel()).getElement();
-
- // TODO: firstEvent depending on the click location relative to the originalTarget EditPart figure
-
- final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if(containingPackage == null) {
- return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
- }
- containingPackage.getPackagedElements().add(timeObservation);
- timeObservation.setEvent(targetElement);
- ((CreateElementRequest)getRequest()).setNewElement(timeObservation);
- return CommandResult.newOKCommandResult(timeObservation);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCommand.java
deleted file mode 100644
index ee17495e259..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCommand.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/** This command cuts a StateInvariant in two at a given Location, and inserts an OccurrenceSpecification. */
-public class CutAndInsertOccurrenceSpecificationCommand extends AbstractTransactionalCommand {
-
- private final FullStateInvariantEditPartCN fullStateInvariantEditPartCN;
-
- private final Point location;
-
- private final FullLifelineEditPartCN lifelineEditPart;
-
- private final Lifeline lifeline;
-
- private final boolean destruction;
-
- /**
- * @param fullStateInvariantEditPartCN
- * the state invariant to cut in two
- * @param location
- * where the user clicked: the horizontal coordinate indicates where to insert the
- * OccurrenceSpecification
- * @param destruction
- * whether to create a DestructionOccurrenceSpecification
- */
- public CutAndInsertOccurrenceSpecificationCommand(final FullStateInvariantEditPartCN fullStateInvariantEditPartCN, final Point location, final boolean destruction) {
- super(getEditingDomain(fullStateInvariantEditPartCN), Messages.CutAndInsertOccurrenceSpecificationCommand_CreateOccurrenceSpecification, null);
- this.fullStateInvariantEditPartCN = fullStateInvariantEditPartCN;
- this.location = location;
- this.destruction = destruction;
- this.lifelineEditPart = (FullLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(this.fullStateInvariantEditPartCN, FullLifelineEditPartCN.VISUAL_ID);
- this.lifeline = (Lifeline)((View)this.lifelineEditPart.getModel()).getElement();
- }
-
- private static TransactionalEditingDomain getEditingDomain(final FullStateInvariantEditPartCN fullStateInvariantEditPart) {
- final StateInvariant stateInvariant = (StateInvariant)((View)fullStateInvariantEditPart.getModel()).getElement();
- return TransactionUtil.getEditingDomain(stateInvariant);
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(this.lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
- final View stateInvariantView = (View)this.fullStateInvariantEditPartCN.getModel();
- final StateInvariant firstStateInvariant = (StateInvariant)stateInvariantView.getElement();
-
- final int indexInFragments = this.lifeline.getInteraction().getFragments().indexOf(firstStateInvariant);
- final int indexInCoveredBys = this.lifeline.getCoveredBys().indexOf(firstStateInvariant);
- final int indexInCompartment = timelineCompartmentView.getChildren().indexOf(stateInvariantView);
-
- // create occurrence specification
- final OccurrenceSpecification newOccurrenceSpecification = this.destruction ? UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification() : UMLFactory.eINSTANCE.createOccurrenceSpecification();
- OccurrenceSpecificationUtils.setAutogeneratedName(newOccurrenceSpecification, true);
- this.lifeline.getInteraction().getFragments().add(indexInFragments + 1, newOccurrenceSpecification);
- this.lifeline.getCoveredBys().add(indexInCoveredBys + 1, newOccurrenceSpecification);
-
- // create View for occurrence specification
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
-
- final Node occurrenceSpecificationView;
- if(this.destruction) {
- occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(newOccurrenceSpecification, timelineCompartmentView, indexInCompartment + 1, true, PreferencesHint.USE_DEFAULTS);
- } else {
- occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(newOccurrenceSpecification, timelineCompartmentView, indexInCompartment + 1, true, PreferencesHint.USE_DEFAULTS);
- }
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- final Point pt = new Point(this.location);
- timelineCompartmentEditPart.getFigure().translateToRelative(pt);
- pt.translate(timelineCompartmentEditPart.getFigure().getBounds().getTopLeft().getNegated());
- loc.setX(pt.x);
- loc.setY(pt.y);
- occurrenceSpecificationView.setLayoutConstraint(loc);
-
- if(this.destruction) {
- OccurrenceSpecificationUtils.deleteEverythingAfter(newOccurrenceSpecification, occurrenceSpecificationView);
- } else {
- // create a VerticalLine View to link the two StateInvariants
- umlViewProvider.createNode_39(null, timelineCompartmentView, indexInCompartment + 2, true, PreferencesHint.USE_DEFAULTS);
-
- // get first state invariant id
- final String id = StateInvariantUtils.getStateInvariantId(firstStateInvariant);
-
- // create a second state invariant with the same state id (on the same state)
- StateInvariantUtils.createStateInvariant(id, this.lifelineEditPart, indexInFragments + 2, indexInCoveredBys + 2, indexInCompartment + 3);
- }
-
- // update the names of the adjacent occurrences
- LifelineUtils.updateFragmentNames(this.lifeline, (View)this.lifelineEditPart.getModel());
-
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- timelineCompartmentEditPart.refresh();
- ViewUtils.selectInViewer(occurrenceSpecificationView, CutAndInsertOccurrenceSpecificationCommand.this.lifelineEditPart.getViewer());
- }
- });
-
- return CommandResult.newOKCommandResult(newOccurrenceSpecification);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCompactLifelineCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCompactLifelineCommand.java
deleted file mode 100644
index d7195c7150e..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCompactLifelineCommand.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * This command cuts a StateInvariant in two StateInvariants, with an OccurrenceSpecification in between the two
- * StateInvariants.
- */
-public class CutAndInsertOccurrenceSpecificationCompactLifelineCommand extends AbstractTransactionalCommand {
-
- private final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN;
-
- private final Point location;
-
- private final CompactLifelineEditPartCN lifelineEditPart;
-
- private final Lifeline lifeline;
-
- private final boolean destruction;
-
- /**
- * @param fullStateInvariantEditPartCN
- * the state invariant to cut in two
- * @param location
- * where the user clicked: the horizontal coordinate indicates where to insert the
- * OccurrenceSpecification
- * @param destruction
- * whether to create a DestructionOccurrenceSpecification
- */
- public CutAndInsertOccurrenceSpecificationCompactLifelineCommand(final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN, final Point location, final boolean destruction) {
- super(getEditingDomain(compactStateInvariantEditPartCN), Messages.CutAndInsertOccurrenceSpecificationCompactLifelineCommand_CreateOccurrenceSpecification, null);
- this.compactStateInvariantEditPartCN = compactStateInvariantEditPartCN;
- this.location = location;
- this.destruction = destruction;
- this.lifelineEditPart = (CompactLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(this.compactStateInvariantEditPartCN, CompactLifelineEditPartCN.VISUAL_ID);
- this.lifeline = (Lifeline)((View)this.lifelineEditPart.getModel()).getElement();
- }
-
- private static TransactionalEditingDomain getEditingDomain(final CompactStateInvariantEditPartCN compactStateInvariantEditPart) {
- final StateInvariant stateInvariant = (StateInvariant)((View)compactStateInvariantEditPart.getModel()).getElement();
- return TransactionUtil.getEditingDomain(stateInvariant);
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(this.lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
-
- final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
-
- // translate the coordinates
- final Point pt = new Point(this.location);
- timelineCompartmentEditPart.getFigure().translateToRelative(pt);
- pt.translate(timelineCompartmentEditPart.getFigure().getBounds().getTopLeft().getNegated());
-
- // find where to insert the OccurrenceSpecification
- int insertionIndexInCompartment = OccurrenceSpecificationUtils.findInsertionIndexFor(pt, timelineCompartmentView, timelineCompartmentEditPart.getViewer());
- int insertionIndexInFragments;
- int insertionIndexInCoveredBys;
- if(insertionIndexInCompartment < timelineCompartmentView.getChildren().size()) {
- final View view = (View)timelineCompartmentView.getChildren().get(insertionIndexInCompartment);
- final EObject element = view.getElement();
- insertionIndexInFragments = this.lifeline.getInteraction().getFragments().indexOf(element);
- insertionIndexInCoveredBys = this.lifeline.getCoveredBys().indexOf(element);
- } else {
- insertionIndexInFragments = -1;
- insertionIndexInCoveredBys = -1;
- }
-
- // create the occurrence specification at the right index
- final OccurrenceSpecification newOccurrenceSpecification = this.destruction ? UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification() : UMLFactory.eINSTANCE.createOccurrenceSpecification();
- OccurrenceSpecificationUtils.setAutogeneratedName(newOccurrenceSpecification, true);
- if(insertionIndexInFragments == -1) {
- this.lifeline.getInteraction().getFragments().add(newOccurrenceSpecification);
- } else {
- this.lifeline.getInteraction().getFragments().add(insertionIndexInFragments, newOccurrenceSpecification);
- }
- if(insertionIndexInCoveredBys == -1) {
- this.lifeline.getCoveredBys().add(newOccurrenceSpecification);
- } else {
- this.lifeline.getCoveredBys().add(insertionIndexInCoveredBys, newOccurrenceSpecification);
- }
-
- // create the View for the occurrence specification
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
-
- final Node occurrenceSpecificationView;
- if(this.destruction) {
- occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(newOccurrenceSpecification, timelineCompartmentView, insertionIndexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- } else {
- occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(newOccurrenceSpecification, timelineCompartmentView, insertionIndexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- }
-
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(pt.x);
- loc.setY(pt.y);
- occurrenceSpecificationView.setLayoutConstraint(loc);
-
- if(this.destruction) {
- OccurrenceSpecificationUtils.deleteEverythingAfter(newOccurrenceSpecification, occurrenceSpecificationView);
- } else {
- // increase the indices for inserting the state invariant (don't increase -1 since it means "at the end")
- if(insertionIndexInFragments != -1) {
- insertionIndexInFragments++;
- }
- if(insertionIndexInCoveredBys != -1) {
- insertionIndexInCoveredBys++;
- }
- if(insertionIndexInCompartment != -1) {
- insertionIndexInCompartment++;
- }
-
- // create a new state invariant
- StateInvariantUtils.createCompactStateInvariant(timelineCompartmentView, insertionIndexInFragments, insertionIndexInCoveredBys, insertionIndexInCompartment);
- }
-
- LifelineUtils.updateFragmentNames(this.lifeline, null);
-
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- timelineCompartmentEditPart.refresh();
- ViewUtils.selectInViewer(occurrenceSpecificationView, CutAndInsertOccurrenceSpecificationCompactLifelineCommand.this.lifelineEditPart.getViewer());
- }
- });
-
- return CommandResult.newOKCommandResult(newOccurrenceSpecification);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java
deleted file mode 100644
index 2e06ea6c57d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.uml2.uml.Lifeline;
-
-/**
- * This command removes the "semantic" part of a StateDefinition : the EAnnotation on the Lifeline.
- */
-public class DeleteStateDefinitionCommand extends AbstractTransactionalCommand {
-
- private final String id;
-
- private final Lifeline lifeline;
-
- /**
- * @param id
- * the id of the state definition to delete
- * @param lifeline
- * the lifeline
- * @param domain
- * the editing domain
- */
- public DeleteStateDefinitionCommand(final String id, final Lifeline lifeline, final TransactionalEditingDomain domain) {
- super(domain, Messages.DeleteStateDefinitionCommand_DeleteStateDefinition, null);
- this.id = id;
- this.lifeline = lifeline;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- StateDefinitionUtils.removeStateDefinitionEAnnotationFromLifeline(this.id, this.lifeline);
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForDo.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForDo.java
deleted file mode 100644
index 23b0cba7c26..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForDo.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.gef.GraphicalEditPart;
-
-/**
- * Refresh the {@link IFigure} of a given {@link GraphicalEditPart} on execute and redo of this command. This command
- * must be placed at the end of a {@link CompoundCommand}, as the execute and redo are done in forward order.
- */
-public class RefreshCommandForDo extends AbstractRefreshCommand {
-
- public RefreshCommandForDo(final GraphicalEditPart editPartToRefresh) {
- super(editPartToRefresh);
- }
-
- @Override
- public void execute() {
- refresh();
- }
-
- @Override
- public void redo() {
- refresh();
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java
deleted file mode 100644
index 8fafa31ecb0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import org.eclipse.gef.GraphicalEditPart;
-
-/**
- * Refresh the {@link IFigure} of a given {@link GraphicalEditPart} on undo of this command. <br/>
- * <strong>This command must be created before the other ones in a CompoundCommand</strong> since the commands are
- * executed in reverse when undoing.
- */
-public class RefreshCommandForUndo extends AbstractRefreshCommand {
-
- public RefreshCommandForUndo(final GraphicalEditPart editPartToRefresh) {
- super(editPartToRefresh);
- }
-
- @Override
- public void undo() {
- refresh();
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
deleted file mode 100644
index 885f22fc316..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
+++ /dev/null
@@ -1,589 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-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.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-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.core.util.ViewUtil;
-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.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.notation.DescriptionStyle;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.Style;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomCompactLifelineCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.DropUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TickUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TimeRulerUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Utils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimeRulerCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickNameEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class SwitchLifelineCommand extends GraphicalCommandHandler {
-
- private Command switchLifeline(final IGraphicalEditPart lifelineEditPart) {
- final EditPartViewer viewer = lifelineEditPart.getViewer();
- final View lifelineView = (View)lifelineEditPart.getModel();
- final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(lifelineView);
- final boolean timeRulerVisible = timeRulerCompartmentView.isVisible();
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
- final CompoundCommand cc = new CompoundCommand(Messages.SwitchLifelineCommand_switchLifeline);
-
- // we need to re-associate ticks in the Interaction time ruler to their new OccurrenceSpecification Views
- final Map<OccurrenceSpecification, List<Node>> ticksAssociations = computeAllTicksAssociations(lifelineView);
- // we need to re-create ticks in the Lifeline time ruler (since they get destroyed when destroying the Lifeline)
- final Map<OccurrenceSpecification, String> lifelineTicksAssociations = computeLifelineTicksAssociations(lifelineView);
-
- if(lifelineEditPart instanceof CompactLifelineEditPartCN) {
- cc.add(new RefreshCommandForUndo((GraphicalEditPart)lifelineEditPart.getParent()));
- cc.add(new ICommandProxy(getNameUnnamedStateInvariants(lifeline)));
- final ICommand createCommand = new ChangeLifelineFromCompactToFull(getEditingDomain(), lifelineEditPart);
- cc.add(new ICommandProxy(createCommand));
- cc.add(new ICommandProxy(getFreeTimeRulerCreationCommand(createCommand, timeRulerVisible)));
- cc.add(new ICommandProxy(getStateDefinitionCreationForFullLifelineCommand(lifeline, createCommand)));
- cc.add(new ICommandProxy(getFragmentsCreationForFullLifelineCommand(lifeline, createCommand)));
- cc.add(new ICommandProxy(getTicksAssociationCommand(createCommand, ticksAssociations)));
- cc.add(new ICommandProxy(getLifelineTicksCreationCommand(createCommand, lifelineTicksAssociations)));
- addDestroyViewsAndEdgesRecursivelyCommand(cc, lifelineView);
- // we need to create the EditParts corresponding to the MessageEnd Views before trying to reconnect Messages
- cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
- cc.add(new ICommandProxy(getMessagesCreationCommand(createCommand, viewer)));
- cc.add(new ICommandProxy(getLinkedElementsCreationCommand(createCommand, viewer)));
- cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
- return cc;
- } else if(lifelineEditPart instanceof FullLifelineEditPartCN) {
- cc.add(new RefreshCommandForUndo((GraphicalEditPart)lifelineEditPart.getParent()));
- final ICommand createCommand = new ChangeLifelineFromFullToCompact(getEditingDomain(), lifelineEditPart);
- cc.add(new ICommandProxy(createCommand));
- cc.add(new ICommandProxy(getFreeTimeRulerCreationCommand(createCommand, timeRulerVisible)));
- cc.add(new ICommandProxy(getFragmentsCreationForCompactLifelineCommand(lifeline, createCommand)));
- cc.add(new ICommandProxy(getTicksAssociationCommand(createCommand, ticksAssociations)));
- cc.add(new ICommandProxy(getLifelineTicksCreationCommand(createCommand, lifelineTicksAssociations)));
- addDestroyViewsAndEdgesRecursivelyCommand(cc, lifelineView);
- // we need to create the EditParts corresponding to the MessageEnd Views before trying to reconnect Messages
- cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
- cc.add(new ICommandProxy(getMessagesCreationCommand(createCommand, viewer)));
- cc.add(new ICommandProxy(getLinkedElementsCreationCommand(createCommand, viewer)));
- cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
- return cc;
- }
- throw new IllegalArgumentException("expected a Lifeline edit part"); //$NON-NLS-1$
- }
-
- /** Compute the map of OccurrenceSpecifications to corresponding tick Views. */
- private static Map<OccurrenceSpecification, List<Node>> computeAllTicksAssociations(final View lifelineView) {
- final Map<OccurrenceSpecification, List<Node>> map = new HashMap<OccurrenceSpecification, List<Node>>();
- final View timelineCompartmentView = ViewUtils.findChildTimelineCompartmentView(lifelineView);
- @SuppressWarnings("unchecked")
- final EList<View> children = timelineCompartmentView.getChildren();
- for(final View child : children) {
- if(ViewUtils.isViewFor(child, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)child.getElement();
- final List<Node> associatedTickViews = TickUtils.getAssociatedTickViews(child);
- map.put(occurrenceSpecification, associatedTickViews);
- }
- }
- return map;
- }
-
- /**
- * Compute the map of OccurrenceSpecifications to corresponding tick names, for the ticks found in the given
- * Lifeline's time ruler.
- */
- private static Map<OccurrenceSpecification, String> computeLifelineTicksAssociations(final View lifelineView) {
- // there should be a single tick corresponding to an OccurrenceSpecification in this lifeline time ruler
- // hence this map from OccurrenceSpecification to a tick name
- final Map<OccurrenceSpecification, String> map = new HashMap<OccurrenceSpecification, String>();
- final View timeRulerCompartment = ViewUtils.findFirstChildViewWithId(lifelineView, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
- @SuppressWarnings("unchecked")
- final EList<View> children = timeRulerCompartment.getChildren();
- for(final View tickView : children) {
- final Node associatedOccurrenceView = TickUtils.getAssociatedOccurrenceView(tickView);
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)associatedOccurrenceView.getElement();
- final String description = getTickLabelDescription(tickView);
- map.put(occurrenceSpecification, description);
- }
- return map;
- }
-
- protected static void setTickLabelDescription(final Node tickNode, final String tickName) {
- final View labelView = ViewUtils.findFirstChildViewWithId(tickNode, TickNameEditPart.VISUAL_ID);
- if(labelView != null) {
- @SuppressWarnings("unchecked")
- final EList<Style> styles = labelView.getStyles();
- for(final Object style : styles) {
- if(style instanceof DescriptionStyle) {
- final DescriptionStyle descriptionStyle = (DescriptionStyle)style;
- descriptionStyle.setDescription(tickName);
- }
- }
- }
- }
-
- private static String getTickLabelDescription(final View tickView) {
- final View labelView = ViewUtils.findFirstChildViewWithId(tickView, TickNameEditPart.VISUAL_ID);
- if(labelView != null) {
- @SuppressWarnings("unchecked")
- final EList<Style> styles = labelView.getStyles();
- for(final Object style : styles) {
- if(style instanceof DescriptionStyle) {
- final DescriptionStyle descriptionStyle = (DescriptionStyle)style;
- return descriptionStyle.getDescription();
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- /** Re-associates Interaction time ruler ticks to their new OccurrenceSpecification Views. */
- private ICommand getTicksAssociationCommand(final ICommand createCommand, final Map<OccurrenceSpecification, List<Node>> ticksAssociations) {
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_ReAssociateTicks, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final View timelineCompartmentView = ViewUtils.findChildTimelineCompartmentView(lifelineView);
- @SuppressWarnings("unchecked")
- final EList<View> children = timelineCompartmentView.getChildren();
- for(final View child : children) {
- if(ViewUtils.isViewFor(child, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)child.getElement();
- final List<Node> tickNodes = ticksAssociations.get(occurrenceSpecification);
- if(tickNodes != null) {
- for(final Node tickNode : tickNodes) {
- TickUtils.associateTickNodeToOccurrenceNode(tickNode, (Node)child, true);
- }
- }
- }
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- /** Re-creates Lifeline time ruler ticks, and associate them to their new OccurrenceSpecification Views. */
- private ICommand getLifelineTicksCreationCommand(final ICommand createCommand, final Map<OccurrenceSpecification, String> lifelineTicksAssociations) {
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_ReAssociateTicks, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final View timeRulerCompartment = ViewUtils.findFirstChildViewWithId(lifelineView, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
- final View timelineCompartmentView = ViewUtils.findChildTimelineCompartmentView(lifelineView);
-
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- for(final Entry<OccurrenceSpecification, String> entry : lifelineTicksAssociations.entrySet()) {
- final OccurrenceSpecification occurrenceSpecification = entry.getKey();
- final Node occurrenceView = findOccurrenceView(occurrenceSpecification, timelineCompartmentView);
- final String tickName = entry.getValue();
- final Node tickNode = umlViewProvider.createNode_26(null, timeRulerCompartment, ViewUtil.APPEND, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- setTickLabelDescription(tickNode, tickName);
- TickUtils.associateTickNodeToOccurrenceNode(tickNode, occurrenceView, false);
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- /** Find the View corresponding to the given OccurrenceSpecification in the given timeline compartment View */
- protected static Node findOccurrenceView(final OccurrenceSpecification occurrenceSpecification, final View timelineCompartmentView) {
- @SuppressWarnings("unchecked")
- final EList<View> children = timelineCompartmentView.getChildren();
- for(final View child : children) {
- if(child.getElement() == occurrenceSpecification) {
- return (Node)child;
- }
- }
- return null;
- }
-
- /**
- * Unnamed state invariants cause issues because they have no attached StateDefinition, so we set a name and update
- * the StateDefinitions.
- */
- private ICommand getNameUnnamedStateInvariants(final Lifeline lifeline) {
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_NameUnnamedStateInvariants, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
- boolean containsUnnamedStateInvariants = false;
- for(final InteractionFragment interactionFragment : coveredBys) {
- if(interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
- if(StateInvariantUtils.getInnerStateInvariantName(stateInvariant) == null) {
- containsUnnamedStateInvariants = true;
- StateInvariantUtils.setInnerStateInvariantName(stateInvariant, Messages.SwitchLifelineCommand_unnamed);
- }
- }
- }
- if(containsUnnamedStateInvariants) {
- StateDefinitionUtils.updateStateDefinitionNamesForCompactLifeline(lifeline);
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private static void addDestroyViewsAndEdgesRecursivelyCommand(final CompoundCommand cc, final View view) {
- @SuppressWarnings("unchecked")
- final EList<View> children = view.getChildren();
- for(final View childView : children) {
- addDestroyViewsAndEdgesRecursivelyCommand(cc, childView);
- }
- @SuppressWarnings("unchecked")
- final EList<Edge> sourceEdges = view.getSourceEdges();
- @SuppressWarnings("unchecked")
- final EList<Edge> targetEdges = view.getTargetEdges();
- for(final Edge edge : sourceEdges) {
- cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(edge, false))));
- }
- for(final Edge edge : targetEdges) {
- cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(edge, false))));
- }
- cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(view, false))));
-
- }
-
- private ICommand getMessagesCreationCommand(final ICommand createCommand, final EditPartViewer viewer) {
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createMessages, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
-
- // find Messages linked to fragments in the Lifeline
- final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
- final Class<?>[] expectedClasses = new Class<?>[]{ Message.class };
- final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
- final Set<EObject> referencingElements = new HashSet<EObject>();
- for(final InteractionFragment interactionFragment : coveredBys) {
- referencingElements.addAll(Utils.findReferencingElements(interactionFragment, references, expectedClasses));
- }
- // drop the Messages
- for(final EObject referencingElement : referencingElements) {
- final Message referencingMessage = (Message)referencingElement;
- executeCommand(DropUtils.getDropMessageCommand(referencingMessage, lifelineView, viewer));
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private ICommand getLinkedElementsCreationCommand(final ICommand createCommand, final EditPartViewer viewer) {
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_CreateLinkedElements, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
-
- // find time elements and general orderings linked to fragments in the Lifeline
- final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getGeneralOrdering_Before(), UMLPackage.eINSTANCE.getGeneralOrdering_After(), UMLPackage.eINSTANCE.getDurationObservation_Event(), UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
- final Class<?>[] expectedClasses = new Class<?>[]{ GeneralOrdering.class, TimeObservation.class, DurationObservation.class, TimeConstraint.class, DurationConstraint.class };
-
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
- final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
- final Set<EObject> referencingElements = new HashSet<EObject>();
- for(final InteractionFragment interactionFragment : coveredBys) {
- referencingElements.addAll(Utils.findReferencingElements(interactionFragment, references, expectedClasses));
- }
-
- // drop the elements
- for(final EObject eObject : referencingElements) {
- if(eObject instanceof TimeObservation) {
- final TimeObservation timeObservation = (TimeObservation)eObject;
- executeCommand(DropUtils.getDropTimeObservationCommand(timeObservation, lifelineView, viewer));
- } else if(eObject instanceof TimeConstraint) {
- final TimeConstraint timeConstraint = (TimeConstraint)eObject;
- executeCommand(DropUtils.getDropTimeConstraintCommand(timeConstraint, lifelineView, viewer));
- } else if(eObject instanceof DurationObservation) {
- final DurationObservation durationObservation = (DurationObservation)eObject;
- executeCommand(DropUtils.getDropDurationObservationCommand(durationObservation, lifelineView, viewer));
- } else if(eObject instanceof DurationConstraint) {
- final DurationConstraint durationConstraint = (DurationConstraint)eObject;
- executeCommand(DropUtils.getDropDurationConstraintCommand(durationConstraint, lifelineView, viewer));
- } else if(eObject instanceof GeneralOrdering) {
- final GeneralOrdering generalOrdering = (GeneralOrdering)eObject;
- executeCommand(DropUtils.getDropGeneralOrderingCommand(generalOrdering, lifelineView, viewer));
- }
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private ICommand getStateDefinitionCreationForFullLifelineCommand(final Lifeline lifeline, final ICommand createCommand) {
-
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createStateDefinitions, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final View stateDefinitionCompartmentView = ViewUtils.findStateDefinitionCompartmentView(lifelineView);
- final List<String> stateDefinitionIds = StateDefinitionUtils.getStateDefinitionIds(lifeline);
- for(final String stateDefinitionId : stateDefinitionIds) {
- final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionId, lifeline);
-
- // create the View for the state definition
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateDefinitionView = umlViewProvider.createNode_9(null, stateDefinitionCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- // restore the same id
- StateDefinitionUtils.setStateDefinitionViewID(stateDefinitionView, stateDefinitionId);
- // set the name on the View
- StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, stateDefinitionName);
- }
-
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private ICommand getFreeTimeRulerCreationCommand(final ICommand createCommand, final boolean timeRulerVisible) {
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_CreateTimeRuler, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- TimeRulerUtils.createFreeTimeRuler(lifelineView);
- final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(lifelineView);
- // restore the same visibility as before the switch
- timeRulerCompartmentView.setVisible(timeRulerVisible);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private ICommand getFragmentsCreationForCompactLifelineCommand(final Lifeline lifeline, final ICommand createCommand) {
-
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createLifelineFragments, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final View stateInvariantCompartmentView = ViewUtils.findCompactTimelineCompartmentView(lifelineView);
- String previousStateInvariantName = ""; //$NON-NLS-1$
- int indexInCompartment = 0;
- int x = CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET;
- for(final InteractionFragment fragment : lifeline.getCoveredBys()) {
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(x);
- loc.setY(0);
- if(fragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)fragment;
- final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if(!Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
- umlViewProvider.createStateInvariant_28(stateInvariant, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- indexInCompartment++;
- x += 60;
- }
- previousStateInvariantName = stateInvariantName;
-
- } else if(fragment instanceof DestructionOccurrenceSpecification) {
- final DestructionOccurrenceSpecification occurrence = (DestructionOccurrenceSpecification)fragment;
- final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(occurrence, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- indexInCompartment++;
- occurrenceSpecificationView.setLayoutConstraint(loc);
- x += 10;
-
- } else if(fragment instanceof MessageOccurrenceSpecification) {
- final MessageOccurrenceSpecification occurrence = (MessageOccurrenceSpecification)fragment;
- final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrence, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- indexInCompartment++;
- occurrenceSpecificationView.setLayoutConstraint(loc);
- x += 10;
-
- } else if(fragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrence = (OccurrenceSpecification)fragment;
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrence, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- indexInCompartment++;
- occurrenceSpecificationView.setLayoutConstraint(loc);
- x += 10;
- }
- }
-
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private ICommand getFragmentsCreationForFullLifelineCommand(final Lifeline lifeline, final ICommand createCommand) {
-
- return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createLifelineFragments, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final View timelineCompartmentView = ViewUtils.findFullLifelineCompartmentView(lifelineView);
-
- final EList<InteractionFragment> fragments = lifeline.getCoveredBys();
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- int x = 20;
- boolean firstStateInvariant = true;
- String previousStateInvariantName = ""; //$NON-NLS-1$
- StateInvariant previousStateInvariant = null;
- boolean needStateInvariant = false;
- for(final InteractionFragment fragment : fragments) {
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(x);
- loc.setY(0);
-
- // we always need a StateInvariant between OccurrenceSpecifications
- // (otherwise we would be leaving a gap in the timeline)
- if(!(fragment instanceof StateInvariant) && needStateInvariant && previousStateInvariant != null) {
- umlViewProvider.createStateInvariant_11(previousStateInvariant, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- }
-
- if(fragment instanceof StateInvariant) {
- if(!firstStateInvariant) {
- // add a vertical line
- umlViewProvider.createNode_39(null, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- }
- final StateInvariant stateInvariant = (StateInvariant)fragment;
- final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if(Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
- x += 10;
- } else {
- x += 25;
- }
- // create the View for the state invariant
- umlViewProvider.createStateInvariant_11(stateInvariant, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- firstStateInvariant = false;
- previousStateInvariantName = stateInvariantName;
- previousStateInvariant = stateInvariant;
- needStateInvariant = false;
- } else if(fragment instanceof DestructionOccurrenceSpecification) {
- final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification)fragment;
- // create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(destructionOccurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- occurrenceSpecificationView.setLayoutConstraint(loc);
- needStateInvariant = false;
- x += 10;
- } else if(fragment instanceof MessageOccurrenceSpecification) {
- final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification)fragment;
- // create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- occurrenceSpecificationView.setLayoutConstraint(loc);
- needStateInvariant = true;
- x += 10;
- } else if(fragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)fragment;
- // create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- occurrenceSpecificationView.setLayoutConstraint(loc);
- needStateInvariant = true;
- x += 10;
- }
- }
-
- // we always need the timeline to end with a StateInvariant
- if(needStateInvariant && previousStateInvariant != null) {
- umlViewProvider.createStateInvariant_11(previousStateInvariant, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- }
-
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- @Override
- protected Command getCommand() throws ExecutionException {
- final CompoundCommand cmd = new CompoundCommand(Messages.SwitchLifelineCommand_switchLifeline);
- final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- for(final IGraphicalEditPart selectedElement : selectedElements) {
- if(selectedElement instanceof FullLifelineEditPartCN || selectedElement instanceof CompactLifelineEditPartCN) {
- cmd.add(switchLifeline(selectedElement));
- }
- }
- return cmd;
- }
-
- protected static void executeCommand(final ICommand command) throws ExecutionException {
- if(command.canExecute()) {
- command.execute(new NullProgressMonitor(), null);
- } else {
- Activator.log.warn("Cannot execute command for lifeline switch: " + command.getLabel()); //$NON-NLS-1$
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
deleted file mode 100644
index edb24a1c7b3..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.IFigure;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart;
-
-public class ToggleTimeRulerVisibility extends GraphicalCommandHandler {
-
- @Override
- protected Command getCommand() throws ExecutionException {
- final CompoundCommand cmd = new CompoundCommand(Messages.ToggleTimeRulerVisibility_ToggleTimeRulerVisibility);
- final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- boolean first = true;
- InteractionEditPartTN interactionEditPart = null;
- for(final IGraphicalEditPart selectedEditPart : selectedElements) {
- if(selectedEditPart instanceof FullLifelineEditPartCN || selectedEditPart instanceof CompactLifelineEditPartCN) {
- if(first) {
- interactionEditPart = (InteractionEditPartTN)EditPartUtils.findParentEditPartWithId(selectedEditPart, InteractionEditPartTN.VISUAL_ID);
- if(interactionEditPart != null) {
- cmd.add(new RefreshCommandForUndo(interactionEditPart));
- first = false;
- }
- }
- cmd.add(toggleTimeRulerVisibility(selectedEditPart));
- }
- }
- if(interactionEditPart != null) {
- cmd.add(new RefreshCommandForDo(interactionEditPart));
- }
- return cmd;
- }
-
- private Command toggleTimeRulerVisibility(final IGraphicalEditPart object) {
- return new ICommandProxy(new AbstractTransactionalCommand(getEditingDomain(), Messages.ToggleTimeRulerVisibility_ToggleTimeRulerVisibility, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final LifelineEditPart lifelineEditPart = (LifelineEditPart)object;
- final View lifelineView = (View)lifelineEditPart.getModel();
- final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(lifelineView);
- timeRulerCompartmentView.setVisible(!timeRulerCompartmentView.isVisible());
- return CommandResult.newOKCommandResult();
- }
- });
- }
-
- protected static final LifelineFigure getLifelineFigure(final IFigure figure) {
- LifelineFigure result = null;
- result = FigureUtils.findChildFigureInstance(figure, FullLifelineFigure.class);
- if(result == null) {
- result = FigureUtils.findChildFigureInstance(figure, CompactLifelineFigure.class);
- }
- return result;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java
deleted file mode 100644
index ceb23345c42..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-
-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.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ModelValidationUtils;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Interaction;
-
-public class ValidateInteractionCommand extends AbstractTransactionalCommand {
-
- private final Interaction interaction;
-
- private final boolean interactive;
-
- /**
- * @param domain
- * the editing domain
- * @param interaction
- * the interaction to validate
- * @param interactive
- * whether to display notifications to the user, and ask for confirmation using dialog boxes
- */
- public ValidateInteractionCommand(final TransactionalEditingDomain domain, final Interaction interaction, final boolean interactive) {
- super(domain, Messages.ValidateInteractionCommand_ValidateInteraction, null);
- this.interaction = interaction;
- this.interactive = interactive;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final boolean[] result = new boolean[1];
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- result[0] = validate();
- }
- });
- return result[0] ? CommandResult.newOKCommandResult() : CommandResult.newErrorCommandResult("Invalid model"); //$NON-NLS-1$
- }
-
- protected boolean validate() {
- return ModelValidationUtils.validate(this.interaction, true, this.interactive);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java
deleted file mode 100644
index 9a8ebc130f1..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.CreateConnectionRequest;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.diagram.ui.layout.FreeFormLayoutEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactStateFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CrossFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.DimensioningArrowFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.GeneralOrderingHorizontalFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-
-public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCompartmentEditPartCN {
-
- /**
- * This offset lets compact states align with full states, which appear after the state definition compartment
- * (which is 100 pixels wide)
- */
- public static final int FIRST_STATE_OFFSET = Constants.STATE_DEFINITIONS_WIDTH;
-
- public CustomCompactLifelineCompartmentEditPart(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure figure = (ResizableCompartmentFigure)super.createFigure();
- figure.setBorder(null);
- figure.getScrollPane().setBorder(null);
- figure.setLayoutManager(new FillLayout());
-
- figure.getContentPane().setLayoutManager(new FreeFormLayoutEx() {
-
- @Override
- public void layout(final IFigure container) {
- // reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- if(!(container.getParent().getLayoutManager() instanceof FillLayout)) {
- container.getParent().setLayoutManager(new FillLayout());
- }
-
- // The grand-parent is a FreeformViewport, which lets its child expand outside of its clientArea, and
- // constantly resets the bounds (in org.eclipse.draw2d.FreeformViewport#readjustScrollBars)
- // So, layout based on the grand-parent's clientArea.
- final Rectangle clientArea = container.getParent().getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- int x = clientArea.x + FIRST_STATE_OFFSET;
- final int centerY = clientArea.y + clientArea.height / 2;
- int currentStateInvariantX = 0;
- int currentStateInvariantWidth = 0;
- int currentStateInvariantHeight = 0;
- int lastOccurrenceX = 0;
- boolean currentStateInvariantInfinite = false;
-
- boolean destruction = false;
- int destructionX = Integer.MAX_VALUE;
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- final CrossFigure crossFigure = FigureUtils.findChildFigureInstance(child, CrossFigure.class);
- if(crossFigure != null) {
- final Rectangle constraint = (Rectangle)getConstraint(child);
- destruction = true;
- destructionX = constraint.x;
- }
- }
-
- IFigure nextChild = null;
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- if(i < children.size() - 1) {
- nextChild = children.get(i + 1);
- } else {
- nextChild = null;
- }
-
- final IFigure occurrenceFigure = getOccurrenceChild(child);
- final CompactStateFigure stateInvariantFigure = FigureUtils.findChildFigureInstance(child, CompactStateFigure.class);
- final VerticalMarkFigure verticalMarkFigure = FigureUtils.findChildFigureInstance(child, VerticalMarkFigure.class);
- final DimensioningArrowFigure dimensioningArrowFigure = FigureUtils.findChildFigureInstance(figure, DimensioningArrowFigure.class);
- final GeneralOrderingHorizontalFigure generalOrderingHorizontalFigure = FigureUtils.findChildFigureInstance(figure, GeneralOrderingHorizontalFigure.class);
-
- // This is the bounds that the user tries to set. We further constrain these bounds.
- final Rectangle constraint = (Rectangle)getConstraint(child);
-
- // OccurrenceSpecification, MessageOccurrenceSpecification or DestructionOccurrenceSpecification
- if(occurrenceFigure != null) {
- final Dimension preferredSize = occurrenceFigure.getPreferredSize();
-
- if(nextChild != null && FigureUtils.findChildFigureInstance(nextChild, CompactStateFigure.class) != null) {
- // this is an occurrence specification marking a state change
- // => center it vertically
- child.setBounds(new Rectangle(constraint.x, centerY - preferredSize.height / 2, preferredSize.width, preferredSize.height));
- x = constraint.x + preferredSize.width;
- } else {
- int posX = constraint.x;
- // make sure the OccurrenceSpecification stays
- // within the bounds of its containing StateInvariant
- posX = Math.max(posX, currentStateInvariantX - SmallSquareFigure.RADIUS);
- posX = Math.min(posX, currentStateInvariantX + currentStateInvariantWidth - SmallSquareFigure.RADIUS);
- // also make sure it doesn't appear before the previous occurrence
- posX = Math.max(posX, lastOccurrenceX);
-
- // let the user move the OccurrenceSpecification near the top or bottom of the
- // StateInvariant on top of which it appears, and snap it to this position
- final int halfHeight = CompactStateFigure.computeHalfHeightAtAbscissa(posX - currentStateInvariantX + SmallSquareFigure.RADIUS, currentStateInvariantWidth, currentStateInvariantHeight, currentStateInvariantInfinite);
- final int topPos = centerY - halfHeight - SmallSquareFigure.RADIUS;
- final int bottomPos = centerY + halfHeight - SmallSquareFigure.RADIUS - 1;
- int posY;
- if(Math.abs(constraint.y - topPos) < Math.abs(constraint.y - bottomPos)) {
- posY = topPos;
- } else {
- posY = bottomPos;
- }
- child.setBounds(new Rectangle(posX, posY, preferredSize.width, preferredSize.height));
- x = posX + preferredSize.width;
- lastOccurrenceX = x;
- }
- }
- // StateInvariant
- else if(stateInvariantFigure != null) {
- final Dimension preferredSize = stateInvariantFigure.getPreferredSize();
- final int height = Math.min(preferredSize.height, clientArea.height);
-
- final int width;
- // the StateInvariant stops where the next state change occurrence begins
- final IFigure nextStateChangeOccurrence = findNextStateChangeOccurrence(children, i + 1);
- if(nextStateChangeOccurrence != null) {
- stateInvariantFigure.setInfinite(false);
- currentStateInvariantInfinite = false;
- width = ((Rectangle)getConstraint(nextStateChangeOccurrence)).x - x;
- } else if(destruction) {
- stateInvariantFigure.setInfinite(false);
- currentStateInvariantInfinite = false;
- width = destructionX - x;
- } else {
- stateInvariantFigure.setInfinite(true);
- currentStateInvariantInfinite = true;
- // if the StateInvariant is the last element, then it continues until the end
- width = clientArea.width - x;
- }
- child.setBounds(new Rectangle(x, centerY - height / 2, width, height));
- currentStateInvariantX = x;
- currentStateInvariantWidth = width;
- currentStateInvariantHeight = height;
- x += width;
- } else if(verticalMarkFigure != null) {
- // time observation or constraint
- final Dimension size = verticalMarkFigure.getPreferredSize();
- final int margin = 3;
- // put it right above the StateInvariants
- final int y = centerY - CompactStateFigure.PREFERRED_HEIGHT / 2 - VerticalMarkFigure.PREFERRED_HEIGHT - margin;
- child.setBounds(new Rectangle(constraint.x, y, size.width, size.height));
- } else if(dimensioningArrowFigure != null) {
- // duration observation or constraint
- final Dimension size = dimensioningArrowFigure.getPreferredSize();
- if(constraint.width == Integer.MAX_VALUE) {
- // it has no end => set the right side of the compartment as the end
- child.setBounds(new Rectangle(constraint.x, constraint.y, clientArea.width - constraint.x, size.height));
- } else {
- child.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
- }
- } else if(generalOrderingHorizontalFigure != null) {
- // general ordering
- final Dimension size = generalOrderingHorizontalFigure.getPreferredSize();
- child.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
-
- return figure;
- }
-
- protected static IFigure getOccurrenceChild(final IFigure child) {
- IFigure occurrenceFigure = FigureUtils.findChildFigureInstance(child, SmallSquareFigure.class);
- if(occurrenceFigure == null) {
- occurrenceFigure = FigureUtils.findChildFigureInstance(child, CrossFigure.class);
- }
- return occurrenceFigure;
- }
-
- protected static IFigure findNextStateChangeOccurrence(final List<IFigure> children, final int startIndex) {
- for(int i = startIndex; i < children.size() - 1; i++) {
- final IFigure figure1 = children.get(i);
- final IFigure figure2 = children.get(i + 1);
- // an OccurrenceSpecification followed by a StateInvariant means a state change
- if(getOccurrenceChild(figure1) != null && FigureUtils.findChildFigureInstance(figure2, CompactStateFigure.class) != null) {
- return figure1;
- }
- }
- return null;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-
- @Override
- public Command getCommand(final Request request) {
- // redirect connection requests to the Lifeline (for MessageLost and MessageFound)
- if(request instanceof CreateConnectionRequest) {
- final CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest)request;
- if(RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
- if(createConnectionRequest.getTargetEditPart() instanceof CompactLifelineCompartmentEditPartCN) {
- createConnectionRequest.setTargetEditPart(getParent());
- }
- return getParent().getCommand(request);
- } else if(RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
- if(createConnectionRequest.getSourceEditPart() instanceof CompactLifelineCompartmentEditPartCN) {
- createConnectionRequest.setSourceEditPart(getParent());
- }
- return getParent().getCommand(request);
- }
- }
- return super.getCommand(request);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java
deleted file mode 100644
index 3af3202be66..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.XYAnchor;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.FloatingMessageAnchor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-
-public class CustomCompactLifelineEditPartCN extends CompactLifelineEditPartCN {
-
- public CustomCompactLifelineEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public void setSelected(final int value) {
- super.setSelected(value);
- // set selection on figure
- final CompactLifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(getFigure(), CompactLifelineFigure.class);
- lifelineFigure.setSelected(value != EditPart.SELECTED_NONE);
- // repaint
- getFigure().getParent().repaint();
- }
-
- @Override
- protected NodeFigure createNodeFigure() {
- final NodeFigure nodeFigure = super.createNodeFigure();
- final CompactLifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(nodeFigure, CompactLifelineFigure.class);
- // collapses the time ruler rectangle if the time ruler is not used
- lifelineFigure.getLifelineDataContainerFigure().setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- final int timeRulerHeight = Constants.TIME_RULER_HEIGHT;
- final boolean displayTimeRuler = lifelineFigure.isDisplayTimeRuler();
- final Rectangle clientArea = container.getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- if(child == lifelineFigure.getTimelineContainerFigure()) {
- if(displayTimeRuler) {
- child.setBounds(new Rectangle(clientArea).getResized(0, -timeRulerHeight));
- } else {
- child.setBounds(clientArea);
- }
- } else if(child == lifelineFigure.getTimeRulerContainerFigure()) {
- if(displayTimeRuler) {
- final Rectangle bounds = new Rectangle(clientArea);
- bounds.height = timeRulerHeight;
- bounds.y = clientArea.y + clientArea.height - timeRulerHeight;
- child.setBounds(bounds);
- } else {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height, clientArea.width, 0));
- }
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
- return nodeFigure;
- }
-
- @Override
- public DragTracker getDragTracker(final Request request) {
- // lock the drag to the containing compartment
- return new DragEditPartsTrackerEx(this) {
-
- @Override
- protected boolean handleDragStarted() {
- lockTargetEditPart(CustomCompactLifelineEditPartCN.this.getParent());
- return super.handleDragStarted();
- }
- };
- }
-
- @Override
- public ConnectionAnchor getTargetConnectionAnchor(final ConnectionEditPart connEditPart) {
- return new FloatingMessageAnchor(connEditPart, new Point(15, -15));
- }
-
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(final ConnectionEditPart connEditPart) {
- return new FloatingMessageAnchor(connEditPart, new Point(-15, 15));
- }
-
- /** Display feedback at the start location (where the create request was started) */
- @Override
- public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
- if(request instanceof CreateRequest) {
- return new XYAnchor(MessageUtils.getLastStartLocation());
- }
- return super.getTargetConnectionAnchor(request);
- }
-
- /** Display feedback at the cursor location */
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
- if(request instanceof LocationRequest) {
- final LocationRequest locationRequest = (LocationRequest)request;
- return new XYAnchor(locationRequest.getLocation());
- }
- return super.getTargetConnectionAnchor(request);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java
deleted file mode 100644
index 364c5509d55..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.TimeRulerLayout;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineTimeRulerCompartmentEditPartCN;
-
-public class CustomCompactLifelineTimeRulerCompartmentEditPartCN extends CompactLifelineTimeRulerCompartmentEditPartCN implements EditPart {
-
- public CustomCompactLifelineTimeRulerCompartmentEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setBorder(null);
- result.setTitleVisibility(false);
- result.setLayoutManager(new FillLayout());
- result.getContentPane().setLayoutManager(new TimeRulerLayout());
- return result;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java
deleted file mode 100644
index 9f0faf04bfc..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-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.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCompactLifelineCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateInvariantAppliedStereotypeEditPart;
-import org.eclipse.uml2.uml.StateInvariant;
-
-public class CustomCompactStateInvariantEditPartCN extends CompactStateInvariantEditPartCN {
-
- public CustomCompactStateInvariantEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public void performRequest(final Request request) {
- // allow creating an OccurrenceSpecification when double-clicking on a StateInvariant line
- // (in addition to the OccurrenceSpecification creation tool from the palette)
- if(request.getType() == REQ_OPEN && request instanceof LocationRequest) {
- final StateInvariant stateInvariant = (StateInvariant)((View)getModel()).getElement();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
- // shift by 2 pixels to cut at the center of the OccurrenceSpecification
- final Point loc = new Point(((LocationRequest)request).getLocation()).translate(-SmallSquareFigure.RADIUS, 0);
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.CustomCompactStateInvariantEditPartCN_CreateOccurrenceSpecification);
- compositeCommand.add(new CutAndInsertOccurrenceSpecificationCompactLifelineCommand(this, loc, false));
- final EditPart timeline = EditPartUtils.findParentEditPartWithId(this, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- final Command updateLayoutCommand = timeline.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
- compositeCommand.add(new CommandProxy(updateLayoutCommand));
- editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(compositeCommand));
- } else {
- super.performRequest(request);
- }
- }
-
- @Override
- protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof StateInvariantAppliedStereotypeEditPart) {
- final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH) {
-
- @Override
- public int getPreferredSideOfParent() {
- /*
- * Avoids an infinite layout bug that makes the UI thread freeze indefinitely, because
- * BorderItemLocator continuously switches from PositionConstants.TOP to PositionConstants.MIDDLE.
- */
- return PositionConstants.TOP;
- }
- };
- locator.setBorderItemOffset(new Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java
deleted file mode 100644
index 7e29568ca08..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.CompactStateInvariantNameParser;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantNameEditPart;
-
-public class CustomCompactStateInvariantNameEditPart extends CompactStateInvariantNameEditPart {
-
- private IParser parser;
-
- public CustomCompactStateInvariantNameEditPart(final View view) {
- super(view);
- }
-
- @Override
- public void performRequest(final Request request) {
- if(request.getType() == REQ_OPEN) {
- // double-click on the label is handled by the parent (to cut the CompactStateInvariant)
- getParent().performRequest(request);
- } else {
- super.performRequest(request);
- }
- }
-
- @Override
- public IParser getParser() {
- if(this.parser == null) {
- this.parser = new CompactStateInvariantNameParser();
- }
- return this.parser;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java
deleted file mode 100644
index 68867e161a2..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
-
-public class CustomDestructionOccurrenceSpecificationEditPartCN extends DestructionOccurrenceSpecificationEditPartCN {
-
- public CustomDestructionOccurrenceSpecificationEditPartCN(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java
deleted file mode 100644
index e26c8bffc85..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.OccurrenceSpecificationNameParser;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
-
-public class CustomDestructionOccurrenceSpecificationLabelEditPart extends DestructionOccurrenceSpecificationLabelEditPart {
-
- private IParser parser;
-
- public CustomDestructionOccurrenceSpecificationLabelEditPart(final View view) {
- super(view);
- }
-
- @Override
- public IParser getParser() {
- if(this.parser == null) {
- this.parser = new OccurrenceSpecificationNameParser();
- }
- return this.parser;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java
deleted file mode 100644
index 80af177a20d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintSpecificationEditPart;
-
-public class CustomDurationConstraintEditPart extends DurationConstraintEditPartCN {
-
- public CustomDurationConstraintEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(DurationConstraintSpecificationEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java
deleted file mode 100644
index 85f53e373ec..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationNameEditPart;
-
-public class CustomDurationObservationEditPart extends DurationObservationEditPartCN {
-
- public CustomDurationObservationEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(DurationObservationNameEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java
deleted file mode 100644
index 457f2e5b81d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.diagram.ui.layout.FreeFormLayoutEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.InteractionRectangleFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CrossFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TickUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimeRulerCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
-
-public class CustomFreeTimeRulerCompartmentEditPart extends FreeTimeRulerCompartmentEditPart {
-
- public CustomFreeTimeRulerCompartmentEditPart(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setTitleVisibility(false);
- result.setBorder(null);
- result.getScrollPane().setBorder(null);
- result.setLayoutManager(new FreeFormLayoutEx() {
-
- @Override
- public void layout(final IFigure container) {
- try {
- layoutTicks(container);
- } catch (final Exception e) {
- Activator.log.error("Error in ticks layout", e); //$NON-NLS-1$
- }
- }
- });
- return result;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-
- protected void layoutTicks(final IFigure container) {
- final EditPartViewer viewer = CustomFreeTimeRulerCompartmentEditPart.this.getRoot().getViewer();
-
- @SuppressWarnings("unchecked")
- final Map<IFigure, EditPart> visualPartMap = viewer.getVisualPartMap();
- final InteractionRectangleFigure interactionFigure = FigureUtils.findParentFigureInstance(container, InteractionRectangleFigure.class);
- final List<SmallSquareFigure> osFigures = FigureUtils.findChildFigureInstances(interactionFigure, SmallSquareFigure.class);
- final List<CrossFigure> destructionOSFigures = FigureUtils.findChildFigureInstances(interactionFigure, CrossFigure.class);
-
- final List<EditPart> osEditParts = new ArrayList<EditPart>();
-
- for(final SmallSquareFigure figure : osFigures) {
- final EditPart editPart = visualPartMap.get(FigureUtils.findParentFigureInstance(figure, BorderedNodeFigure.class));
- if(editPart != null) {
- osEditParts.add(editPart);
- }
- }
- for(final CrossFigure figure : destructionOSFigures) {
- final EditPart editPart = visualPartMap.get(FigureUtils.findParentFigureInstance(figure, BorderedNodeFigure.class));
- if(editPart != null) {
- osEditParts.add(editPart);
- }
- }
-
- // reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- if(!(container.getParent().getLayoutManager() instanceof FillLayout)) {
- container.getParent().setLayoutManager(new FillLayout());
- }
-
- // The grand-parent is a FreeformViewport, which lets its child expand outside of its clientArea, and
- // constantly resets the bounds (in org.eclipse.draw2d.FreeformViewport#readjustScrollBars)
- // So, layout based on the grand-parent's clientArea.
- // final Rectangle clientArea = container.getParent().getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
-
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- final List<BorderedNodeFigure> marks = FigureUtils.findChildFigureInstances(child, BorderedNodeFigure.class);
- for(final BorderedNodeFigure verticalMarkFigure : marks) {
- final boolean compactLifeline = FigureUtils.findParentFigureInstance(verticalMarkFigure, CompactLifelineFigure.class) != null;
- final boolean fullLifeline = FigureUtils.findParentFigureInstance(verticalMarkFigure, FullLifelineFigure.class) != null;
- final TickEditPart tickEditPart = (TickEditPart)visualPartMap.get(verticalMarkFigure);
- final IGraphicalEditPart occurrenceSpecificationEditPart = TickUtils.findOccurrenceSpecificationEditPartFromTickEditPart(tickEditPart, viewer);
- if(occurrenceSpecificationEditPart != null) {
- final CompartmentEditPart timelineCompartment = EditPartUtils.findParentTimelineCompartment(occurrenceSpecificationEditPart);
- final GraphicalEditPart interactionEditPart = (InteractionEditPartTN)EditPartUtils.findParentEditPartWithId(timelineCompartment, InteractionEditPartTN.VISUAL_ID);
- final int startX;
- if(fullLifeline) {
- startX = Constants.STATE_DEFINITIONS_WIDTH + 1;
- } else if(compactLifeline) {
- startX = 1;
- } else {
- startX = timelineCompartment.getFigure().getBounds().x - interactionEditPart.getFigure().getBounds().x;
- }
- final Dimension markSize = verticalMarkFigure.getPreferredSize();
- final IFigure osFigure = occurrenceSpecificationEditPart.getFigure();
- final Rectangle osBounds = osFigure.getBounds();
- verticalMarkFigure.setBounds(new Rectangle(startX + osBounds.x - 1, 0, markSize.width, markSize.height));
- }
- }
- }
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java
deleted file mode 100644
index bb5f4faf5a6..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ScrollPane;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ShapeCompartmentFigure;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.TimingRulerFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimingRulerEditPartCN;
-
-public class CustomFreeTimingRulerEditPart extends FreeTimingRulerEditPartCN {
-
- public CustomFreeTimingRulerEditPart(final View view) {
- super(view);
- }
-
- @Override
- protected IFigure createNodeShape() {
- this.primaryShape = new TimingRulerFigure();
- this.primaryShape.setLayoutManager(new FillLayout() {
-
- @Override
- public void layout(final IFigure container) {
- for(final Object child : container.getChildren()) {
- ((IFigure)child).setBounds(container.getBounds());
- }
- final ShapeCompartmentFigure compartmentFigure = FigureUtils.findChildFigureInstance(container, ShapeCompartmentFigure.class);
- if(compartmentFigure != null) {
- for(final Object child : compartmentFigure.getChildren()) {
- if(child instanceof ScrollPane) {
- ((ScrollPane)child).setBounds(container.getBounds());
- // ((ScrollPane) child).setBorder(null);
- ((ScrollPane)child).setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- // ((ScrollPane) child).getViewport().setBounds(container.getBounds());
- }
- }
- compartmentFigure.setBounds(container.getBounds());
- }
- }
- });
-
- return this.primaryShape;
- }
-
- @Override
- public boolean isSelectable() {
- return false;
- }
-
- @Override
- public DragTracker getDragTracker(final Request request) {
- // lock the drag to the containing compartment
- return new DragEditPartsTrackerEx(this) {
-
- @Override
- protected boolean handleDragStarted() {
- lockTargetEditPart(CustomFreeTimingRulerEditPart.this.getParent());
- return super.handleDragStarted();
- }
- };
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java
deleted file mode 100644
index 10045576637..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.XYAnchor;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.FloatingMessageAnchor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-
-public class CustomFullLifelineEditPartCN extends FullLifelineEditPartCN {
-
- public CustomFullLifelineEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public void setSelected(final int value) {
- super.setSelected(value);
- // set selection on figure
- final FullLifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(getFigure(), FullLifelineFigure.class);
- lifelineFigure.setSelected(value != EditPart.SELECTED_NONE);
- // repaint
- getFigure().getParent().repaint();
- }
-
- @Override
- protected NodeFigure createNodeFigure() {
- final NodeFigure nodeFigure = super.createNodeFigure();
- final FullLifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(nodeFigure, FullLifelineFigure.class);
- // collapses the time ruler rectangle if the time ruler is not used
- lifelineFigure.getLifelineDataContainerFigure().setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- final int timeRulerHeight = Constants.TIME_RULER_HEIGHT;
- final boolean displayTimeRuler = lifelineFigure.isDisplayTimeRuler();
- final Rectangle clientArea = container.getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- if(child == lifelineFigure.getChronogramContainerFigure()) {
- if(displayTimeRuler) {
- child.setBounds(new Rectangle(clientArea).getResized(0, -timeRulerHeight));
- } else {
- child.setBounds(clientArea);
- }
- } else if(child == lifelineFigure.getTimeRulerContainerFigure()) {
- if(displayTimeRuler) {
- final Rectangle bounds = new Rectangle(clientArea);
- bounds.height = timeRulerHeight;
- bounds.y = clientArea.y + clientArea.height - timeRulerHeight;
- child.setBounds(bounds);
- } else {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height, clientArea.width, 0));
- }
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
- return nodeFigure;
- }
-
- @Override
- public DragTracker getDragTracker(final Request request) {
- // lock the drag to the containing compartment
- return new DragEditPartsTrackerEx(this) {
-
- @Override
- protected boolean handleDragStarted() {
- lockTargetEditPart(CustomFullLifelineEditPartCN.this.getParent());
- return super.handleDragStarted();
- }
- };
- }
-
- @Override
- public ConnectionAnchor getTargetConnectionAnchor(final ConnectionEditPart connEditPart) {
- return new FloatingMessageAnchor(connEditPart, new Point(20, -20));
- }
-
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(final ConnectionEditPart connEditPart) {
- return new FloatingMessageAnchor(connEditPart, new Point(-20, 20));
- }
-
- /** Display feedback at the start location (where the create request was started) */
- @Override
- public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
- if(request instanceof CreateRequest) {
- return new XYAnchor(MessageUtils.getLastStartLocation());
- }
- return super.getTargetConnectionAnchor(request);
- }
-
- /** Display feedback at the cursor location */
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
- if(request instanceof LocationRequest) {
- final LocationRequest locationRequest = (LocationRequest)request;
- return new XYAnchor(locationRequest.getLocation());
- }
- return super.getTargetConnectionAnchor(request);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java
deleted file mode 100644
index a58cc7cb9a9..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.draw2d.XYLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
-
-public class CustomFullLifelineStateDefinitionCompartmentEditPartCN extends FullLifelineStateDefinitionCompartmentEditPartCN {
-
- private WrappingLabel stateDefsAffordanceLabel;
-
- public CustomFullLifelineStateDefinitionCompartmentEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setBorder(null);
- result.getScrollPane().getContents().setBorder(null);
-
- result.setLayoutManager(new StackLayout());
-
- // layout StateDefinitions so that they are regularly spaced and fill the whole height
- result.getContentPane().setLayoutManager(new XYLayout() {
-
- @Override
- public void layout(final IFigure container) {
- // reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- if(!(container.getParent().getLayoutManager() instanceof FillLayout)) {
- container.getParent().setLayoutManager(new FillLayout());
- }
-
- // The grand-parent is a FreeformViewport, which lets its child expand outside of its clientArea, and
- // constantly resets the bounds (in org.eclipse.draw2d.FreeformViewport#readjustScrollBars)
- // So, layout based on the grand-parent's clientArea.
- final Rectangle clientArea = container.getParent().getClientArea();
- final int nChildren = container.getChildren().size();
- final int margin;
- final int spacing;
- if(nChildren == 1) {
- margin = clientArea.height / 2;
- spacing = 0;
- } else {
- margin = clientArea.height / (nChildren - 1) / 3;
- spacing = (clientArea.height - 2 * margin) / (nChildren - 1);
- }
-
- for(int i = 0; i < nChildren; i++) {
- final IFigure child = (IFigure)container.getChildren().get(i);
- final Dimension ps = child.getPreferredSize();
- final int w = ps.width;
- // the height is twice as big as needed by default
- final int h = ps.height / 2;
- final int x = clientArea.x + clientArea.width / 2 - w / 2;
- final int y = clientArea.y + margin + spacing * i - h / 2;
- child.setBounds(new Rectangle(x, y, w, h));
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return null;
- }
- });
- result.setTitleVisibility(false);
- createStateDefsAffordanceLabel(result);
- return result;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-
- /**
- * Display a Label when there are no StateDefinitions, so that the user knows that they must add at least a
- * StateDefinition.
- */
- private void createStateDefsAffordanceLabel(final IFigure parent) {
- this.stateDefsAffordanceLabel = new WrappingLabel();
- this.stateDefsAffordanceLabel.setTextWrap(true);
- this.stateDefsAffordanceLabel.setAlignment(PositionConstants.CENTER);
- this.stateDefsAffordanceLabel.setTextJustification(PositionConstants.CENTER);
- this.stateDefsAffordanceLabel.setText(Messages.CustomFullLifelineStateDefinitionCompartmentEditPartCN_AddStateDefinitionsHere);
- this.stateDefsAffordanceLabel.setForegroundColor(ColorConstants.gray);
- parent.add(this.stateDefsAffordanceLabel);
- this.stateDefsAffordanceLabel.setBounds(new Rectangle(parent.getBounds()));
- this.stateDefsAffordanceLabel.setVisible(false);
- }
-
- @Override
- protected void refreshChildren() {
- super.refreshChildren();
- this.stateDefsAffordanceLabel.setVisible(getChildren().size() == 0);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java
deleted file mode 100644
index 71fd2b5b84b..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.TimeRulerLayout;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimeRulerCompartmentEditPartCN;
-
-public class CustomFullLifelineTimeRulerCompartmentEditPartCN extends FullLifelineTimeRulerCompartmentEditPartCN implements EditPart {
-
- public CustomFullLifelineTimeRulerCompartmentEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setBorder(null);
- result.setTitleVisibility(false);
- result.setLayoutManager(new FillLayout());
- result.getContentPane().setLayoutManager(new TimeRulerLayout());
- return result;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java
deleted file mode 100644
index a80ee321816..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.draw2d.FreeformViewport;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.CreateConnectionRequest;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.diagram.ui.layout.FreeFormLayoutEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CrossFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.DimensioningArrowFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullStateFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullStateInvariantVerticalLineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.GeneralOrderingHorizontalFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-import org.eclipse.uml2.uml.StateInvariant;
-
-public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelineTimelineCompartmentEditPartCN {
-
- public CustomFullLifelineTimelineCompartmentEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure figure = (ResizableCompartmentFigure)super.createFigure();
- figure.setBorder(null);
- figure.getScrollPane().setBorder(null);
- figure.setLayoutManager(new FillLayout());
-
- figure.getContentPane().setLayoutManager(new FreeFormLayoutEx() {
-
- @Override
- public void layout(final IFigure container) {
- final EditPartViewer viewer = CustomFullLifelineTimelineCompartmentEditPartCN.this.getRoot().getViewer();
- // reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- final IFigure parent = container.getParent();
- if(parent instanceof FreeformViewport) {
- final FreeformViewport freeformViewport = (FreeformViewport)parent;
- if(!(freeformViewport.getLayoutManager() instanceof FillLayout)) {
- freeformViewport.setLayoutManager(new FillLayout());
- }
- // reset the origin if it changed (for example, clicking on a label partly
- // outside the compartment reveals it by scrolling)
- freeformViewport.setViewLocation(0, 0);
- }
-
- // The grand-parent is a FreeformViewport, which lets its child expand outside of its clientArea, and
- // constantly resets the bounds (in org.eclipse.draw2d.FreeformViewport#readjustScrollBars)
- // So, layout based on the grand-parent's clientArea.
- final Rectangle clientArea = container.getParent().getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- final Rectangle[] constraints = new Rectangle[children.size()];
- for(int i = 0; i < children.size(); i++) {
- constraints[i] = (Rectangle)getConstraint(children.get(i));
- }
-
- /*
- * This is a 2-pass layout: first, layout the OccurrenceSpecifications and StateInvariants. Then, layout
- * the VerticalLines, which depend on the bounds of both its previous and following element
- * StateInvariants, and the time elements.
- */
- layoutOccurrenceSpecificationsAndStateInvariants(viewer, clientArea, children, constraints);
- layoutVerticalLinesAndTimeElements(children, clientArea, constraints);
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
-
- return figure;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-
- @Override
- public Command getCommand(final Request request) {
- // redirect connection requests to the Lifeline (for MessageLost and MessageFound)
- if(request instanceof CreateConnectionRequest) {
- final CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest)request;
- if(RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
- if(createConnectionRequest.getTargetEditPart() instanceof FullLifelineTimelineCompartmentEditPartCN) {
- createConnectionRequest.setTargetEditPart(getParent());
- }
- return getParent().getCommand(request);
- } else if(RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
- if(createConnectionRequest.getSourceEditPart() instanceof FullLifelineTimelineCompartmentEditPartCN) {
- createConnectionRequest.setSourceEditPart(getParent());
- }
- return getParent().getCommand(request);
- }
- }
- return super.getCommand(request);
- }
-
- /** First pass of the layout */
- protected static void layoutOccurrenceSpecificationsAndStateInvariants(final EditPartViewer viewer, final Rectangle clientArea, final List<IFigure> figures, final Rectangle[] constraints) {
-
- int x = clientArea.x;
- int y = -1;
- int prevY = -1;
- Rectangle nextConstraint = null;
- IFigure nextFigure = null;
- IFigure nextChildFigure = null;
- for(int i = 0; i < figures.size(); i++) {
- final IFigure figure = figures.get(i);
- final FullStateFigure stateInvariantFigure = FigureUtils.findChildFigureInstance(figure, FullStateFigure.class);
- final SmallSquareFigure smallSquareFigure = FigureUtils.findChildFigureInstance(figure, SmallSquareFigure.class);
- final CrossFigure crossFigure = FigureUtils.findChildFigureInstance(figure, CrossFigure.class);
-
- if(stateInvariantFigure == null && smallSquareFigure == null && crossFigure == null) {
- continue;
- }
-
- // This is the bounds that the user tries to set. We further constrain these bounds.
- final Rectangle constraint = constraints[i];
-
- nextConstraint = null;
- nextFigure = null;
- for(int j = i + 1; j < figures.size(); j++) {
- final IFigure f = figures.get(j);
- nextChildFigure = FigureUtils.findChildFigureInstance(f, FullStateFigure.class);
- if(nextChildFigure == null) {
- nextChildFigure = FigureUtils.findChildFigureInstance(f, SmallSquareFigure.class);
- }
- if(nextChildFigure == null) {
- nextChildFigure = FigureUtils.findChildFigureInstance(f, CrossFigure.class);
- }
- if(nextChildFigure != null) {
- nextConstraint = constraints[j];
- nextFigure = f;
- break;
- }
- }
-
- IFigure occurrenceFigure = null;
- if(smallSquareFigure != null) {
- occurrenceFigure = smallSquareFigure;
- } else if(crossFigure != null) {
- occurrenceFigure = crossFigure;
- }
-
- // OccurrenceSpecification, MessageOccurrenceSpecification or DestructionOccurrenceSpecification
- if(occurrenceFigure != null) {
- final int occurrenceY;
- if(y == -1) {
- // the Lifeline starts by an OccurrenceSpecification => align it with the following StateInvariant
- if(nextChildFigure instanceof FullStateFigure) {
- occurrenceY = computeVerticalPosition(nextFigure, viewer);
- } else {
- Activator.log.warn("The Lifeline starts by an OccurrenceSpecification not followed by a StateInvariant"); //$NON-NLS-1$
- occurrenceY = 10;
- }
- } else {
- occurrenceY = y;
- }
-
- // set the OccurrenceSpecification y-coordinate to the one from the previous StateInvariant
- // keep the x-coordinate as-is
- final Dimension preferredSize = occurrenceFigure.getPreferredSize();
- figure.setBounds(new Rectangle(constraint.x, occurrenceY - preferredSize.height / 2, preferredSize.width, preferredSize.height));
- x = constraint.x + preferredSize.width;
- }
-
- // StateInvariant
- if(stateInvariantFigure != null) {
- final int computedY = computeVerticalPosition(figure, viewer);
- stateInvariantFigure.setPosY(computedY);
-
- if(y == -1) {
- // first state invariant
- prevY = computedY;
- } else {
- prevY = y;
- }
-
- y = computedY;
-
- final int width;
- if(nextConstraint != null) {
- // the StateInvariant stops where the next occurrence begins
- width = nextConstraint.x - x;
- } else {
- // if the StateInvariant is the last element, then it continues until the end
- width = clientArea.width - x;
- }
-
- if(prevY == y) {
- // a StateInvariant on the right of an OccurrenceSpecification (or at the beginning)
- figure.setBounds(new Rectangle(x, y - 5, width, 10));
- } else {
- // a StateInvariant on the top or bottom of the previous OccurrenceSpecification
- // => shift the line to eliminate the seam with the vertical line which is shifted too
- figure.setBounds(new Rectangle(x - SmallSquareFigure.RADIUS - 1, y - 5, width + SmallSquareFigure.RADIUS + 1, 10));
- }
- x += width;
- }
- }
- }
-
- private static int computeVerticalPosition(final IFigure stateInvariantFigure, final EditPartViewer viewer) {
- @SuppressWarnings("unchecked")
- final Map<IFigure, EditPart> visualPartMap = viewer.getVisualPartMap();
- final CustomFullStateInvariantEditPartCN stateInvariantEditPart = (CustomFullStateInvariantEditPartCN)visualPartMap.get(stateInvariantFigure);
- final View stateInvariantView = (View)stateInvariantEditPart.getModel();
- final StateInvariant stateInvariant = (StateInvariant)stateInvariantView.getElement();
- final String id = StateInvariantUtils.getStateInvariantId(stateInvariant);
- if(id == null) {
- Activator.log.error("null id for a StateInvariant", new Exception()); //$NON-NLS-1$
- return -1;
- }
-
- final View lifelineView = StateDefinitionUtils.getParentLifelineView(stateInvariantView);
- final View stateDefinition = StateDefinitionUtils.getStateDefinitionViewWithId(id, lifelineView);
- if(stateDefinition == null) {
- Activator.log.error("No StateDefinition found for the StateInvariant (id = " + id + ")", new Exception()); //$NON-NLS-1$//$NON-NLS-2$
- return -1;
- }
-
- final StateDefinitionEditPart stateDefinitionEditPart = (StateDefinitionEditPart)viewer.getEditPartRegistry().get(stateDefinition);
- final IFigure stateDefinitionFigure = stateDefinitionEditPart.getFigure();
- final Rectangle bounds = stateDefinitionFigure.getBounds();
- final int parentY = stateDefinitionFigure.getParent().getClientArea().y;
- return bounds.y + bounds.height / 2 - parentY;
- }
-
- /**
- * Second pass of the layout: layout the VerticalLines, which depend on the bounds of both their previous and
- * following StateInvariants, the time elements, which can be bound to an OccurrenceSpecification or StateInvariant,
- * and the GeneralOrderings, which can be linked to OccurrenceSpecifications.
- */
- protected static void layoutVerticalLinesAndTimeElements(final List<IFigure> figures, final Rectangle clientArea, final Rectangle[] constraints) {
-
- IFigure previousFigure = null;
- IFigure nextFigure = null;
- for(int i = 0; i < figures.size(); i++) {
- final IFigure figure = figures.get(i);
- final FullStateInvariantVerticalLineFigure verticalLineFigure = FigureUtils.findChildFigureInstance(figure, FullStateInvariantVerticalLineFigure.class);
- final VerticalMarkFigure verticalMarkFigure = FigureUtils.findChildFigureInstance(figure, VerticalMarkFigure.class);
- final DimensioningArrowFigure dimensioningArrowFigure = FigureUtils.findChildFigureInstance(figure, DimensioningArrowFigure.class);
- final GeneralOrderingHorizontalFigure generalOrderingHorizontalFigure = FigureUtils.findChildFigureInstance(figure, GeneralOrderingHorizontalFigure.class);
-
- nextFigure = null;
- if(i < figures.size() - 1) {
- nextFigure = figures.get(i + 1);
- }
-
- // This is the bounds that the user tries to set. We further constrain these bounds.
- final Rectangle constraint = constraints[i];
-
- // VerticalLine
- if(verticalLineFigure != null) {
- boolean showVerticalLine = false;
- if(nextFigure != null && previousFigure != null) {
- final Rectangle prev = previousFigure.getBounds();
- final int y = prev.y + prev.height / 2;
- final int x = prev.x + prev.width / 2;
- final Rectangle next = nextFigure.getBounds();
- final int y2 = next.y + next.height / 2;
- int y1 = y;
- final int sign = (int)Math.signum(y2 - y1);
- // move the start of the line outside the OccurrenceSpecification
- y1 += sign * (previousFigure.getBounds().height / 2);
- if(y != y2) {
- showVerticalLine = true;
- }
- final int verticalLineBoxWidth = 10;
- figure.setBounds(new Rectangle(x - verticalLineBoxWidth / 2, Math.min(y1, y2), verticalLineBoxWidth, Math.abs(y2 - y1)));
- } else {
- Activator.log.warn("VerticalLine not between two Figures"); //$NON-NLS-1$
- }
- figure.setVisible(showVerticalLine);
- } else if(verticalMarkFigure != null) {
- // time observation or constraint
- final Dimension size = verticalMarkFigure.getPreferredSize();
- figure.setBounds(new Rectangle(constraint.x, constraint.y, size.width, size.height));
- } else if(dimensioningArrowFigure != null) {
- // duration observation or constraint
- final Dimension size = dimensioningArrowFigure.getPreferredSize();
- if(constraint.width == Integer.MAX_VALUE) {
- // it has no end => set the right side of the compartment as the end
- figure.setBounds(new Rectangle(constraint.x, constraint.y, clientArea.width - constraint.x, size.height));
- } else {
- figure.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
- }
- } else if(generalOrderingHorizontalFigure != null) {
- // general ordering
- final Dimension size = generalOrderingHorizontalFigure.getPreferredSize();
- figure.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
- }
-
- previousFigure = figure;
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java
deleted file mode 100644
index ce6f13589db..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-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.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.RequestUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class CustomFullStateInvariantEditPartCN extends FullStateInvariantEditPartCN {
-
- public CustomFullStateInvariantEditPartCN(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- @Override
- public void performRequest(final Request request) {
- // allow creating an OccurrenceSpecification when double-clicking on a StateInvariant line
- // (in addition to the OccurrenceSpecification creation tool from the palette)
- if(request.getType() == REQ_OPEN && request instanceof LocationRequest) {
- final StateInvariant stateInvariant = (StateInvariant)((View)getModel()).getElement();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
- // shift by 2 pixels to cut at the center of the OccurrenceSpecification
- final Point loc = new Point(((LocationRequest)request).getLocation()).translate(-SmallSquareFigure.RADIUS, 0);
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.CustomFullStateInvariantEditPartCN_CreateOccurrenceSpecification);
- compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(this, loc, false));
- final EditPart timeline = EditPartUtils.findParentEditPartWithId(this, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- final Command updateLayoutCommand = timeline.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
- compositeCommand.add(new CommandProxy(updateLayoutCommand));
- editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(compositeCommand));
- } else {
- super.performRequest(request);
- }
- }
-
- @Override
- public Command getCommand(final Request request) {
- if(request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- // we allow moving an OccurrenceSpecification on top of a StateInvariant line
- // in this case, we redirect the request to the parent timeline compartment
- if(RequestUtils.isChangeBoundsRequestFor(changeBoundsRequest, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- return getTimelineCompartmentEditPart().getCommand(request);
- }
- } else if(request instanceof EditCommandRequestWrapper) {
- // we also need to forward this request, otherwise the feedback figure stays displayed
- final EditCommandRequestWrapper editCommandRequestWrapper = (EditCommandRequestWrapper)request;
- final IEditCommandRequest editCommandRequest = editCommandRequestWrapper.getEditCommandRequest();
- if(editCommandRequest instanceof MoveRequest) {
- final MoveRequest moveRequest = (MoveRequest)editCommandRequest;
- if(moveRequest.getTargetContainer() instanceof StateInvariant) {
- return getTimelineCompartmentEditPart().getCommand(request);
- }
- }
- }
- return super.getCommand(request);
- }
-
- private FullLifelineTimelineCompartmentEditPartCN getTimelineCompartmentEditPart() {
- final FullLifelineTimelineCompartmentEditPartCN timelineEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findParentEditPartWithId(this, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- return timelineEditPart;
- }
-
- @Override
- protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof FullStateInvariantAppliedStereotypeEditPart) {
- final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH) {
-
- @Override
- public int getPreferredSideOfParent() {
- /*
- * Avoids an infinite layout bug that makes the UI thread freeze indefinitely, because
- * BorderItemLocator continuously switches from PositionConstants.TOP to PositionConstants.MIDDLE.
- */
- return PositionConstants.TOP;
- }
- };
- locator.setBorderItemOffset(new Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java
deleted file mode 100644
index 2cbad2317a4..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
-
-public class CustomFullStateInvariantVerticalLineEditPart extends FullStateInvariantVerticalLineEditPart {
-
- public CustomFullStateInvariantVerticalLineEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE || request.getType() == REQ_RECONNECT_TARGET) {
- // don't let the user remove vertical lines, or reconnect anything to a vertical line
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand(request);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java
deleted file mode 100644
index 18dc672871c..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateLabelEditPart;
-
-public class CustomGateEditPart extends GateEditPart {
-
- public CustomGateEditPart(final View view) {
- super(view);
- }
-
- @Override
- protected NodeFigure createNodePlate() {
- // make it a bit larger than the GateFigure itself in order to make it easier to select
- return new DefaultSizeNodeFigure(10, 10);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(GateLabelEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java
deleted file mode 100644
index f975300e85d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingNameEditPart;
-
-public class CustomGeneralOrderingEditPart extends GeneralOrderingEditPart {
-
- public CustomGeneralOrderingEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(GeneralOrderingNameEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java
deleted file mode 100644
index 83a370860e7..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullLifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-
-public class CustomInteractionCompartmentEditPartTN extends InteractionCompartmentEditPartTN {
-
- public CustomInteractionCompartmentEditPartTN(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setTitleVisibility(false);
- result.setBorder(null);
-
- result.setLayoutManager(new FillLayout());
- // each lifeline takes a height proportional to its number of states
- result.getContentPane().setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- final Rectangle clientArea = container.getClientArea();
- final Map<IFigure, Integer> numberOfStates = computeNumberOfStates(children);
- double totalStates = 0;
- for(final Integer nStates : numberOfStates.values()) {
- totalStates += Math.max(nStates.intValue(), 1);
- }
- int y = clientArea.y;
- final int totalHeight = clientArea.height - Constants.MARGIN_BETWEEN_LIFELINES * (children.size() - 1);
- for(final IFigure child : children) {
- final Integer nStates = numberOfStates.get(child);
- if(nStates != null) {
- final int height = (int)(totalHeight * (Math.max(nStates.doubleValue(), 1) / totalStates));
- child.setBounds(new Rectangle(clientArea.x, y, clientArea.width, height));
- y += height + Constants.MARGIN_BETWEEN_LIFELINES;
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
-
- return result;
- }
-
- protected Map<IFigure, Integer> computeNumberOfStates(final List<IFigure> children) {
- final LinkedHashMap<IFigure, Integer> numberOfStatesPerLifeline = new LinkedHashMap<IFigure, Integer>();
- final EditPartViewer viewer = CustomInteractionCompartmentEditPartTN.this.getRoot().getViewer();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- if(FigureUtils.findChildFigureInstance(child, FullLifelineFigure.class) != null) {
- @SuppressWarnings("unchecked")
- final Map<IFigure, EditPart> visualPartMap = viewer.getVisualPartMap();
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)visualPartMap.get(child);
- final View lifelineView = (View)lifelineEditPart.getModel();
- final int nStates = findNumberOfStatesDisplayedIn(lifelineView);
- numberOfStatesPerLifeline.put(child, Integer.valueOf(nStates));
- } else if(FigureUtils.findChildFigureInstance(child, CompactLifelineFigure.class) != null) {
- numberOfStatesPerLifeline.put(child, Integer.valueOf(1));
- } else {
- Activator.log.warn("Only instances of " + FullLifelineFigure.class.getSimpleName() + " are expected in the compartment " + CustomInteractionCompartmentEditPartTN.class.getSimpleName()); //$NON-NLS-1$//$NON-NLS-2$
- continue;
- }
-
- }
- return numberOfStatesPerLifeline;
- }
-
- protected static int findNumberOfStatesDisplayedIn(final View lifelineView) {
- int n = 0;
- final View stateDefinitionCompartment = ViewUtils.findStateDefinitionCompartmentView(lifelineView);
- @SuppressWarnings("unchecked")
- final EList<View> children = stateDefinitionCompartment.getChildren();
- final String stateDefID = Integer.toString(StateDefinitionEditPart.VISUAL_ID);
- for(final View view : children) {
- if(stateDefID.equals(view.getType())) {
- n++;
- }
- }
- return n;
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java
deleted file mode 100644
index ba0a089badc..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-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.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.StereotypePropertiesCompartment;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CustomInteractionRectangleFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-
-public class CustomInteractionEditPartTN extends InteractionEditPartTN {
-
- private static final int HEADER_HEIGHT_PADDING = 4;
-
- private static final int MIN_HEADER_HEIGHT = 21;
-
- public CustomInteractionEditPartTN(final View view) {
- super(view);
- }
-
- @Override
- protected IFigure createNodeShape() {
- final CustomInteractionRectangleFigure interactionRectangleFigure = new CustomInteractionRectangleFigure();
- interactionRectangleFigure.getCompartmentFigure().setOutline(false);
- interactionRectangleFigure.getNameLabel().setVisible(false);
- // disable the shadow because it stays behind after move then Ctrl+Z
- interactionRectangleFigure.setShadow(false);
-
- interactionRectangleFigure.setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- // TODO futur use
- // final boolean displayTimeRuler = interactionRectangleFigure.isDisplayTimeRuler();
- final Rectangle clientArea = container.getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- int consumedHeight = 0;
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- if(child.equals(interactionRectangleFigure.getHeaderLabelContainer())) {
- final int height = Math.max(interactionRectangleFigure.getHeaderLabel().getPreferredSize().height + HEADER_HEIGHT_PADDING, MIN_HEADER_HEIGHT);
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, height));
- consumedHeight = consumedHeight + height;
- } else if(child.equals(interactionRectangleFigure.getCompartmentFigure())) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, clientArea.height - 3 - consumedHeight - Constants.TIME_RULER_HEIGHT));
-
- } else if(child instanceof StereotypePropertiesCompartment) {
- final int height = child.getPreferredSize().height;
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, height));
- consumedHeight += height;
- } else if(child.equals(interactionRectangleFigure.getTimeRulerContainerFigure())) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width, Constants.TIME_RULER_HEIGHT));
- consumedHeight += Constants.TIME_RULER_HEIGHT;
- } else if(i == 0 && !(child instanceof WrappingLabel)) {
- consumedHeight = consumedHeight + child.getPreferredSize().height;
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, consumedHeight));
- } else {
- if(i == 0 && !(child instanceof WrappingLabel)) {
- consumedHeight = consumedHeight + child.getPreferredSize().height;
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, consumedHeight));
- } else {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, 0, 0));
- }
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
-
- return this.primaryShape = interactionRectangleFigure;
- }
-
- @Override
- public Command getCommand(final Request request) {
- // redirect the "drop objects" request to the compartment
- if(request instanceof DropObjectsRequest) {
- final DropObjectsRequest dropObjectsRequest = (DropObjectsRequest)request;
- final EditPart compartment = EditPartUtils.findFirstChildEditPartWithId(this, InteractionCompartmentEditPartTN.VISUAL_ID);
- if(compartment != null) {
- return compartment.getCommand(dropObjectsRequest);
- }
- Activator.log.error(new IllegalStateException("No " + InteractionCompartmentEditPartTN.class.getSimpleName() + " found in the " //$NON-NLS-1$ //$NON-NLS-2$
- + CustomInteractionEditPartTN.class.getSimpleName()));
- }
- return super.getCommand(request);
- }
-
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- final org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- @Override
- protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View)child.getModel();
- final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- // don't let Gates be resized
- if(visualID == GateEditPart.VISUAL_ID) {
- return new BorderItemSelectionEditPolicy();
- }
- return new NonResizableEditPolicy();
- }
-
- @Override
- protected Command getMoveChildrenCommand(final Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(final CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java
deleted file mode 100644
index f844d954929..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.BendpointRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-
-public class CustomMessageFoundEditPart extends MessageFoundEditPart {
-
- public CustomMessageFoundEditPart(final View view) {
- super(view);
- }
-
- @Override
- public Command getCommand(final Request request) {
- if(request instanceof BendpointRequest) {
- // disable bendpoints on MessageFound (to avoid a bug with anchor locations,
- // and because they are not appropriate anyway)
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand(request);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java
deleted file mode 100644
index a489825c531..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.BendpointRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-
-public class CustomMessageLostEditPart extends MessageLostEditPart {
-
- public CustomMessageLostEditPart(final View view) {
- super(view);
- }
-
- @Override
- public Command getCommand(final Request request) {
- if(request instanceof BendpointRequest) {
- // disable bendpoints on MessageLost (to avoid a bug with anchor locations,
- // and because they are not appropriate anyway)
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand(request);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java
deleted file mode 100644
index 93561b580f7..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
-
-public class CustomMessageOccurrenceSpecificationEditPartCN extends MessageOccurrenceSpecificationEditPartCN {
-
- public CustomMessageOccurrenceSpecificationEditPartCN(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java
deleted file mode 100644
index 98cc4f5d681..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.OccurrenceSpecificationNameParser;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
-
-public class CustomMessageOccurrenceSpecificationLabelEditPart extends MessageOccurrenceSpecificationLabelEditPart {
-
- private IParser parser;
-
- public CustomMessageOccurrenceSpecificationLabelEditPart(final View view) {
- super(view);
- }
-
- @Override
- public IParser getParser() {
- if(this.parser == null) {
- this.parser = new OccurrenceSpecificationNameParser();
- }
- return this.parser;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java
deleted file mode 100644
index c5455293011..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
-
-public class CustomOccurrenceSpecificationEditPartCN extends OccurrenceSpecificationEditPartCN {
-
- public CustomOccurrenceSpecificationEditPartCN(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(OccurrenceSpecificationLabelEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java
deleted file mode 100644
index ac828ee1156..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.OccurrenceSpecificationNameParser;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
-
-public class CustomOccurrenceSpecificationLabelEditPart extends OccurrenceSpecificationLabelEditPart {
-
- private IParser parser;
-
- public CustomOccurrenceSpecificationLabelEditPart(final View view) {
- super(view);
- }
-
- @Override
- public IParser getParser() {
- if(this.parser == null) {
- this.parser = new OccurrenceSpecificationNameParser();
- }
- return this.parser;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java
deleted file mode 100644
index 95c4731406a..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.DeleteStateDefinitionCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.StateDefinitionFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.StateInvariant;
-
-public class CustomStateDefinitionEditPart extends StateDefinitionEditPart {
-
- public CustomStateDefinitionEditPart(final View view) {
- super(view);
- }
-
- @Override
- public void setSelected(final int value) {
- super.setSelected(value);
- // set selection on figure
- final StateDefinitionFigure stateDefinitionFigure = FigureUtils.findChildFigureInstance(getFigure(), StateDefinitionFigure.class);
- stateDefinitionFigure.setSelected(value != EditPart.SELECTED_NONE);
- // repaint compartment
- final ResizableCompartmentFigure compartmentFigure = FigureUtils.findParentFigureInstance(getFigure(), ResizableCompartmentFigure.class);
- compartmentFigure.repaint();
- }
-
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(this, FullLifelineEditPartCN.VISUAL_ID);
- final Lifeline lifeline = (Lifeline)((View)lifelineEditPart.getModel()).getElement();
- final View view = (View)getModel();
- final String id = StateDefinitionUtils.getStateDefinitionViewID(view);
- if(lifeline.getInteraction() != null) {
- final List<StateInvariant> stateInvariants = StateInvariantUtils.findStateInvariantsWithId(id, lifeline.getInteraction());
- if(stateInvariants.size() > 0) {
- // cannot delete a StateDefinition used in a StateInvariant
- return UnexecutableCommand.INSTANCE;
- }
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(view);
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomStateDefinitionEditPart_DeleteStateDefinition);
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- compoundCommand.add(new ICommandProxy(new DeleteCommand(editingDomain, view)));
- compoundCommand.add(new ICommandProxy(new DeleteStateDefinitionCommand(id, lifeline, editingDomain)));
- compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
- return compoundCommand;
- }
-
- if(request.getType() == REQ_RECONNECT_TARGET) {
- // don't let the user reconnect anything to a state definition
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand(request);
- }
-
- @Override
- public Object getAdapter(@SuppressWarnings("rawtypes") final Class key) {
- // GMF returns the View by default, but Papyrus expects a semantic element.
- // There is no semantic element, so we return null in order for Papyrus to handle
- // the delete menu action enablement correctly.
- // XXX warning: this might cause unforeseen bugs somewhere else.
- if(key == EObject.class) {
- return null;
- }
- return super.getAdapter(key);
- }
-
- @Override
- public DragTracker getDragTracker(final Request request) {
- // lock the drag to the containing compartment
- return new DragEditPartsTrackerEx(this) {
-
- @Override
- protected boolean handleDragStarted() {
- lockTargetEditPart(CustomStateDefinitionEditPart.this.getParent());
- return super.handleDragStarted();
- }
- };
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java
deleted file mode 100644
index 86f6a82aeb0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.StateDefinitionParser;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionLabelEditPart;
-
-public class CustomStateDefinitionLabelEditPart extends StateDefinitionLabelEditPart {
-
- private IParser parser;
-
- public CustomStateDefinitionLabelEditPart(final View view) {
- super(view);
- }
-
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- // if the StateDefinitionLabel is selected, then delete the parent StateDefinition
- return getParent().getCommand(request);
- }
- return super.getCommand(request);
- }
-
- /**
- * Generation bug prevents getting the parser for the label EditPart (seems to look for a parser on the parent
- * EditPart). So, return the right parser here.
- */
- @Override
- public IParser getParser() {
- if(this.parser == null) {
- this.parser = new StateDefinitionParser();
- }
- return this.parser;
- }
-
- @Override
- public Object getAdapter(@SuppressWarnings("rawtypes") final Class key) {
- // GMF returns the View by default, but Papyrus expects a semantic element.
- // There is no semantic element, so we return null in order for Papyrus to handle
- // the delete menu action enablement correctly.
- // XXX warning: this might cause unforeseen bugs somewhere else.
- if(key == EObject.class) {
- return null;
- }
- return super.getAdapter(key);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java
deleted file mode 100644
index 3ab76e8ec7d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickNameEditPart;
-
-public class CustomTickEditPart extends TickEditPart {
-
- public CustomTickEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(TickNameEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java
deleted file mode 100644
index 9af67319b9b..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintSpecificationEditPart;
-
-public class CustomTimeConstraintEditPart extends TimeConstraintEditPart {
-
- public CustomTimeConstraintEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(TimeConstraintSpecificationEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java
deleted file mode 100644
index 12d69cc56e1..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
-import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationNameEditPart;
-
-public class CustomTimeObservationEditPart extends TimeObservationEditPart {
-
- public CustomTimeObservationEditPart(final View view) {
- super(view);
- }
-
- /**
- * The drag tracker has been specialized in order to constrain movement inside its container without scroll bar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- public DragTracker getDragTracker(final Request request) {
- return new NoScrollNoBorderDragEditPartsTracker(this);
- }
-
- /** Use {@link ExternalLabelPrimaryDragRoleEditPolicy} to display a link while dragging */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- return new LayoutEditPolicyForLabel(TimeObservationNameEditPart.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java
deleted file mode 100644
index 3b3761502ed..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.TimeRulerLayout;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
-
-public class CustomTimeRulerCompartmentEditPartCN extends TimeRulerCompartmentEditPartCN {
-
- public CustomTimeRulerCompartmentEditPartCN(final View view) {
- super(view);
- }
-
- @Override
- public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setTitleVisibility(false);
- result.setLayoutManager(new FillLayout());
- result.getContentPane().setLayoutManager(new TimeRulerLayout());
- return result;
- }
-
- /**
- * Hide the scrollbar
- *
- * @see http://wiki.eclipse.org/Papyrus_Developer_Guide/NoScrollbar
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
- refreshBounds();
- }
-
- @Override
- public boolean isSelectable() {
- // No need to select the compartment.
- // This saves one click when selecting something inside.
- return false;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java
deleted file mode 100644
index 0207d71df26..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-
-public class CustomTimingDiagramEditPart extends TimingDiagramEditPart {
-
- public CustomTimingDiagramEditPart(final View view) {
- super(view);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == RequestConstants.REQ_DROP && !canBeDropped(((GroupRequest)request).getEditParts())) {
- // this fixes the bug where an OccurrenceSpecification could be moved out of its timeline
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand(request);
- }
-
- private static boolean canBeDropped(final List<EditPart> editParts) {
- for(final EditPart editPart : editParts) {
- if(!(editPart instanceof InteractionEditPartTN)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java
deleted file mode 100644
index 795f571b4ed..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineTimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantNameEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimeRulerCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimingRulerEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.UMLEditPartFactory;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-
-public class CustomUMLEditPartFactory extends UMLEditPartFactory {
-
- @Override
- public EditPart createEditPart(final EditPart context, final Object model) {
- if(model instanceof View) {
- final View view = (View)model;
- final int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch(visualID) {
- case TimingDiagramEditPart.VISUAL_ID:// 1
- return new CustomTimingDiagramEditPart(view);
- case InteractionEditPartTN.VISUAL_ID:// 2
- return new CustomInteractionEditPartTN(view);
- case InteractionCompartmentEditPartTN.VISUAL_ID:// 5
- return new CustomInteractionCompartmentEditPartTN(view);
- case FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID: // 7
- return new CustomFullLifelineStateDefinitionCompartmentEditPartCN(view);
- case FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID: // 8
- return new CustomFullLifelineTimelineCompartmentEditPartCN(view);
- case StateDefinitionEditPart.VISUAL_ID:// 9
- return new CustomStateDefinitionEditPart(view);
- case OccurrenceSpecificationLabelEditPart.VISUAL_ID: // 10
- return new CustomOccurrenceSpecificationLabelEditPart(view);
- case FullStateInvariantEditPartCN.VISUAL_ID: // 11
- return new CustomFullStateInvariantEditPartCN(view);
- case OccurrenceSpecificationEditPartCN.VISUAL_ID: // 12
- return new CustomOccurrenceSpecificationEditPartCN(view);
- case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID: // 13
- return new CustomMessageOccurrenceSpecificationEditPartCN(view);
- case MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID: // 14
- return new CustomMessageOccurrenceSpecificationLabelEditPart(view);
- case TimeConstraintEditPart.VISUAL_ID: // 15
- return new CustomTimeConstraintEditPart(view);
- case TimeObservationEditPart.VISUAL_ID: // 16
- return new CustomTimeObservationEditPart(view);
- case DurationObservationEditPartCN.VISUAL_ID: // 17
- return new CustomDurationObservationEditPart(view);
- case DurationConstraintEditPartCN.VISUAL_ID: // 18
- return new CustomDurationConstraintEditPart(view);
- case FullLifelineEditPartCN.VISUAL_ID:// 19
- return new CustomFullLifelineEditPartCN(view);
- case CompactLifelineEditPartCN.VISUAL_ID:// 20
- return new CustomCompactLifelineEditPartCN(view);
- case CompactLifelineCompartmentEditPartCN.VISUAL_ID:// 23
- return new CustomCompactLifelineCompartmentEditPart(view);
- case FreeTimingRulerEditPartCN.VISUAL_ID: // 24
- return new CustomFreeTimingRulerEditPart(view);
- case TickEditPart.VISUAL_ID: // 26
- return new CustomTickEditPart(view);
- case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID: // 27
- return new CustomDestructionOccurrenceSpecificationEditPartCN(view);
- case CompactStateInvariantEditPartCN.VISUAL_ID:// 28
- return new CustomCompactStateInvariantEditPartCN(view);
- case TimeRulerCompartmentEditPartCN.VISUAL_ID: // 29
- return new CustomTimeRulerCompartmentEditPartCN(view);
- case CompactStateInvariantNameEditPart.VISUAL_ID:// 31
- return new CustomCompactStateInvariantNameEditPart(view);
- case DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID: // 32
- return new CustomDestructionOccurrenceSpecificationLabelEditPart(view);
- case StateDefinitionLabelEditPart.VISUAL_ID:// 38
- return new CustomStateDefinitionLabelEditPart(view);
- case FullStateInvariantVerticalLineEditPart.VISUAL_ID:// 39
- return new CustomFullStateInvariantVerticalLineEditPart(view);
- case MessageLostEditPart.VISUAL_ID: // 50
- return new CustomMessageLostEditPart(view);
- case MessageFoundEditPart.VISUAL_ID: // 53
- return new CustomMessageFoundEditPart(view);
- case GeneralOrderingEditPart.VISUAL_ID: // 67
- return new CustomGeneralOrderingEditPart(view);
- case GateEditPart.VISUAL_ID: // 69
- return new CustomGateEditPart(view);
- case FreeTimeRulerCompartmentEditPart.VISUAL_ID: // 80
- return new CustomFreeTimeRulerCompartmentEditPart(view);
- case FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID: // 82
- return new CustomFullLifelineTimeRulerCompartmentEditPartCN(view);
- case CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID: // 83
- return new CustomCompactLifelineTimeRulerCompartmentEditPartCN(view);
- default:
- // when adding cases to this switch, also add the corresponding IDs in the extension
- // org.eclipse.gmf.runtime.diagram.ui.editpartProviders
- }
- }
- return super.createEditPart(context, model);
- }
-
- // getTextCellEditorLocator is modified in the super class instead of overridden because it is static
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java
deleted file mode 100644
index f32ec34a57d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-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.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.GraphicalEditPart;
-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.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.LayoutConstraint;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomCompactLifelineCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/** This factors out common code between the layouts for the compact and full Lifelines. */
-public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
-
- public static final Request UPDATE_LAYOUT_REQUEST = new Request("UPDATE_LAYOUT"); //$NON-NLS-1$
-
- @Override
- public Command getCommand(final Request request) {
- if(request instanceof ChangeBoundsRequest && request.getType() == RequestConstants.REQ_ADD) {
- // deny adding an element into another element (since this breaks everything)
- request.setType(REQ_MOVE_CHILDREN);
- }
- if(request == UPDATE_LAYOUT_REQUEST) {
- return getUpdateTimeElementsCommand();
- }
- final Command superCommand = super.getCommand(request);
- // update the locations of time elements each time an element is added or moved in the timeline
- if(superCommand != null && (request instanceof ChangeBoundsRequest || request.getType() == RequestConstants.REQ_CREATE)) {
- final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(superCommand);
- compoundCommand.add(getUpdateTimeElementsCommand());
- return compoundCommand;
- }
- return superCommand;
- }
-
- /**
- * Returns a command that moves the given node (that represents an OccurrenceSpecification) <code>moveDeltaX</code> pixels to the right (or left
- * if negative).
- *
- * @param occurrenceSpecificationNode
- * the node to move
- * @param moveDelta
- * how much to move
- * @param timelineCompartmentView
- * the parent compartment
- * @param occurrenceSpecificationIndex
- * the index of the OccurrenceSpecification Node in its parent compartment
- * @param nodesToIgnore
- * these nodes will not constrain the new position
- * @return the command
- */
- protected static Command getMoveOccurrenceSpecificationCommand(final Node occurrenceSpecificationNode, final Point moveDelta, final View timelineCompartmentView, final int occurrenceSpecificationIndex, final List<Node> nodesToIgnore) {
- final LayoutConstraint layoutConstraint = occurrenceSpecificationNode.getLayoutConstraint();
- if(layoutConstraint instanceof Location) {
- final Location location = (Location)layoutConstraint;
- final int posX = location.getX() + moveDelta.x;
- final int posY = location.getY() + moveDelta.y;
- final int min = findMin(timelineCompartmentView, occurrenceSpecificationIndex, nodesToIgnore);
- final int max = findMax(timelineCompartmentView, occurrenceSpecificationIndex, nodesToIgnore);
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)occurrenceSpecificationNode.getElement();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification);
- return new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.AbstractTimelineLayoutPolicy_MoveOccurrenceSpecification, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- // constrain the new position between the previous and next OccurrenceSpecifications
- final int newX = Math.max(Math.min(posX, max), min);
- loc.setX(newX);
- loc.setY(posY);
- occurrenceSpecificationNode.setLayoutConstraint(loc);
- return CommandResult.newOKCommandResult();
- }
- });
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Find the maximum abscissa of the OccurrenceSpecification at the given index
- *
- * @param timelineCompartmentView
- * the parent timeline compartment view
- * @param index
- * the index of the OccurrenceSpecification in the compartment view's children
- * @param nodesToIgnore
- * @param nodesToIgnore
- * these nodes will be ignored when computing the maximum position
- * @return the maximum abscissa
- */
- protected static int findMax(final View timelineCompartmentView, final int index, final List<Node> nodesToIgnore) {
- @SuppressWarnings("unchecked")
- final EList<View> children = timelineCompartmentView.getChildren();
- for(int i = index + 1; i < children.size(); i++) {
- final View childView = children.get(i);
- if(!nodesToIgnore.contains(childView) && childView.getElement() instanceof OccurrenceSpecification) {
- final LayoutConstraint layoutConstraint = ((Node)childView).getLayoutConstraint();
- if(layoutConstraint instanceof Location) {
- final Location location = (Location)layoutConstraint;
- return location.getX() - Constants.MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS;
- }
- }
- }
- return Integer.MAX_VALUE;
- }
-
- /**
- * Find the minimum abscissa of the OccurrenceSpecification at the given index
- *
- * @param timelineCompartmentView
- * the parent timeline compartment view
- * @param index
- * the index of the OccurrenceSpecification in the compartment view's children
- * @param nodesToIgnore
- * these nodes will be ignored when computing the minimum position
- * @return the minimum abscissa
- */
- protected static int findMin(final View timelineCompartmentView, final int index, final List<Node> nodesToIgnore) {
- @SuppressWarnings("unchecked")
- final EList<View> children = timelineCompartmentView.getChildren();
- for(int i = index - 1; i >= 0; i--) {
- final View childView = children.get(i);
- if(!nodesToIgnore.contains(childView) && childView.getElement() instanceof OccurrenceSpecification) {
- final LayoutConstraint layoutConstraint = ((Node)childView).getLayoutConstraint();
- if(layoutConstraint instanceof Location) {
- final Location location = (Location)layoutConstraint;
- return location.getX() + Constants.MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS;
- }
- }
- }
- return 0;
- }
-
- /** Returns a command that updates the positions of time elements, relative to the element they are attached to */
- protected Command getUpdateTimeElementsCommand() {
- final GraphicalEditPart timelineCompartmentEditPart = (GraphicalEditPart)getHost();
- final Node compartmentView = (Node)timelineCompartmentEditPart.getModel();
- final boolean compact = timelineCompartmentEditPart instanceof CompactLifelineCompartmentEditPartCN;
- final int width = timelineCompartmentEditPart.getFigure().getSize().width;
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(compartmentView);
- return new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.AbstractTimelineLayoutPolicy_UpdateLocationOfTimeElements, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- @SuppressWarnings("unchecked")
- final EList<View> children = compartmentView.getChildren();
- for(final View child : children) {
- final EObject element = child.getElement();
- if(element instanceof TimeObservation) {
- final TimeObservation timeObservation = (TimeObservation)element;
- final Node timeObservationNode = ((Node)child);
- updateTimeElementLocation(timeObservationNode, timeObservation.getEvent(), children, compact, width);
- } else if(element instanceof TimeConstraint) {
- final TimeConstraint timeConstraint = (TimeConstraint)element;
- final Node timeConstraintNode = ((Node)child);
- final EList<Element> constrainedElements = timeConstraint.getConstrainedElements();
- if(constrainedElements.size() > 0) {
- final Element constrainedElement = constrainedElements.get(0);
- updateTimeElementLocation(timeConstraintNode, constrainedElement, children, compact, width);
- }
- } else if(element instanceof DurationObservation) {
- final DurationObservation durationObservation = (DurationObservation)element;
- final Node durationObservationNode = ((Node)child);
- final EList<NamedElement> events = durationObservation.getEvents();
- if(events.size() == 2) {
- final Element startElement = events.get(0);
- final Element endElement = events.get(1);
- updateDurationElementLocation(durationObservationNode, startElement, endElement, children);
- } else if(events.size() == 1) {
- final Element startEndElement = events.get(0);
- updateDurationElementLocation(durationObservationNode, startEndElement, startEndElement, children);
- }
- } else if(element instanceof DurationConstraint) {
- final DurationConstraint durationConstraint = (DurationConstraint)element;
- final Node durationConstraintNode = ((Node)child);
- final EList<Element> elements = durationConstraint.getConstrainedElements();
- if(elements.size() == 2) {
- final Element startElement = elements.get(0);
- final Element endElement = elements.get(1);
- updateDurationElementLocation(durationConstraintNode, startElement, endElement, children);
- } else if(elements.size() == 1) {
- final Element startEndElement = elements.get(0);
- updateDurationElementLocation(durationConstraintNode, startEndElement, startEndElement, children);
- }
- } else if(element instanceof GeneralOrdering) {
- final GeneralOrdering generalOrdering = (GeneralOrdering)element;
- final Node generalOrderingNode = ((Node)child);
-
- final OccurrenceSpecification before = generalOrdering.getBefore();
- final OccurrenceSpecification after = generalOrdering.getAfter();
- updateGeneralOrderingLocation(generalOrderingNode, before, after, children);
- }
- }
- return CommandResult.newOKCommandResult();
- }
- });
- }
-
- /**
- * Set the horizontal location of the given time element View, so that it is aligned with its associated element
- *
- * @param timeElementNode
- * the element to align
- * @param alignmentElement
- * the element to align to
- * @param timelineViews
- * the views contained in the timeline
- * @param compact
- * whether this is a compact timeline
- * @param max
- * the position to give the element if it has no end
- */
- protected static void updateTimeElementLocation(final Node timeElementNode, final EObject alignmentElement, final EList<View> timelineViews, final boolean compact, final int max) {
- int occurrencePositionBefore = -1;
- int occurrencePositionAfter = -1;
- int lastOccurrencePosition = -1;
- boolean after = false;
- for(final View view : timelineViews) {
- if(view instanceof Node && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- final Node node = (Node)view;
- final LayoutConstraint layoutConstraint = node.getLayoutConstraint();
- if(layoutConstraint instanceof Location) {
- final Location location = (Location)layoutConstraint;
- lastOccurrencePosition = location.getX();
- }
- }
- if(after && view instanceof Node && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getStateInvariant())) {
- // we found the first state change after the alignmentElement => memorize the occurrence position
- occurrencePositionAfter = lastOccurrencePosition;
- after = false;
- }
- if(view.getElement() == alignmentElement) {
- // memorize the first occurrence position before the alignmentElement
- occurrencePositionBefore = lastOccurrencePosition;
- after = true;
- }
- }
-
- boolean firstEvent = true;
- final EObject element = timeElementNode.getElement();
- if(element instanceof TimeObservation) {
- final TimeObservation timeObservation = (TimeObservation)element;
- firstEvent = timeObservation.isFirstEvent();
- } else if(element instanceof TimeConstraint) {
- final TimeConstraint timeConstraint = (TimeConstraint)element;
- firstEvent = timeConstraint.isFirstEvent();
- }
-
- if(firstEvent) {
- if(occurrencePositionBefore != -1) {
- setTimeElementNodeLocation(timeElementNode, occurrencePositionBefore);
- } else {
- if(compact) {
- setTimeElementNodeLocation(timeElementNode, CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET);
- } else {
- setTimeElementNodeLocation(timeElementNode, 0);
- }
- }
- } else {
- if(occurrencePositionAfter != -1) {
- setTimeElementNodeLocation(timeElementNode, occurrencePositionAfter);
- } else {
- // the margin avoids the element pushing the rest outside
- final int margin = 5;
- setTimeElementNodeLocation(timeElementNode, max - margin);
- }
- }
- }
-
- /**
- * Set the horizontal location of the given duration element View, so that it is aligned with its associated start
- * and end elements
- *
- * @param durationElementNode
- * the element to align
- * @param startElement
- * the start element of the duration
- * @param endElement
- * the end element of the duration
- * @param timelineViews
- * the views contained in the timeline
- */
- protected void updateDurationElementLocation(final Node durationElementNode, final Element startElement, final Element endElement, final EList<View> timelineViews) {
- int lastOccurrencePosition = getOriginX();
- int startPos = getOriginX();
- int endPos = -1;
- boolean onEndElement = false;
- for(final View view : timelineViews) {
- if(view instanceof Node) {
- final Node node = (Node)view;
- final LayoutConstraint layoutConstraint = node.getLayoutConstraint();
- final Location location = (Location)layoutConstraint;
- if(onEndElement && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification())) {
- // if there is a DestructionOccurrenceSpecification, then the duration must end on it
- endPos = location.getX() + SmallSquareFigure.RADIUS + 1;
- onEndElement = false;
- }
- if(ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- lastOccurrencePosition = location.getX();
- } else if(ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getStateInvariant())) {
- if(onEndElement) {
- endPos = lastOccurrencePosition + SmallSquareFigure.RADIUS + 1;
- onEndElement = false;
- }
- }
- }
- if(view.getElement() == startElement) {
- startPos = lastOccurrencePosition + SmallSquareFigure.RADIUS;
- }
- if(view.getElement() == endElement) {
- if(endElement instanceof OccurrenceSpecification) {
- endPos = lastOccurrencePosition + SmallSquareFigure.RADIUS + 1;
- } else {
- // on a StateInvariant => the next state change (an OccurrenceSpecification followed by
- // a StateInvariant) will determine the end of the StateInvariant
- onEndElement = true;
- }
- }
- }
-
- if(endPos == -1) {
- // the endElement has no end
- endPos = Integer.MAX_VALUE;
- }
- setDurationElementNodeLocation(durationElementNode, startPos, endPos);
-
- }
-
- // meant to be overridden
- @SuppressWarnings("static-method")
- protected int getOriginX() {
- return 0;
- }
-
- /**
- * Set the location of the given time element to the given horizontal coordinate. The vertical coordinate is set to
- * the location where the user clicked initially. Then we let the user change the vertical coordinate freely.
- */
- protected static void setTimeElementNodeLocation(final Node timeElementNode, final int x) {
- final LayoutConstraint layoutConstraint = timeElementNode.getLayoutConstraint();
- final Location timeElementLocation;
- final int y;
- // it is a Bounds element when created; we change it to a Location
- if(layoutConstraint instanceof Bounds) {
- final Bounds initialBounds = (Bounds)layoutConstraint;
- timeElementLocation = NotationFactory.eINSTANCE.createLocation();
- // place it above the location where the user clicked
- y = initialBounds.getY() - VerticalMarkFigure.PREFERRED_HEIGHT - 5;
- } else if(layoutConstraint instanceof Location) {
- timeElementLocation = (Location)layoutConstraint;
- y = timeElementLocation.getY();
- } else {
- timeElementLocation = NotationFactory.eINSTANCE.createLocation();
- y = 0;
- }
-
- timeElementLocation.setX(x);
- timeElementLocation.setY(y);
- timeElementNode.setLayoutConstraint(timeElementLocation);
- }
-
- /**
- * Set the location of the given duration node
- *
- * @param durationElementNode
- * the node to position
- * @param startPos
- * the horizontal starting position
- * @param endPos
- * the horizontal ending position
- */
- private static void setDurationElementNodeLocation(final Node durationElementNode, final int startPos, final int endPos) {
- final LayoutConstraint layoutConstraint = durationElementNode.getLayoutConstraint();
-
- final Bounds bounds;
- if(layoutConstraint instanceof Bounds) {
- bounds = (Bounds)layoutConstraint;
- } else {
- bounds = NotationFactory.eINSTANCE.createBounds();
- durationElementNode.setLayoutConstraint(bounds);
- }
- bounds.setX(startPos);
- if(endPos == Integer.MAX_VALUE) {
- bounds.setWidth(Integer.MAX_VALUE);
- } else {
- bounds.setWidth(endPos - startPos);
- }
- }
-
- /**
- * Set the location of the given GeneralOrdering node so that it is aligned with the given <code>before</code> and <code>after</code> occurrences.
- *
- * @param generalOrderingNode
- * the node to align
- * @param before
- * the start element
- * @param after
- * the end element
- * @param timelineViews
- * all the Views in the timeline
- */
- protected static void updateGeneralOrderingLocation(final Node generalOrderingNode, final OccurrenceSpecification before, final OccurrenceSpecification after, final EList<View> timelineViews) {
- int startPos = -1;
- int endPos = -1;
- for(final View view : timelineViews) {
- if(view instanceof Node) {
- final Node node = (Node)view;
- final LayoutConstraint layoutConstraint = node.getLayoutConstraint();
- final Location location = (Location)layoutConstraint;
- if(view.getElement() == before) {
- startPos = location.getX() + SmallSquareFigure.RADIUS;
- }
- if(view.getElement() == after) {
- endPos = location.getX() + SmallSquareFigure.RADIUS + 1;
- }
- }
- }
- if(startPos != -1 && endPos != -1) {
- setGeneralOrderingNodeLocation(generalOrderingNode, startPos, endPos);
- }
- }
-
- /**
- * Set the location of the given {@link GeneralOrdering} node
- *
- * @param generalOrderingNode
- * the node to position
- * @param startPos
- * the horizontal starting position
- * @param endPos
- * the horizontal ending position
- */
- private static void setGeneralOrderingNodeLocation(final Node generalOrderingNode, final int startPos, final int endPos) {
- final LayoutConstraint layoutConstraint = generalOrderingNode.getLayoutConstraint();
- final Bounds bounds;
- if(layoutConstraint instanceof Bounds) {
- bounds = (Bounds)layoutConstraint;
- } else {
- bounds = NotationFactory.eINSTANCE.createBounds();
- generalOrderingNode.setLayoutConstraint(bounds);
- }
- bounds.setX(startPos);
- bounds.setWidth(endPos - startPos);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index e89697a86c4..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomDurationConstraintCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomDurationObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomGeneralOrderingCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomTimeConstraintCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomTimeObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactLifelineCompartmentItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-
-public class CustomCompactLifelineCompartmentItemSemanticEditPolicyCN extends CompactLifelineCompartmentItemSemanticEditPolicyCN {
-
- @Override
- protected Command getReorientRelationshipSourceCommand(final ReconnectRequest request) {
- if(request.getConnectionEditPart() instanceof MessageFoundEditPart) {
- // don't let it return an unexecutable command, since it prevents the MessageFound anchor from being dragged
- return null;
- }
- return super.getReorientRelationshipSourceCommand(request);
- }
-
- @Override
- protected Command getReorientRelationshipTargetCommand(final ReconnectRequest request) {
- if(request.getConnectionEditPart() instanceof MessageLostEditPart) {
- // don't let it return an unexecutable command, since it prevents the MessageLost anchor from being dragged
- return null;
- }
- return super.getReorientRelationshipTargetCommand(request);
- }
-
- /** Allows creating a found Message that originates from a Lifeline */
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-
- /** Allows creating a time element or general ordering with a custom command */
- @Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == UMLElementTypes.TimeObservation_16) {
- return getGEFWrapper(new CustomTimeObservationCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.TimeConstraint_15) {
- return getGEFWrapper(new CustomTimeConstraintCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.DurationObservation_17) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.DurationConstraint_18) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.GeneralOrdering_67) {
- return getGEFWrapper(new CustomGeneralOrderingCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java
deleted file mode 100644
index c317e340c99..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-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.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-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.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.LayoutConstraint;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomCompactLifelineCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.GeneralOrderingUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.RequestUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TimeElementUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * This edit policy handles moving (through drag&drop) the elements in the compartment of a compact Lifeline.
- */
-public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTimelineLayoutPolicy {
-
- @Override
- protected Command getMoveChildrenCommand(final Request request) {
- if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- return getMoveOccurrenceSpecificationsCommand(request);
- }
- return super.getMoveChildrenCommand(request);
- }
-
- @Override
- protected Command getResizeChildrenCommand(final ChangeBoundsRequest request) {
- if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
- return getResizeStateInvariantsCommand(request);
- }
- return super.getResizeChildrenCommand(request);
- }
-
- private Command getResizeStateInvariantsCommand(final ChangeBoundsRequest request) {
- if(request.getResizeDirection() != PositionConstants.EAST) {
- return UnexecutableCommand.INSTANCE;
- }
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_ResizeStateInvariant);
- final CompactLifelineEditPartCN lifelineEditPart = (CompactLifelineEditPartCN)getHost().getParent();
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- final CompactLifelineCompartmentEditPartCN compartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
-
- final int widthDelta = FigureUtils.scaleByZoom(new Point(request.getSizeDelta().width, 0), lifelineEditPart.getFigure()).x;
- @SuppressWarnings("unchecked")
- final List<EditPart> editPartsToResize = request.getEditParts();
- @SuppressWarnings("unchecked")
- final List<EditPart> children = compartmentEditPart.getChildren();
- int deltaX = 0;
- boolean moved = false;
- for(int i = 0; i < children.size(); i++) {
- final EditPart childEditPart = children.get(i);
- EditPart nextChildEditPart = null;
- if(i < children.size() - 1) {
- nextChildEditPart = children.get(i + 1);
- }
-
- final Object model = childEditPart.getModel();
- if(model instanceof Node) {
- final Node childNode = (Node)model;
- boolean move = deltaX != 0;
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(childEditPart)) {
- // only move OccurrenceSpecifications followed by a StateInvariant (state changes)
- move = move && nextChildEditPart instanceof CompactStateInvariantEditPartCN;
- }
- // if the element needs to be moved, then create the move command
- if(move && !TimeElementUtils.isTimeElementEditPart(childEditPart) && !GeneralOrderingUtils.isGeneralOrderingEditPart(childEditPart)) {
- final LayoutConstraint layoutConstraint = childNode.getLayoutConstraint();
- if(!(layoutConstraint instanceof Location)) {
- Activator.log.error("Expected a LayoutConstraint", new Exception()); //$NON-NLS-1$
- continue;
- }
- final Location location = (Location)layoutConstraint;
- final int newX = location.getX() + deltaX;
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(childNode);
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(newX);
- childNode.setLayoutConstraint(loc);
- return CommandResult.newOKCommandResult();
- }
- }));
- moved = true;
- }
- if(editPartsToResize.contains(childEditPart)) {
- // resizing a StateInvariant moves all the elements after it
- deltaX += widthDelta;
- }
- }
- }
- if(!moved) {
- return UnexecutableCommand.INSTANCE;
- }
- compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
- return compoundCommand;
- }
-
- /** returns a NonResizableEditPolicy instead of a ResizableEditPolicy for some children */
- @Override
- protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View)child.getModel();
- final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- // make OccurrenceSpecifications, time and duration elements and general orderings non-resizable
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) || TimeElementUtils.isTimeElementEditPart(visualID) || GeneralOrderingUtils.isGeneralOrderingEditPart(visualID)) {
- return new NonResizableEditPolicyEx() {
-
- /** Override the command in order to pass all the moved EditParts in the request */
- @Override
- protected Command getMoveCommand(final ChangeBoundsRequest request) {
- final ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_MOVE_CHILDREN);
- // all the request's EditParts instead of just the host
- req.setEditParts(request.getEditParts());
- req.setMoveDelta(request.getMoveDelta());
- req.setSizeDelta(request.getSizeDelta());
- req.setLocation(request.getLocation());
- req.setExtendedData(request.getExtendedData());
- return getHost().getParent().getCommand(req);
- }
- };
- }
- return new ResizableShapeEditPolicy() {
-
- /** Override the command in order to pass all the resized EditParts in the request */
- @Override
- protected Command getResizeCommand(final ChangeBoundsRequest request) {
- final ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_RESIZE_CHILDREN);
- // all the request's EditParts instead of just the host
- req.setEditParts(request.getEditParts());
- req.setMoveDelta(request.getMoveDelta());
- req.setSizeDelta(request.getSizeDelta());
- req.setLocation(request.getLocation());
- req.setExtendedData(request.getExtendedData());
- req.setResizeDirection(request.getResizeDirection());
- return getHost().getParent().getCommand(req);
- }
-
- @Override
- public boolean isDragAllowed() {
- return false;
- }
- };
- }
-
- private Command getMoveOccurrenceSpecificationsCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
-
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification);
- final CompactLifelineEditPartCN lifelineEditPart = (CompactLifelineEditPartCN)getHost().getParent();
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
-
- final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
-
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- final List<Node> nodesToMove = new ArrayList<Node>();
- for(final EditPart editPart : editParts) {
- final Object model = editPart.getModel();
- if(model instanceof Node) {
- final Node node = (Node)model;
- if(node.getElement() instanceof OccurrenceSpecification) {
- nodesToMove.add(node);
- }
- }
- }
- for(final Node node : nodesToMove) {
- final int index = timelineCompartmentView.getChildren().indexOf(node);
- if(index >= 0) {
- compoundCommand.add(getMoveOccurrenceSpecificationCommand(node, FigureUtils.scaleByZoom(changeBoundsRequest.getMoveDelta(), lifelineEditPart.getFigure()), timelineCompartmentView, index, nodesToMove));
- }
- }
-
- compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
- return compoundCommand;
- }
-
- @Override
- protected int getOriginX() {
- return CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java
deleted file mode 100644
index c9c9191a6fb..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactLifelineItemSemanticEditPolicyCN;
-
-public class CustomCompactLifelineItemSemanticEditPolicyCN extends CompactLifelineItemSemanticEditPolicyCN {
-
- /** Allows creating a a lost Message that targets a Lifeline, or a found Message that originates from a Lifeline */
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java
deleted file mode 100644
index e57769aeadf..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.OperationForbiddenException;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactStateInvariantItemSemanticEditPolicyCN;
-
-/** Hides related Views (OccurrenceSpecifications, etc.) when hiding a compact StateInvariant. */
-public class CustomCompactStateInvariantItemSemanticEditPolicy extends CompactStateInvariantItemSemanticEditPolicyCN {
-
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- try {
- final View view = (View)getHost().getModel();
- final Set<View> viewsToRemove = new HashSet<View>();
- if(view.getType().equals(Constants.compactStateInvariantId)) {
- viewsToRemove.addAll(StateInvariantUtils.getViewsToHide(view));
- }
- if(viewsToRemove.size() > 0) {
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.hideStateInvariant);
- compoundCommand.add(super.getCommand(request));
- for(final View viewToRemove : viewsToRemove) {
- compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToRemove)));
- }
- return compoundCommand;
- }
- } catch (final OperationForbiddenException e) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return super.getCommand(request);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java
deleted file mode 100644
index 04a736c3460..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageReorientCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.DestructionOccurrenceSpecificationItemSemanticEditPolicyCN;
-
-/** Semantic edit policy for {@link DestructionOccurrenceSpecification}s */
-public class CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy extends DestructionOccurrenceSpecificationItemSemanticEditPolicyCN {
-
- /** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- final Command baseCommand = super.getCommand(request);
- return OccurrenceSpecificationUtils.getHideOccurrenceSpecificationCommand(getHost(), baseCommand);
- }
- return super.getCommand(request);
- }
-
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-
- @Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
- return new ICommandProxy(new CustomMessageReorientCommand(req, getHost().getViewer()));
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java
deleted file mode 100644
index 98074eb819c..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullLifelineItemSemanticEditPolicyCN;
-
-public class CustomFullLifelineItemSemanticEditPolicyCN extends FullLifelineItemSemanticEditPolicyCN {
-
- /** Allows creating a a lost Message that targets a Lifeline, or a found Message that originates from a Lifeline */
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java
deleted file mode 100644
index fa9e76e1e08..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-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.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-import org.eclipse.uml2.uml.Lifeline;
-
-/**
- * This EditPolicy creates a StateInvariant when the first StateDefinition is created, and links the StateInvariant to
- * the StateDefinition.
- */
-public class CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy extends CreationEditPolicy {
-
- public CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy() {
- }
-
- @Override
- protected Command getCreateCommand(final CreateViewRequest request) {
- final Command superCommand = super.getCreateCommand(request);
- final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if(viewDescriptors.size() == 1 && Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(viewDescriptors.get(0).getSemanticHint())) {
- final View lifelineView = (View)getHost().getParent().getModel();
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
- final List<?> children = getHost().getChildren();
- final boolean firstStateDefinition = children.size() == 0;
- return createStateDefinitionCommand(superCommand, lifeline, firstStateDefinition);
- }
- return super.getCreateCommand(request);
- }
-
- private Command createStateDefinitionCommand(final Command superCommand, final Lifeline lifeline, final boolean first) {
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition);
- final FullLifelineEditPartCN lifelineEditPart = getLifelineEditPart();
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- // creates the state definition View
- compoundCommand.add(superCommand);
-
- final CommandResult superCommandResult = ((ICommandProxy)superCommand).getICommand().getCommandResult();
-
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- if(editingDomain == null) {
- throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
- }
-
- final AbstractTransactionalCommand initStateDefinitionCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- // the result from the super command that creates the view
- final ViewDescriptor viewDescriptor = (ViewDescriptor)superCommandResult.getReturnValue();
- final View stateDefinitionView = (View)viewDescriptor.getAdapter(View.class);
-
- // create the annotation for the StateDefinition
- StateDefinitionUtils.initNewStateDefinitionName(stateDefinitionView);
-
- if(first) {
- final String id = StateDefinitionUtils.getStateDefinitionViewID(stateDefinitionView);
- StateInvariantUtils.createStateInvariant(id, lifelineEditPart, -1, -1, -1);
- final View lifelineView = (View)lifelineEditPart.getModel();
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
- LifelineUtils.updateFragmentNames(lifeline, lifelineView);
- }
- return CommandResult.newOKCommandResult();
- }
- };
- compoundCommand.add(new ICommandProxy(initStateDefinitionCommand));
- compoundCommand.add(new RefreshCommandForDo(getLifelineEditPart()));
- return compoundCommand;
- }
-
- protected FullLifelineEditPartCN getLifelineEditPart() {
- return (FullLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(getHost(), FullLifelineEditPartCN.VISUAL_ID);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java
deleted file mode 100644
index 8acfa353c26..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-
-/** Handles re-ordering StateDefinitions inside their compartment through drag&drop */
-public class CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy extends GenericListCompartmentLayoutEditPolicy {
-
- @Override
- protected GraphicalEditPart getEditPartToRefresh() {
- return (GraphicalEditPart)EditPartUtils.findParentEditPartWithId(getHost(), FullLifelineEditPartCN.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 92204bfb3f0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomDurationConstraintCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomDurationObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomGeneralOrderingCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomTimeConstraintCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomTimeObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullLifelineTimelineCompartmentItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-
-public class CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN extends FullLifelineTimelineCompartmentItemSemanticEditPolicyCN {
-
- @Override
- protected Command getReorientRelationshipSourceCommand(final ReconnectRequest request) {
- if(request.getConnectionEditPart() instanceof MessageFoundEditPart) {
- // don't let it return an unexecutable command, since it prevents the MessageFound anchor from being dragged
- return null;
- }
- return super.getReorientRelationshipSourceCommand(request);
- }
-
- @Override
- protected Command getReorientRelationshipTargetCommand(final ReconnectRequest request) {
- if(request.getConnectionEditPart() instanceof MessageLostEditPart) {
- // don't let it return an unexecutable command, since it prevents the MessageLost anchor from being dragged
- return null;
- }
- return super.getReorientRelationshipTargetCommand(request);
- }
-
- /** Allows creating a found Message that originates from a Lifeline */
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-
- /** Allows creating a time element or general ordering with a custom command */
- @Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == UMLElementTypes.TimeObservation_16) {
- return getGEFWrapper(new CustomTimeObservationCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.TimeConstraint_15) {
- return getGEFWrapper(new CustomTimeConstraintCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.DurationObservation_17) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.DurationConstraint_18) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
- } else if(requestElementType == UMLElementTypes.GeneralOrdering_67) {
- return getGEFWrapper(new CustomGeneralOrderingCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java
deleted file mode 100644
index c31f56c3da5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.OperationForbiddenException;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullStateInvariantItemSemanticEditPolicyCN;
-
-/** Hides related Views (OccurrenceSpecifications, VerticalLine) when hiding a full StateInvariant. */
-public class CustomFullStateInvariantItemSemanticEditPolicy extends FullStateInvariantItemSemanticEditPolicyCN {
-
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- try {
- final View view = (View)getHost().getModel();
- final Set<View> viewsToRemove = new HashSet<View>();
- if(view.getType().equals(Constants.fullStateInvariantId)) {
- viewsToRemove.addAll(StateInvariantUtils.getViewsToHide(view));
- }
- if(viewsToRemove.size() > 0) {
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.hideStateInvariant);
- compoundCommand.add(super.getCommand(request));
- for(final View viewToRemove : viewsToRemove) {
- compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToRemove)));
- }
- return compoundCommand;
- }
- } catch (final OperationForbiddenException e) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return super.getCommand(request);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java
deleted file mode 100644
index afe1d1d9c4b..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageReorientCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.GateItemSemanticEditPolicy;
-
-/** Semantic edit policy for {@link Gate}s */
-public class CustomGateItemSemanticEditPolicy extends GateItemSemanticEditPolicy {
-
- /** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- // TODO: delete elements linked to Gate
- // final Command baseCommand = super.getCommand(request);
- // return GateUtils.getHideGateCommand(getHost(), baseCommand);
- }
- return super.getCommand(request);
- }
-
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-
- @Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
- return new ICommandProxy(new CustomMessageReorientCommand(req, getHost().getViewer()));
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java
deleted file mode 100644
index 90c705d1b5d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-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.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TimeRulerUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.uml2.uml.Interaction;
-
-public class CustomInteractionCompartmentCreationEditPolicy extends PapyrusCreationEditPolicy {
-
- public CustomInteractionCompartmentCreationEditPolicy() {
- }
-
- @Override
- protected Command getCreateCommand(final CreateViewRequest request) {
- final ICommandProxy superCommand = (ICommandProxy)super.getCreateCommand(request);
- final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if(request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
- final String semanticHint = viewDescriptors.get(0).getSemanticHint();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getHost().getModel());
- if(Integer.toString(CompactLifelineEditPartCN.VISUAL_ID).equals(semanticHint)) {
- final View interactionView = (View)getHost().getParent().getModel();
- final Interaction interaction = (Interaction)interactionView.getElement();
- // note: only add a StateInvariant to the Lifeline if the request is a CreateViewAndElementRequest,
- // and not merely a CreateViewRequest, because we don't want to create a new StateInvariant if this is
- // only a drop for an existing Lifeline
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomInteractionCompartmentCreationEditPolicy_CreateCompactLifeline);
- final InteractionEditPartTN interactionEditPart = getInteractionEditPart();
- compoundCommand.add(new RefreshCommandForUndo(interactionEditPart));
- compoundCommand.add(createCompactStateInvariantCommand(superCommand, interaction));
- compoundCommand.add(new ICommandProxy(TimeRulerUtils.getCreateFreeTimeRulerCommand(superCommand, editingDomain, false)));
- compoundCommand.add(new RefreshCommandForDo(interactionEditPart));
- return compoundCommand;
- }
- if(Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(semanticHint)) {
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomInteractionCompartmentCreationEditPolicy_CreateFullLifeline);
- final InteractionEditPartTN interactionEditPart = getInteractionEditPart();
- compoundCommand.add(new RefreshCommandForUndo(interactionEditPart));
- compoundCommand.add(superCommand);
- compoundCommand.add(new ICommandProxy(TimeRulerUtils.getCreateFreeTimeRulerCommand(superCommand, editingDomain, false)));
- compoundCommand.add(new RefreshCommandForDo(interactionEditPart));
- return compoundCommand;
- }
- }
- return superCommand;
- }
-
- private static Command createCompactStateInvariantCommand(final Command superCommand, final Interaction interaction) {
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_CreateStateInvariant);
- // creates the compact lifeline View
- compoundCommand.add(superCommand);
-
- final CommandResult superCommandResult = ((ICommandProxy)superCommand).getICommand().getCommandResult();
-
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interaction);
- if(editingDomain == null) {
- throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
- }
-
- final AbstractTransactionalCommand initStateDefinitionCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- // the result from the super command that creates the view
- final ViewDescriptor viewDescriptor = (ViewDescriptor)superCommandResult.getReturnValue();
- final View compactLifelineView = (View)viewDescriptor.getAdapter(View.class);
- final View compactLifelineCompartmentView = ViewUtils.findCompactTimelineCompartmentView(compactLifelineView);
- StateInvariantUtils.createCompactStateInvariant(compactLifelineCompartmentView, -1, -1, -1);
- return CommandResult.newOKCommandResult();
- }
- };
- compoundCommand.add(new ICommandProxy(initStateDefinitionCommand));
- return compoundCommand;
- }
-
- protected InteractionEditPartTN getInteractionEditPart() {
- return (InteractionEditPartTN)EditPartUtils.findParentEditPartWithId(getHost(), InteractionEditPartTN.VISUAL_ID);
- }
-
- protected CompactLifelineCompartmentEditPartCN getCompactLifelineCompartmentEditPart() {
- return (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(getHost(), CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index df9eb3059c1..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
-import org.eclipse.papyrus.uml.diagram.timing.edit.commands.CompactLifelineCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.commands.FullLifelineCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.InteractionCompartmentItemSemanticEditPolicyTN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Lifeline;
-
-public class CustomInteractionCompartmentItemSemanticEditPolicy extends InteractionCompartmentItemSemanticEditPolicyTN {
-
- @Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType elementType = req.getElementType();
- if(UMLElementTypes.Lifeline_19 == elementType) {
- return getGEFWrapper(new FullLifelineCreateCommandCN(req) {
-
- @Override
- protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- super.doConfigure(newElement, monitor, info);
- LifelineUtils.setLifelineType(newElement, LifelineType.full);
- }
- });
- }
- if(UMLElementTypes.Lifeline_20 == elementType) {
- return getGEFWrapper(new CompactLifelineCreateCommandCN(req) {
-
- @Override
- protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- super.doConfigure(newElement, monitor, info);
- LifelineUtils.setLifelineType(newElement, LifelineType.compact);
- }
- });
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentLayoutEditPolicy.java
deleted file mode 100644
index 62ca97effcb..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentLayoutEditPolicy.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-/** Handles re-ordering Lifelines inside their interaction compartment through drag&drop */
-public class CustomInteractionCompartmentLayoutEditPolicy extends GenericListCompartmentLayoutEditPolicy {
- // nothing to customize for now
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java
deleted file mode 100644
index e7dab25d234..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-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.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-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.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-
-public class CustomInteractionCreationEditPolicy extends PapyrusCreationEditPolicy {
-
- public CustomInteractionCreationEditPolicy() {
- }
-
- @Override
- protected Command getCreateCommand(final CreateViewRequest request) {
- final ICommandProxy superCommand = (ICommandProxy)super.getCreateCommand(request);
- final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if(request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
- final String semanticHint = viewDescriptors.get(0).getSemanticHint();
- if(Integer.toString(GateEditPart.VISUAL_ID).equals(semanticHint)) {
- return getCreateGateCommand(request, superCommand);
- }
- }
- return superCommand;
- }
-
- /** Override the base creation command in order to position the new Gate Node where the user clicks */
- private Command getCreateGateCommand(final CreateViewRequest request, final ICommandProxy superCommand) {
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomInteractionCreationEditPolicy_CreateGate);
- compoundCommand.add(superCommand);
- final ICommand iCommand = superCommand.getICommand();
- final TransactionalEditingDomain editingDomain = ((AbstractEMFOperation)iCommand).getEditingDomain();
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomInteractionCreationEditPolicy_PositionGate, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CommandResult commandResult = iCommand.getCommandResult();
- final Object returnValue = commandResult.getReturnValue();
- final ViewAndElementDescriptor descriptor = (ViewAndElementDescriptor)returnValue;
- final Node node = (Node)descriptor.getAdapter(Node.class);
-
- final Node interactionView = (Node)ViewUtils.findSuperViewWithId(node, InteractionEditPartTN.VISUAL_ID);
- final Location interactionLocation = (Location)interactionView.getLayoutConstraint();
-
- final IFigure hostFigure = ((GraphicalEditPart)getHost()).getFigure();
- final Point point = new Point(request.getLocation());
- final Point origin = FigureUtils.getLayeredPaneOrigin(hostFigure);
- point.translate(origin);
- final Point location = FigureUtils.scaleByZoom(point, hostFigure);
-
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(location.x - interactionLocation.getX());
- loc.setY(location.y - interactionLocation.getY());
- node.setLayoutConstraint(loc);
-
- return CommandResult.newOKCommandResult();
- }
- }));
- compoundCommand.add(new RefreshCommandForDo((GraphicalEditPart)getHost()));
- return compoundCommand;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java
deleted file mode 100644
index 660232a3b61..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.XYAnchor;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.CreateConnectionRequest;
-import org.eclipse.gef.requests.ReconnectRequest;
-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.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-
-public class CustomLifelineCompartmentGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
-
- @Override
- protected INodeEditPart getConnectionCompleteEditPart(final Request request) {
- // connect to the Lifeline
- return (INodeEditPart)getHost().getParent();
- }
-
- @Override
- protected INodeEditPart getConnectableEditPart() {
- // connect to the Lifeline
- return (INodeEditPart)getHost().getParent();
- }
-
- /**
- * Let the target anchor of a MessageLost be moved, by storing the desired location in an EAnnotation on the
- * connector, which will then be used in {@link CustomFullLifelineEditPartCN#getTargetConnectionAnchor(ConnectionEditPart)}
- */
- @Override
- protected Command getReconnectTargetCommand(final ReconnectRequest request) {
- final ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
- if(connectionEditPart instanceof MessageLostEditPart) {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- final IFigure sourceFigure = ((GraphicalEditPart)connectionEditPart.getSource()).getFigure();
- return MessageUtils.createMoveMessageAnchorCommand(request, connectionEditPart, sourceFigure, Messages.CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation, editingDomain);
- }
- return super.getReconnectTargetCommand(request);
- }
-
- /**
- * Let the target anchor of a MessageFound be moved, by storing the desired location in an EAnnotation on the
- * connector, which will then be used in {@link CustomFullLifelineEditPartCN#getSourceConnectionAnchor(ConnectionEditPart)}
- */
- @Override
- protected Command getReconnectSourceCommand(final ReconnectRequest request) {
- final ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
- if(connectionEditPart instanceof MessageFoundEditPart) {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- final IFigure targetFigure = ((GraphicalEditPart)connectionEditPart.getTarget()).getFigure();
- return MessageUtils.createMoveMessageAnchorCommand(request, connectionEditPart, targetFigure, Messages.CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation, editingDomain);
- }
- return super.getReconnectTargetCommand(request);
- }
-
- /** Returns the anchor for target feedback when creating a lost message */
- @Override
- protected ConnectionAnchor getTargetConnectionAnchor(final CreateConnectionRequest request) {
- return new XYAnchor(new Point(request.getLocation()));
- }
-
- /** Returns the anchor for source feedback when creating a found message */
- @Override
- protected ConnectionAnchor getSourceConnectionAnchor(final CreateConnectionRequest request) {
- final Point startLocation = MessageUtils.retrieveRequestStartLocation(request);
- if(startLocation != null) {
- return new XYAnchor(new Point(startLocation));
- }
- return super.getSourceConnectionAnchor(request);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java
deleted file mode 100644
index 95920f05f8d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
-
-/** Shows feedback for the selection of a Lifeline name vertical label. */
-public class CustomLifelineNameEditPolicy extends UMLTextSelectionEditPolicy {
-
- @Override
- protected void showPrimarySelection() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
- label.setSelected(true);
- label.setFocus(true);
- }
-
- @Override
- protected void showSelection() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
- label.setSelected(true);
- label.setFocus(false);
- }
-
- @Override
- protected void hideSelection() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
- label.setSelected(false);
- label.setFocus(false);
- }
-
- @Override
- protected void showFocus() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
- label.setFocus(true);
- }
-
- @Override
- protected void hideFocus() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
- label.setFocus(false);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java
deleted file mode 100644
index 139856ca5e8..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageReorientCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.commands.TimeConstraintCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.edit.commands.TimeObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageOccurrenceSpecificationItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-
-/** Semantic edit policy for {@link MessageOccurrenceSpecification}s */
-public class CustomMessageOccurrenceSpecificationItemSemanticEditPolicy extends MessageOccurrenceSpecificationItemSemanticEditPolicyCN {
-
- /** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- final Command baseCommand = super.getCommand(request);
- return OccurrenceSpecificationUtils.getHideOccurrenceSpecificationCommand(getHost(), baseCommand);
- }
- return super.getCommand(request);
- }
-
- @Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType elementType = req.getElementType();
- if(UMLElementTypes.TimeConstraint_15 == elementType) {
- return getGEFWrapper(new TimeConstraintCreateCommand(req));
- }
- if(UMLElementTypes.TimeObservation_16 == elementType) {
- return getGEFWrapper(new TimeObservationCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-
- @Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
- return new ICommandProxy(new CustomMessageReorientCommand(req, getHost().getViewer()));
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java
deleted file mode 100644
index 1ce6acf068e..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageReorientCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.policies.OccurrenceSpecificationItemSemanticEditPolicyCN;
-
-/**
- * <ul>
- * <li>Handles hiding an OccurrenceSpecification and the associated VerticalLine and StateInvariant
- * <li>Handles destroying an OccurrenceSpecification and the associated elements, while renaming the OccurrenceSpecifications and StateInvariants
- * <li>Creates the CustomMessageCreateCommand
- * </ul>
- */
-public class CustomOccurrenceSpecificationItemSemanticEditPolicy extends OccurrenceSpecificationItemSemanticEditPolicyCN {
-
- /** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
- @Override
- public Command getCommand(final Request request) {
- if(request.getType() == REQ_DELETE) {
- final Command baseCommand = super.getCommand(request);
- return OccurrenceSpecificationUtils.getHideOccurrenceSpecificationCommand(getHost(), baseCommand);
- }
- return super.getCommand(request);
- }
-
- @Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- if(MessageUtils.isMessage(requestElementType)) {
- return getGEFWrapper(new CustomMessageCreateCommand(req));
- }
- return super.getCreateRelationshipCommand(req);
- }
-
- @Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
- return new ICommandProxy(new CustomMessageReorientCommand(req, getHost().getViewer()));
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java
deleted file mode 100644
index 374d48d8c08..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.ArrayList;
-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.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-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.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.GeneralOrderingUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.RequestUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TimeElementUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * This edit policy handles moving (through drag&drop) the elements in a Timeline compartment: StateInvariants,
- * OccurrenceSpecifications, etc.
- */
-public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineLayoutPolicy {
-
- private static final String ALL_MOVED_EDITPARTS = "ALL_MOVED_EDITPARTS"; //$NON-NLS-1$
-
- /** The height of the feedback figure when moving StateInvariants up or down. */
- private static final int LAYOUT_FEEDBACK_HEIGHT = 4;
-
- private final List<IFigure> layoutFeedbackFigures = new ArrayList<IFigure>();
-
- @Override
- protected Command getMoveChildrenCommand(final Request request) {
- if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
- return getMoveStateInvariantCommand(request);
- } else if(RequestUtils.isChangeBoundsRequestFor(request, FullStateInvariantVerticalLineEditPart.class)) {
- return getMoveVerticalLinesCommand(request);
- } else if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- return getMoveOccurrenceSpecificationsCommand(request);
- }
- return super.getMoveChildrenCommand(request);
- }
-
- private Command getMoveStateInvariantCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
-
- final Point location = changeBoundsRequest.getLocation();
- if(location == null) {
- Activator.log.warn("Ignoring ChangeBoundsRequest without a Location"); //$NON-NLS-1$
- return UnexecutableCommand.INSTANCE;
- }
- final int ordinate = location.y;
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimelineCompartmentLayoutEditPolicy_MoveStateInvariant);
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- final StateDefinitionEditPart stateDefinitionEditPart = StateDefinitionUtils.findStateDefinitionClosestToOrdinate(lifelineEditPart, ordinate);
- if(stateDefinitionEditPart == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final View stateDefinitionView = ((View)stateDefinitionEditPart.getModel());
- final String closestStateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- final String closestStateDefinitionId = StateDefinitionUtils.getStateDefinitionViewID(stateDefinitionView);
-
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- for(final EditPart editPart : editParts) {
- if(editPart instanceof FullStateInvariantEditPartCN) {
- final FullStateInvariantEditPartCN fullStateInvariantEditPart = (FullStateInvariantEditPartCN)editPart;
- final StateInvariant stateInvariant = (StateInvariant)((View)(fullStateInvariantEditPart.getModel())).getElement();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
- if(editingDomain == null) {
- throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
- }
-
- final AbstractTransactionalCommand updateStateInvariantCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- StateInvariantUtils.setStateInvariantId(stateInvariant, closestStateDefinitionId);
- StateInvariantUtils.setInnerStateInvariantName(stateInvariant, closestStateDefinitionName);
- final View lifelineView = (View)lifelineEditPart.getModel();
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
- LifelineUtils.updateFragmentNames(lifeline, lifelineView);
- return CommandResult.newOKCommandResult();
- }
- };
- compoundCommand.add(new ICommandProxy(updateStateInvariantCommand));
- }
- }
- compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
- return compoundCommand;
- }
-
- /**
- * When moving a VerticalLine, we actually move the OccurrenceSpecification that precedes it (that is important for
- * the layout).
- */
- private Command getMoveVerticalLinesCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
-
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimelineCompartmentLayoutEditPolicy_MoveVerticalLine);
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
-
- final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
-
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- final Point moveDelta = FigureUtils.scaleByZoom(changeBoundsRequest.getMoveDelta(), lifelineEditPart.getFigure());
- // no vertical move
- moveDelta.y = 0;
- final List<Node> nodesToMove = new ArrayList<Node>();
- final List<Integer> indexes = new ArrayList<Integer>();
- final List<Node> allMovedNodes = getAllMovedNodes(request);
- for(final EditPart editPart : editParts) {
- if(editPart instanceof FullStateInvariantVerticalLineEditPart) {
- final FullStateInvariantVerticalLineEditPart verticalLineEditPart = (FullStateInvariantVerticalLineEditPart)editPart;
- final View verticalLineView = (View)verticalLineEditPart.getModel();
- final int index = timelineCompartmentView.getChildren().indexOf(verticalLineView);
- if(index > 0) {
- final int occurrenceSpecificationIndex = index - 1;
- final View previousView = (View)timelineCompartmentView.getChildren().get(occurrenceSpecificationIndex);
- if(previousView.getElement() instanceof OccurrenceSpecification) {
- final Node occurrenceSpecificationNode = (Node)previousView;
- nodesToMove.add(occurrenceSpecificationNode);
- indexes.add(Integer.valueOf(occurrenceSpecificationIndex));
- }
- }
- }
- }
- int i = 0;
- for(final Node node : nodesToMove) {
- compoundCommand.add(getMoveOccurrenceSpecificationCommand(node, moveDelta, timelineCompartmentView, indexes.get(i).intValue(), allMovedNodes));
- i++;
- }
- compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
- return compoundCommand;
- }
-
- private Command getMoveOccurrenceSpecificationsCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
-
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification);
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
- compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
-
- final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- final Point moveDelta = FigureUtils.scaleByZoom(changeBoundsRequest.getMoveDelta(), lifelineEditPart.getFigure());
- // no vertical move
- moveDelta.y = 0;
- final List<Node> nodesToMove = new ArrayList<Node>();
- final List<Node> allMovedNodes = getAllMovedNodes(request);
- for(final EditPart editPart : editParts) {
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(editPart)) {
- final Node occurrenceSpecificationNode = (Node)editPart.getModel();
- final Rectangle figureBounds = ((GraphicalEditPart)editPart).getFigure().getBounds();
- // constrain the move inside the timeline
- moveDelta.x = Math.min(moveDelta.x, getHostFigure().getBounds().width - figureBounds.x - figureBounds.width - 2);
- nodesToMove.add(occurrenceSpecificationNode);
- }
- }
- for(final Node node : nodesToMove) {
- final int index = timelineCompartmentView.getChildren().indexOf(node);
- if(index >= 0) {
- compoundCommand.add(getMoveOccurrenceSpecificationCommand(node, moveDelta, timelineCompartmentView, index, allMovedNodes));
- }
- }
-
- compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
- return compoundCommand;
- }
-
- @SuppressWarnings("unchecked")
- private static List<Node> getAllMovedNodes(final Request request) {
- final List<Node> allMovedNodes = new ArrayList<Node>();
- final Map<Object, Object> extendedData = request.getExtendedData();
- if(extendedData != null) {
- List<EditPart> editParts = (List<EditPart>)extendedData.get(ALL_MOVED_EDITPARTS);
- // when the request is sent directly, for example in unit tests
- if(editParts == null) {
- if(request instanceof GroupRequest) {
- final GroupRequest groupRequest = (GroupRequest)request;
- editParts = groupRequest.getEditParts();
- }
- }
- if(editParts != null) {
- for(final EditPart editPart : editParts) {
- if(editPart instanceof GraphicalEditPart) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
- final Object model = graphicalEditPart.getModel();
- if(model instanceof Node) {
- final Node node = (Node)model;
- allMovedNodes.add(node);
- }
- }
- }
- }
- }
- return allMovedNodes;
- }
-
- /** returns a NonResizableEditPolicy instead of a ResizableEditPolicy for some children */
- @Override
- protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View)child.getModel();
- final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- // make these EditParts non-resizable
- if(visualID == FullStateInvariantEditPartCN.VISUAL_ID || OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID || TimeElementUtils.isTimeElementEditPart(visualID) || GeneralOrderingUtils.isGeneralOrderingEditPart(visualID)) {
- return createNonResizableEditPolicy();
- }
- return super.createChildEditPolicy(child);
- }
-
- private NonResizableEditPolicy createNonResizableEditPolicy() {
- return new NonResizableEditPolicyEx() {
-
- /**
- * Overridden in order to keep the information about all EditParts being dragged simultaneously (the GEF
- * NonResizableEditPolicy redirects a multi-part move to several moves each on a single part)
- */
- @Override
- protected Command getMoveCommand(final ChangeBoundsRequest request) {
- final ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_MOVE_CHILDREN);
- // we lose the information when we do that:
- req.setEditParts(getHost());
- @SuppressWarnings("unchecked")
- final Map<Object, Object> extendedData = request.getExtendedData();
- // so we store it in the extended data
- extendedData.put(ALL_MOVED_EDITPARTS, request.getEditParts());
- req.setMoveDelta(request.getMoveDelta());
- req.setSizeDelta(request.getSizeDelta());
- req.setLocation(request.getLocation());
- req.setExtendedData(extendedData);
- return getHost().getParent().getCommand(req);
- }
- };
- }
-
- @Override
- protected void showLayoutTargetFeedback(final Request request) {
- if(!RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
- return;
- }
- eraseLayoutTargetFeedback();
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- final int targetY = computeTargetOrdinate(changeBoundsRequest);
- @SuppressWarnings("unchecked")
- final List<GraphicalEditPart> editParts = changeBoundsRequest.getEditParts();
-
- final double scale = FigureUtils.getScale(getHostFigure());
- for(final GraphicalEditPart editPart : editParts) {
- final Rectangle figureBounds = editPart.getFigure().getBounds();
- final Rectangle containerBounds = ((GraphicalEditPart)getHost()).getFigure().getBounds();
- final Rectangle feedbackBounds = new Rectangle(containerBounds.x + figureBounds.x, targetY - LAYOUT_FEEDBACK_HEIGHT / 2, figureBounds.width, LAYOUT_FEEDBACK_HEIGHT);
- feedbackBounds.scale(scale);
- this.layoutFeedbackFigures.add(createLayoutTargetFeedbackFigure(feedbackBounds));
- }
- }
-
- private int computeTargetOrdinate(final ChangeBoundsRequest request) {
- final int ordinate = request.getLocation().y;
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
- final StateDefinitionEditPart stateDefinitionEditPart = StateDefinitionUtils.findStateDefinitionClosestToOrdinate(lifelineEditPart, ordinate);
-
- final Rectangle figureBounds = stateDefinitionEditPart.getFigure().getBounds();
- return figureBounds.y + figureBounds.height / 2;
- }
-
- protected IFigure createLayoutTargetFeedbackFigure(final Rectangle bounds) {
- final RectangleFigure r = new RectangleFigure();
- r.setForegroundColor(ColorConstants.darkBlue);
- r.setBackgroundColor(ColorConstants.lightBlue);
- r.setBounds(bounds);
- r.validate();
- addFeedback(r);
- return r;
- }
-
- @Override
- protected void eraseLayoutTargetFeedback(final Request request) {
- if(!RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
- return;
- }
- eraseLayoutTargetFeedback();
- }
-
- private void eraseLayoutTargetFeedback() {
- for(final IFigure figure : this.layoutFeedbackFigures) {
- removeFeedback(figure);
- }
- this.layoutFeedbackFigures.clear();
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java
deleted file mode 100644
index ab9c22abd48..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.List;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-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.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.TimeRulerUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-
-/** Adds a free time ruler to new Interactions. */
-public class CustomTimingDiagramCreationEditPolicy extends PapyrusCreationEditPolicy {
-
- public CustomTimingDiagramCreationEditPolicy() {
- }
-
- @Override
- protected Command getCreateCommand(final CreateViewRequest request) {
- final Command superCommand = super.getCreateCommand(request);
- final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if(request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
- final String semanticHint = viewDescriptors.get(0).getSemanticHint();
- if(Integer.toString(InteractionEditPartTN.VISUAL_ID).equals(semanticHint)) {
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getHost().getModel());
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimingDiagramCreationEditPolicy_CreateInteraction);
- compoundCommand.add(new RefreshCommandForUndo((IGraphicalEditPart)getHost()));
- compoundCommand.add(superCommand);
- compoundCommand.add(new ICommandProxy(TimeRulerUtils.getCreateFreeTimeRulerCommand(superCommand, editingDomain, true)));
- compoundCommand.add(new RefreshCommandForDo((IGraphicalEditPart)getHost()));
- return compoundCommand;
- }
- }
- return superCommand;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
deleted file mode 100644
index c4ee9ee3a8f..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- * Nicolas Bros (Mia-Software) - remove dead code, refresh on execute/undo/redo
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-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;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-
-/**
- * This policy provides the selection handles, feedback and move command for an 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.
- *
- * @author nbros : I copied this class from
- * org.eclipse.papyrus.uml.diagram.clazz.custom.policies.ExternalLabelPrimaryDragRoleEditPolicy, removed dead
- * code, added a Refresh, and constrained the bounds within the containing compartment.
- */
-public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEditPolicy {
-
- @Override
- protected List<?> createSelectionHandles() {
- final MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
- mh.setBorder(null);
- return Collections.singletonList(mh);
- }
-
- @Override
- protected Command getMoveCommand(final ChangeBoundsRequest request) {
- final LabelEditPart editPart = (LabelEditPart)getHost();
-
- final IFigure parentFigure = getHostFigure().getParent();
- final Rectangle parentBounds = parentFigure.getBounds();
-
- // First, start from the original bounds
- Rectangle updatedBounds = new Rectangle(getInitialFeedbackBounds());
- // Add the delta corresponding to the move
- updatedBounds = updatedBounds.getTranslated(FigureUtils.scaleByZoom(request.getMoveDelta(), parentFigure));
- // Constrain the bounds within the containing compartment if any
- updatedBounds = FigureUtils.constrainBoundsWithinContainingCompartment(updatedBounds, getHostFigure());
- // Then translate the bounds so that they are relative to the figure (BorderItemContainerFigure)
- // to which the label is attached
- updatedBounds = updatedBounds.getTranslated(parentBounds.getLocation().getNegated());
-
- final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(new RefreshCommandForUndo((GraphicalEditPart)editPart.getParent().getParent()));
- compoundCommand.add(new ICommandProxy(new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedBounds)));
- compoundCommand.add(new RefreshCommandForDo(editPart));
- return compoundCommand;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java
deleted file mode 100644
index aa8b7a5554a..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-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.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Utils;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * This EditPolicy adds a notification listener on the UML element of its EditPart in order to refresh the notation
- * model in response to changes in the semantic model.
- */
-public class FirstEventRefreshEditPolicy extends GraphicalEditPolicy implements NotificationListener, IPapyrusListener {
-
- public static final String VIEW_REFRESH_ROLE = "ViewRefreshRole"; //$NON-NLS-1$
-
- private Element umlElement;
-
- public FirstEventRefreshEditPolicy() {
- super();
- }
-
- @Override
- public void activate() {
- this.umlElement = getUMLElement();
- if(this.umlElement == null) {
- return;
- }
- // adds a listener on the UML element
- getDiagramEventBroker().addNotificationListener(this.umlElement, this);
- // initial refresh
- refreshView();
- }
-
- @Override
- public void deactivate() {
- // retrieve the UML element managed by the edit part
- if(this.umlElement == null) {
- return;
- }
- // remove the listener from the UML element
- getDiagramEventBroker().removeNotificationListener(this.umlElement, this);
- }
-
- /**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- return DiagramEventBroker.getInstance(editingDomain);
- }
- return null;
- }
-
- /**
- * Returns the uml element controlled by the host edit part
- *
- * @return the uml element controlled by the host edit part
- */
- protected Element getUMLElement() {
- final View view = getView();
- if(view != null) {
- return (Element)view.getElement();
- }
- return null;
- }
-
- /**
- * Returns the view controlled by the host edit part
- *
- * @return the view controlled by the host edit part
- */
- protected View getView() {
- return (View)getHost().getModel();
- }
-
- public void notifyChanged(final Notification notification) {
- if(notification.getEventType() == Notification.SET) {
- final Object feature = notification.getFeature();
- if(feature == UMLPackage.eINSTANCE.getTimeObservation_FirstEvent() || feature == UMLPackage.eINSTANCE.getTimeObservation_Event() || feature == UMLPackage.eINSTANCE.getTimeConstraint_FirstEvent() || feature == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) {
- refreshView();
- }
- }
- }
-
- /** Refreshes the View for the element controlled by the edit part with this edit policy */
- public void refreshView() {
- final EditPart compartmentEditPart = EditPartUtils.findParentTimelineCompartment(getHost());
- final Command command = compartmentEditPart.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(getView());
- Utils.executeLaterUnprotected(command, domain);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java
deleted file mode 100644
index ceeb6eed568..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-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.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-
-/**
- * Handles re-ordering Views inside their compartment through drag&drop. This policy is meant to be installed on a list
- * compartment.
- */
-// meant to be overridden
-@SuppressWarnings("static-method")
-public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLayoutEditPolicy {
-
- private static final int LAYOUT_FEEDBACK_HEIGHT = 4;
-
- private static final int MARGIN_BEFORE_FIRST = 4;
-
- private static final int MARGIN_AFTER_LAST = 4;
-
- protected IFigure layoutFeedbackFigure = null;
-
- protected GraphicalEditPart getEditPartToRefresh() {
- return (GraphicalEditPart)getHost();
- }
-
- protected int getLayoutFeedbackHeight() {
- return LAYOUT_FEEDBACK_HEIGHT;
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(final EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- // add an edit policy so that children can be moved
- result = new NonResizableEditPolicyEx();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(final Request request) {
- if(request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
-
- final InsertionPoint insertionPoint = computeClosestInsertionPoint(changeBoundsRequest.getLocation().y);
- if(insertionPoint == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- final GraphicalEditPart hostEditPart = (GraphicalEditPart)getHost();
- final View compartmentView = (View)hostEditPart.getModel();
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- for(final EditPart editPart : editParts) {
- if(editPart instanceof GraphicalEditPart) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
- final View view = (View)graphicalEditPart.getModel();
-
- final GraphicalEditPart editPartToRefresh = getEditPartToRefresh();
- final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(new RefreshCommandForUndo(editPartToRefresh));
- compoundCommand.add(new ICommandProxy(ViewUtils.getMoveViewCommand(compartmentView, view, insertionPoint.getIndex())));
- compoundCommand.add(new RefreshCommandForDo(editPartToRefresh));
- return compoundCommand;
- }
- }
- }
- return null;
- }
-
- @Override
- protected void showLayoutTargetFeedback(final Request request) {
- if(request instanceof ChangeBoundsRequest) {
- eraseLayoutTargetFeedback();
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
-
- final InsertionPoint insertionPoint = computeClosestInsertionPoint(changeBoundsRequest.getLocation().y);
- if(insertionPoint == null) {
- return;
- }
-
- final Rectangle containerBounds = new Rectangle(getHostFigure().getBounds());
- getHostFigure().translateToAbsolute(containerBounds);
- final int layoutFeedbackHeight = getLayoutFeedbackHeight();
- final Rectangle feedbackBounds = new Rectangle(containerBounds.x, insertionPoint.getLocation() - layoutFeedbackHeight / 2, containerBounds.width, layoutFeedbackHeight);
-
- final Point origin = FigureUtils.getLayeredPaneOrigin(getHostFigure());
- feedbackBounds.translate(origin);
- final double scale = FigureUtils.getScale(getHostFigure());
- feedbackBounds.width *= scale;
- feedbackBounds.height *= scale;
- this.layoutFeedbackFigure = createLayoutTargetFeedbackFigure(feedbackBounds);
- }
- }
-
- protected class InsertionPoint {
-
- int index;
-
- int location;
-
- public InsertionPoint(final int index, final int location) {
- this.index = index;
- this.location = location;
- }
-
- public int getIndex() {
- return this.index;
- }
-
- public int getLocation() {
- return this.location;
- }
- }
-
- protected InsertionPoint computeClosestInsertionPoint(final int offset) {
- @SuppressWarnings("unchecked")
- final List<GraphicalEditPart> children = getHost().getChildren();
- if(children.isEmpty()) {
- return null;
- }
- final List<InsertionPoint> insertionPoints = computeInsertionPoints(children);
-
- final TreeMap<Integer, InsertionPoint> distanceMap = new TreeMap<Integer, InsertionPoint>();
- for(final InsertionPoint insertionPoint : insertionPoints) {
- final int distance = Math.abs(offset - insertionPoint.getLocation());
- distanceMap.put(Integer.valueOf(distance), insertionPoint);
- }
- final Entry<Integer, InsertionPoint> firstEntry = distanceMap.firstEntry();
- return firstEntry.getValue();
- }
-
- protected int getMarginBeforeFirst() {
- return MARGIN_BEFORE_FIRST;
- }
-
- protected int getMarginAfterLast() {
- return MARGIN_AFTER_LAST;
- }
-
- protected List<InsertionPoint> computeInsertionPoints(final List<GraphicalEditPart> children) {
- final int size = children.size();
- final List<InsertionPoint> insertionPoints = new ArrayList<GenericListCompartmentLayoutEditPolicy.InsertionPoint>();
- Rectangle previousBounds = null;
- for(int i = 0; i < size; i++) {
- final GraphicalEditPart childEditPart = children.get(i);
- final Rectangle bounds = new Rectangle(childEditPart.getFigure().getBounds());
- getHostFigure().translateToAbsolute(bounds);
-
- if(previousBounds != null) {
- // an insertion point between two figures
- insertionPoints.add(new InsertionPoint(i, (previousBounds.y + previousBounds.height + bounds.y) / 2));
- } else {
- // an insertion point before the first figure
- insertionPoints.add(new InsertionPoint(i, bounds.y - getMarginBeforeFirst()));
- }
- if(i == size - 1) {
- // last insertion point: after the last figure
- insertionPoints.add(new InsertionPoint(i + 1, bounds.y + bounds.height + getMarginAfterLast()));
- }
- previousBounds = bounds;
- }
- return insertionPoints;
- }
-
- protected IFigure createLayoutTargetFeedbackFigure(final Rectangle bounds) {
- final RectangleFigure r = new RectangleFigure();
- r.setForegroundColor(ColorConstants.darkBlue);
- r.setBackgroundColor(ColorConstants.lightBlue);
- r.setBounds(bounds);
- r.validate();
- addFeedback(r);
- return r;
- }
-
- @Override
- protected void eraseLayoutTargetFeedback(final Request request) {
- eraseLayoutTargetFeedback();
- }
-
- protected void eraseLayoutTargetFeedback() {
- if(this.layoutFeedbackFigure != null) {
- removeFeedback(this.layoutFeedbackFigure);
- this.layoutFeedbackFigure = null;
- }
- }
-
- @Override
- protected Command getCreateCommand(final CreateRequest request) {
- return null;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
deleted file mode 100644
index f7385ae724f..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.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.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-
-/**
- * Returns {@link ExternalLabelPrimaryDragRoleEditPolicy} for the associated label in order to display a link between
- * the label and associated edit part while dragging the label.
- */
-public class LayoutEditPolicyForLabel extends LayoutEditPolicy {
-
- private final int labelVisualId;
-
- public LayoutEditPolicyForLabel(final int labelVisualId) {
- this.labelVisualId = labelVisualId;
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View)child.getModel();
- if(UMLVisualIDRegistry.getVisualID(childView) == this.labelVisualId) {
- return new ExternalLabelPrimaryDragRoleEditPolicy();
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(final Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(final CreateRequest request) {
- return null;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java
deleted file mode 100644
index 7e0de86946e..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.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.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
-
-public class SelectionOnlyLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected Command getMoveChildrenCommand(final Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(final CreateRequest request) {
- return null;
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(final EditPart child) {
- final NonResizableEditPolicy nonResizableEditPolicy = new NonResizableEditPolicy();
- nonResizableEditPolicy.setDragAllowed(false);
- return nonResizableEditPolicy;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java
deleted file mode 100644
index af03e4a5887..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-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.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-
-/**
- * This EditPolicy adds a notification listener on the time ruler View that listens for its visibility and updates the
- * {@link LifelineFigure#setDisplayTimeRuler(boolean) LifelineFigure's time ruler visibility}
- */
-public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy implements NotificationListener, IPapyrusListener {
-
- public static final String ROLE = "TimeRulerVisibilityRefreshRole"; //$NON-NLS-1$
-
- private View timeRulerCompartmentView;
-
- public TimeRulerVisibilityRefreshEditPolicy() {
- super();
- }
-
- @Override
- public void activate() {
-
- this.timeRulerCompartmentView = getListenedView();
- if(this.timeRulerCompartmentView == null) {
- return;
- }
- // adds a listener on the View
- getDiagramEventBroker().addNotificationListener(this.timeRulerCompartmentView, this);
- // initial refresh (so that the figure has the right visibility when the diagram is first opened)
- refreshFigure();
- }
-
- @Override
- public void deactivate() {
- if(this.timeRulerCompartmentView == null) {
- return;
- }
- // remove the listener from the View
- getDiagramEventBroker().removeNotificationListener(this.timeRulerCompartmentView, this);
- }
-
- /**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- return DiagramEventBroker.getInstance(editingDomain);
- }
- return null;
- }
-
- protected View getListenedView() {
- final View view = getView();
- if(view != null) {
- return ViewUtils.findTimeRulerCompartmentView(view);
- }
- return null;
- }
-
- protected View getView() {
- return (View)getHost().getModel();
- }
-
- public void notifyChanged(final Notification notification) {
- if(notification.getEventType() == Notification.SET) {
- final Object feature = notification.getFeature();
- if(feature == NotationPackage.eINSTANCE.getView_Visible()) {
- refreshFigure();
- }
- }
- }
-
- /**
- * Refreshes the "displayTimeRuler" attribute of the LifelineFigure so that it matches the visibility of the
- * TimeRulerCompartment View.
- */
- public void refreshFigure() {
- final boolean visible = getListenedView().isVisible();
- final IFigure figure = ((IGraphicalEditPart)getHost()).getFigure();
- final LifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(figure, LifelineFigure.class);
- lifelineFigure.setDisplayTimeRuler(visible);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
deleted file mode 100644
index 2eda7e42da8..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-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.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-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.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.ValidateInteractionCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomCompactLifelineCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.helper.TimingDiagramLinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.DropUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.InteractionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Utils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-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.Gate;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.TimeObservation;
-
-public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPolicy {
-
- /** Elements for which we want to specialize the drop */
- @SuppressWarnings("boxing")
- private static final Integer[] SPECIFIC_DROP_ELEMENT_IDS = { InteractionEditPartTN.VISUAL_ID, FullLifelineEditPartCN.VISUAL_ID, CompactLifelineEditPartCN.VISUAL_ID, MessageSyncEditPart.VISUAL_ID, MessageAsyncEditPart.VISUAL_ID, MessageReplyEditPart.VISUAL_ID, MessageCreateEditPart.VISUAL_ID, MessageDeleteEditPart.VISUAL_ID, MessageFoundEditPart.VISUAL_ID, MessageLostEditPart.VISUAL_ID, TimeObservationEditPart.VISUAL_ID, TimeConstraintEditPart.VISUAL_ID, DurationObservationEditPartCN.VISUAL_ID, DurationConstraintEditPartCN.VISUAL_ID, GeneralOrderingEditPart.VISUAL_ID, GateEditPart.VISUAL_ID };
-
- public TimingDiagramDragDropEditPolicy() {
- super(TimingDiagramLinkMappingHelper.getInstance());
- }
-
- /** override the drop command */
- @Override
- protected Command getSpecificDropCommand(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID, final int linkVISUALID) {
- switch(nodeVISUALID) {
- case InteractionEditPartTN.VISUAL_ID:
- return new ICommandProxy(dropMainElement(dropRequest, semanticElement, nodeVISUALID));
- case FullLifelineEditPartCN.VISUAL_ID:
- case CompactLifelineEditPartCN.VISUAL_ID:
- return new ICommandProxy(dropLifeline(dropRequest, semanticElement, nodeVISUALID));
- default:
- }
-
- if(getHost().getModel() instanceof View) {
- final View hostView = (View)getHost().getModel();
- if(MessageUtils.isMessage(linkVISUALID)) {
- if(semanticElement instanceof Message) {
- return new ICommandProxy(DropUtils.getDropMessageCommand((Message)semanticElement, hostView, getViewer()));
- }
- }
- if(nodeVISUALID == TimeObservationEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropTimeObservationCommand((TimeObservation)semanticElement, hostView, getViewer()));
- }
- if(nodeVISUALID == TimeConstraintEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropTimeConstraintCommand((TimeConstraint)semanticElement, hostView, getViewer()));
- }
- if(nodeVISUALID == DurationObservationEditPartCN.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropDurationObservationCommand((DurationObservation)semanticElement, hostView, getViewer()));
- }
- if(nodeVISUALID == DurationConstraintEditPartCN.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropDurationConstraintCommand((DurationConstraint)semanticElement, hostView, getViewer()));
- }
- if(nodeVISUALID == GeneralOrderingEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropGeneralOrderingCommand((GeneralOrdering)semanticElement, hostView, getViewer()));
- }
- if(nodeVISUALID == GateEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropGateCommand((Gate)semanticElement, hostView, getViewer()));
- }
- }
-
- return super.getSpecificDropCommand(dropRequest, semanticElement, nodeVISUALID, linkVISUALID);
-
- }
-
- private ICommand dropLifeline(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID) {
- if(!(semanticElement instanceof Lifeline)) {
- throw new IllegalArgumentException();
- }
- final Lifeline lifeline = (Lifeline)semanticElement;
-
- final CompositeCommand cc = new CompositeCommand(Messages.TimingDiagramDragDropEditPolicy_DropLifeline);
- final ICommand dropMainElementCommand = dropMainElement(dropRequest, semanticElement, nodeVISUALID);
- cc.add(dropMainElementCommand);
- final LifelineType lifelineType = LifelineUtils.getLifelineType(lifeline);
- if(lifelineType == LifelineType.full) {
- cc.add(dropStateDefinitions(lifeline, dropMainElementCommand.getCommandResult()));
- }
- cc.add(dropLifelineFragments(lifeline, dropMainElementCommand.getCommandResult(), lifelineType));
- return cc;
- }
-
- private static ICommand dropStateDefinitions(final Lifeline lifeline, final CommandResult lifelineCreateViewCommandResult) {
- if(lifelineCreateViewCommandResult == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- final Object returnValue = lifelineCreateViewCommandResult.getReturnValue();
- return new AbstractTransactionalCommand(editingDomain, Messages.TimingDiagramDragDropEditPolicy_DropStateDefinitions, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if(returnValue instanceof IAdaptable) {
- final IAdaptable adaptable = (IAdaptable)returnValue;
- final View lifelineView = (View)adaptable.getAdapter(View.class);
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
- final View stateDefinitionCompartmentView = ViewUtils.findStateDefinitionCompartmentView(lifelineView);
- final List<String> stateDefinitionIds = StateDefinitionUtils.getStateDefinitionIds(lifeline);
- for(final String stateDefinitionId : stateDefinitionIds) {
- final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionId, lifeline);
-
- // create the View for the state definition
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateDefinitionView = umlViewProvider.createNode_9(null, stateDefinitionCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- // restore the same id
- StateDefinitionUtils.setStateDefinitionViewID(stateDefinitionView, stateDefinitionId);
- // set the name on the View
- StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, stateDefinitionName);
- }
-
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private static ICommand dropLifelineFragments(final Lifeline lifeline, final CommandResult lifelineCreateViewCommandResult, final LifelineType lifelineType) {
- if(lifelineCreateViewCommandResult == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- final Object returnValue = lifelineCreateViewCommandResult.getReturnValue();
- return new AbstractTransactionalCommand(editingDomain, Messages.TimingDiagramDragDropEditPolicy_DropLifelineFragments, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if(returnValue instanceof IAdaptable) {
- final IAdaptable adaptable = (IAdaptable)returnValue;
- final View lifelineView = (View)adaptable.getAdapter(View.class);
- if(lifelineView == null) {
- return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
- }
-
- final View compartmentView = (lifelineType == LifelineType.full ? ViewUtils.findFullLifelineCompartmentView(lifelineView) : ViewUtils.findCompactTimelineCompartmentView(lifelineView));
-
- final EList<InteractionFragment> fragments = lifeline.getCoveredBys();
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- int x = lifelineType == LifelineType.full ? 20 : CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET;
- boolean firstStateInvariant = true;
- String previousStateInvariantName = ""; //$NON-NLS-1$
- for(final InteractionFragment fragment : fragments) {
- if(fragment instanceof StateInvariant) {
- if(!firstStateInvariant && lifelineType == LifelineType.full) {
- // add a vertical line
- umlViewProvider.createNode_39(null, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- }
- final StateInvariant stateInvariant = (StateInvariant)fragment;
- final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
-
- if(lifelineType == LifelineType.full) {
- if(Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
- x += 10;
- } else {
- x += 25;
- }
- } else {
- x += 60;
- }
-
- // create the View for the state invariant
- if(lifelineType == LifelineType.full) {
- umlViewProvider.createStateInvariant_11(stateInvariant, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- } else if(lifelineType == LifelineType.compact) {
- umlViewProvider.createStateInvariant_28(stateInvariant, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- }
- firstStateInvariant = false;
- previousStateInvariantName = stateInvariantName;
- } else if(fragment instanceof DestructionOccurrenceSpecification) {
- final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification)fragment;
- // create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(destructionOccurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
-
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(x);
- loc.setY(0);
- occurrenceSpecificationView.setLayoutConstraint(loc);
- x += 10;
- } else if(fragment instanceof MessageOccurrenceSpecification) {
- final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification)fragment;
- // create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
-
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(x);
- loc.setY(0);
- occurrenceSpecificationView.setLayoutConstraint(loc);
- x += 10;
- } else if(fragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)fragment;
- // create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
-
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(x);
- loc.setY(0);
- occurrenceSpecificationView.setLayoutConstraint(loc);
- x += 10;
- }
-
- }
- }
-
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private ICommand dropMainElement(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID) {
- if(canBeDropped(semanticElement)) {
- final IHintedType type = ((IHintedType)getUMLElementType(nodeVISUALID));
- String semanticHint = null;
- if(type != null) {
- semanticHint = type.getSemanticHint();
- }
- return getDefaultDropNodeCommand(getHost(), semanticHint, dropRequest.getLocation(), semanticElement, dropRequest);
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- private boolean canBeDropped(final Element semanticElement) {
- final GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
- final EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
- return (graphicalParentObject instanceof org.eclipse.uml2.uml.Package && semanticElement instanceof Interaction) || (graphicalParentObject instanceof Interaction && semanticElement instanceof Lifeline);
- }
-
- /** @return the set of element ids for which we want to specialize the drop */
- @Override
- protected Set<Integer> getDroppableElementVisualId() {
- return new HashSet<Integer>(Arrays.asList(SPECIFIC_DROP_ELEMENT_IDS));
- }
-
- @Override
- public IElementType getUMLElementType(final int elementID) {
- return UMLElementTypes.getElementType(elementID);
- }
-
- @Override
- public int getNodeVisualID(final View containerView, final EObject domainElement) {
- if(domainElement instanceof Gate && (String.valueOf(InteractionEditPartTN.VISUAL_ID).equals(containerView.getType()) || String.valueOf(InteractionCompartmentEditPartTN.VISUAL_ID).equals(containerView.getType()))) {
- // allow dropping a Gate directly on an Interaction or Interaction compartment
- return GateEditPart.VISUAL_ID;
- }
- return UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
- }
-
- @Override
- public int getLinkWithClassVisualID(final EObject domainElement) {
- return UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement);
- }
-
- @Override
- protected Command getDropCommand(final ChangeBoundsRequest request) {
- return getDropObjectsCommand(castToDropObjectsRequest(request));
- }
-
- /** Overridden to add validation */
- @Override
- public Command getDropObjectsCommand(final DropObjectsRequest dropRequest) {
-
- final CompoundCommand cc = new CompoundCommand(Messages.TimingDiagramDragDropEditPolicy_Drop);
-
- final List<Interaction> updatedInteractionsCache = new ArrayList<Interaction>();
- final List<?> droppedObjects = dropRequest.getObjects();
-
- for(final Object droppedObject : droppedObjects) {
- if(droppedObject instanceof EObject) {
- final EObject droppedEObject = (EObject)droppedObject;
- final Interaction interaction = InteractionUtils.getContainingInteraction(droppedEObject);
- if(interaction != null) {
- if(!updatedInteractionsCache.contains(interaction)) {
- final ValidateInteractionCommand validateCommand = new ValidateInteractionCommand(getEditingDomain(), interaction, true);
- cc.add(new ICommandProxy(validateCommand));
- updatedInteractionsCache.add(interaction);
- }
- }
- }
- }
-
- cc.add(super.getDropObjectsCommand(dropRequest));
- return cc;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
deleted file mode 100644
index ef5c18bc1f7..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-public abstract class AbstractMessageFigure extends UMLEdgeFigure {
-
- protected static final Font LABEL_FONT = new Font(Display.getCurrent(), "SANS", 9, SWT.NORMAL); //$NON-NLS-1$
-
- private WrappingLabel messageLabel;
-
- @Override
- public void paint(final Graphics graphics) {
- graphics.setAntialias(SWT.ON);
- super.paint(graphics);
- }
-
- public AbstractMessageFigure() {
- // setForegroundColor(ColorConstants.black);
- setForegroundColor(getForegroundColor());
- setSourceDecoration(createSourceDecoration());
- setTargetDecoration(createTargetDecoration());
- }
-
- // meant to be overridden
- @SuppressWarnings("static-method")
- protected RotatableDecoration createSourceDecoration() {
- return null;
- }
-
- // meant to be overridden
- @SuppressWarnings("static-method")
- protected RotatableDecoration createTargetDecoration() {
- return null;
- }
-
- @Override
- protected void createContents() {
- super.createContents();
- this.messageLabel = new WrappingLabel();
- this.messageLabel.setText(""); //$NON-NLS-1$
- this.messageLabel.setFont(LABEL_FONT);
- add(this.messageLabel);
- }
-
- public WrappingLabel getMessageLabel() {
- return this.messageLabel;
- }
-
- @Override
- public void setLineWidth(final 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(final 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);
- }
- }
-
- protected static IMapMode getMapMode() {
- return MapModeTypes.IDENTITY_MM;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
deleted file mode 100644
index bf953e8ecd5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-
-/**
- * @author vgillet
- *
- */
-public class CompactLifelineFigure extends LifelineFigure {
-
- /**
- * Get the rectangle which contains all labels
- *
- * @see org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure#getDefaultLabelsContainer()
- * @return lifeline labels rectangle
- */
- protected IFigure getDefaultLabelsContainer() {
- return getNameLabelContainerFigure();
- }
-
- @Override
- protected void createContents() {
- this.nameLabelContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "CompactLifelineFigure_nameLabelContainerFigure"; //$NON-NLS-1$
- };
- this.add(this.nameLabelContainerFigure);
-
- this.nameLabel = new LifelineVerticalLabel();
- this.nameLabelContainerFigure.add(this.nameLabel);
- this.nameLabelContainerFigure.setLayoutManager(new CenterLayout());
-
- this.lifelineDataContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "CompactLifelineFigure_lifelineDataContainerFigure"; //$NON-NLS-1$
- };
- this.lifelineDataContainerFigure.setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- final Rectangle clientArea = container.getClientArea();
- final List<?> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure)children.get(i);
- if(child == getTimelineContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height - Constants.TIME_RULER_HEIGHT));
- } else if(child == getTimeRulerContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width, Constants.TIME_RULER_HEIGHT));
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
- add(this.lifelineDataContainerFigure);
-
- createDataContainerContents();
- }
-
- private void createDataContainerContents() {
- this.timelineContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "CompactLifelineFigure_compactTimelineContainerFigure"; //$NON-NLS-1$
- };
- this.lifelineDataContainerFigure.add(this.timelineContainerFigure);
-
- this.timeRulerContainerFigure = new TimeRulerFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "CompactLifelineFigure_timeRulerContainerFigure"; //$NON-NLS-1$
- };
- this.lifelineDataContainerFigure.add(this.timeRulerContainerFigure);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
deleted file mode 100644
index d0e6c45e69d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.GradientStyle;
-import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Pattern;
-import org.eclipse.swt.widgets.Display;
-
-public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
-
- public static final int PREFERRED_HEIGHT = 32;
-
- private final WrappingLabel label;
-
- private boolean infinite;
-
- /**
- * @param infinite
- * Whether the state has an end cap (the last state doesn't end)
- */
- public void setInfinite(final boolean infinite) {
- this.infinite = infinite;
- }
-
- public boolean isInfinite() {
- return this.infinite;
- }
-
- public CompactStateFigure() {
- super();
- setLayoutManager(new CenterLayout());
- this.label = new WrappingLabel();
- this.label.setAlignment(PositionConstants.CENTER);
- add(this.label);
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- // super.paintFigure(g);
-
- g.pushState();
- final int height = Math.min(PREFERRED_HEIGHT, this.bounds.height);
- final int middleY = this.bounds.y + this.bounds.height / 2;
- final int x = this.bounds.x;
- final int w = this.bounds.width - 1;
- final int y = middleY - height / 2;
- final int h = height - 1;
-
- g.setLineWidth(1);
-
- final int cornerSize = Math.min(h / 3, w / 3);
-
- final int[] polygon;
- if(this.infinite) {
- polygon = new int[]{ x, middleY, x + cornerSize, y, x + w + 1, y, x + w + 1, y + h, x + cornerSize, y + h };
- } else {
- polygon = new int[]{ x, middleY, x + cornerSize, y, x + w - cornerSize, y, x + w, middleY, x + w - cornerSize, y + h, x + cornerSize, y + h };
- }
- g.setAntialias(SWT.ON);
- if(isUsingGradient()) {
- applyTransparency(g);
- final Pattern pattern;
- // apparently, patterns are not scaled automatically, so we need to scale the pattern so that it fits the
- // current zoom level
- final double scale = g.getAbsoluteScale();
- final int xScaled = (int)(this.bounds.x * scale);
- final int yScaled = (int)(this.bounds.y * scale);
- final int widthScaled = (int)(this.bounds.width * scale);
- final int heightScaled = (int)(height * scale);
- if(getGradientStyle() == GradientStyle.VERTICAL) {
- pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled, yScaled + heightScaled, FigureUtilities.integerToColor(Integer.valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
- } else {
- pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled + widthScaled, this.bounds.y, FigureUtilities.integerToColor(Integer.valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
- }
- g.setBackgroundPattern(pattern);
- g.fillPolygon(polygon);
- g.drawPolygon(polygon);
- pattern.dispose();
- } else {
- g.setBackgroundColor(getBackgroundColor());
- g.setForegroundColor(getForegroundColor());
- // FIXME: the figure is not filled because the default fill color is black
- // g.fillPolygon(polygon);
- g.drawPolygon(polygon);
- }
- g.popState();
- // displayDebugFigure(g);
- }
-
- // private void displayDebugFigure(final Graphics g) {
- // g.pushState();
- // g.setForegroundColor(ColorConstants.red);
- // for (int x = 0; x < this.bounds.width - 1; x++) {
- // final int y = computeHalfHeightAtAbscissa(x, this.bounds.width, this.bounds.height, this.infinite);
- // g.drawRectangle(this.bounds.x + x, this.bounds.y + this.bounds.height / 2 - y, 1, 1);
- // g.drawRectangle(this.bounds.x + x, this.bounds.y + this.bounds.height / 2 + y - 1, 1, 1);
- // }
- // g.popState();
- // }
-
- /**
- * Compute the half height of a CompactStateFigure with the given width and height, at the given abscissa.
- * <p>
- * This function is useful in order to place an OccurrenceSpecification along the border of a StateInvariant.
- *
- * @param x
- * the x coordinate at which to compute the height
- * @param figureWidth
- * the width of the CompactStateFigure
- * @param figureHeight
- * the height of the CompactStateFigure
- * @param infinite
- * whether the figure ends with a cap (not infinite) or not (infinite)
- * @return the half height at the given position
- */
- public static int computeHalfHeightAtAbscissa(final int x, final int figureWidth, final int figureHeight, final boolean infinite) {
- final int height = Math.min(PREFERRED_HEIGHT, figureHeight);
- final int width = figureWidth;
- final int halfHeight = figureHeight / 2;
- final int cornerSize = Math.min(height / 3, width / 3);
-
- final int resultY;
- if(x < cornerSize) {
- // on the left corner
- final double slope = (height / 2.0) / cornerSize;
- resultY = (int)(x * slope);
- } else if(infinite) {
- // on the straight border
- resultY = halfHeight;
- } else if(x < width - cornerSize) {
- // on the straight border
- resultY = halfHeight;
- } else {
- // on the right corner
- final double slope = (double)halfHeight / cornerSize;
- resultY = (int)(halfHeight - ((x - width + cornerSize) * slope));
- }
- return resultY;
- }
-
- public WrappingLabel getCompactStateInvariantLabel() {
- return this.label;
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(-1, PREFERRED_HEIGHT);
- }
-
- @Override
- protected void paintBorder(final Graphics graphics) {
- // no border
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java
deleted file mode 100644
index 6ba498d597f..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-
-public class CrossFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
-
- public static final int CROSS_SIZE = 8;
-
- public CrossFigure() {
- super();
- setShadow(false);
- setBorder(null);
- }
-
- @Override
- public void paintFigure(final Graphics graphics) {
- super.paintFigure(graphics);
- graphics.pushState();
- graphics.setAntialias(SWT.ON);
- final Rectangle clipRect = graphics.getClip(new Rectangle());
- final int additionalSizeForCross = 10;
- // draw the cross outside its bounds so that the StateInvariant lines touch the base of the cross
- // instead of its invisible border
- graphics.setClip(new Rectangle(getBounds()).expand(additionalSizeForCross, additionalSizeForCross));
-
- final int x = this.bounds.x - additionalSizeForCross + 1;
- final int y = this.bounds.y - additionalSizeForCross + 1;
- final int w = this.bounds.width + additionalSizeForCross * 2;
- final int h = this.bounds.height + additionalSizeForCross * 2;
- final int z = Math.max(w / 8, 1);
-
- graphics.setLineWidth(z);
- graphics.setLineCap(SWT.CAP_ROUND);
- graphics.drawLine(x + z, y + z, x + w - z * 2, y + h - z * 2);
- graphics.drawLine(x + w - z * 2, y + z, x + z, y + h - z * 2);
- graphics.setClip(clipRect);
- graphics.popState();
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(CROSS_SIZE, CROSS_SIZE);
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java
deleted file mode 100644
index ec8e8a1d965..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.draw2d.InteractionFigure;
-import org.eclipse.papyrus.uml.diagram.common.draw2d.LeftToolbarLayout;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.InteractionRectangleFigure;
-
-public class CustomInteractionRectangleFigure extends InteractionRectangleFigure {
-
- private RectangleFigure timeRulerCompartment;
-
- public CustomInteractionRectangleFigure() {
- setLayoutManager(new ToolbarLayout());
- createContents();
- }
-
- @Override
- protected void createContents() {
- add(createInteractionFigureHeader());
- add(createContentPane());
- final int childrenSize = getChildren().size();
- add(createTimeRulerCompartment(), childrenSize);
- }
-
- protected IFigure createTimeRulerCompartment() {
- return this.timeRulerCompartment = new TimeRulerFigure();
- }
-
- protected InteractionFigure createInteractionFigureHeader() {
- this.interactionLabel = new WrappingLabel() {
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- final Dimension preferredSize = super.getPreferredSize(wHint, hHint);
- if(preferredSize.width == 0) {
- return preferredSize;
- }
- return new Dimension(preferredSize.width + 2, preferredSize.height + 2);
- }
- };
-
- this.interactionLabelContainer = new InteractionFigure();
- this.interactionLabelContainer.setBorder(new MarginBorder(3, 3, 0, 0));
- this.interactionLabelContainer.setLayoutManager(new LeftToolbarLayout());
-
- this.interactionLabelContainer.add(this.interactionLabel);
- return this.interactionLabelContainer;
- }
-
- public InteractionFigure getHeaderLabelContainer() {
- return this.interactionLabelContainer;
- }
-
- public RectangleFigure getTimeRulerContainerFigure() {
- return this.timeRulerCompartment;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.java
deleted file mode 100644
index e27e495f6e0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.SWT;
-
-public class DimensioningArrowFigure extends PapyrusNodeFigure {
-
- private static final int PREFERRED_HEIGHT = 11;
-
- public DimensioningArrowFigure() {
- super();
- setShadow(false);
- setBorder(null);
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- g.pushState();
-
- final int middleX = this.bounds.x + this.bounds.width / 2;
- final int middleY = this.bounds.y + this.bounds.height / 2;
- final int x = this.bounds.x;
- final int w = this.bounds.width - 1;
- final int horizontalGap = w / 3;
- final int arrowSize = Math.max(Math.min(w / 5, 7), 3);
- final int verticalLineSize = arrowSize * 3;
-
- g.setLineWidth(1);
-
- // horizontal line (left part)
- g.drawLine(x, middleY, middleX - horizontalGap / 2, middleY);
- // horizontal line (right part)
- g.drawLine(middleX + horizontalGap / 2, middleY, x + w, middleY);
- // left vertical line
- g.drawLine(x, middleY - verticalLineSize / 2, x, middleY + verticalLineSize / 2);
- // right vertical line
- g.drawLine(x + w, middleY - verticalLineSize / 2, x + w, middleY + verticalLineSize / 2);
-
- g.setAntialias(SWT.ON);
- // left arrow
- g.drawLine(x, middleY, x + arrowSize, middleY - arrowSize);
- g.drawLine(x, middleY, x + arrowSize, middleY + arrowSize);
- // right arrow
- g.drawLine(x + w, middleY, x + w - arrowSize, middleY - arrowSize);
- g.drawLine(x + w, middleY, x + w - arrowSize, middleY + arrowSize);
-
- g.popState();
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(-1, PREFERRED_HEIGHT);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
deleted file mode 100644
index 8bd8febf7b2..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Ellipse;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Color;
-
-public class EllipseDecoration extends Ellipse implements RotatableDecoration {
-
- public EllipseDecoration() {
- setPreferredSize(new Dimension(5, 5));
- }
-
- @Override
- public void setLocation(final Point p) {
- final Dimension delta = getPreferredSize().getScaled(0.5).getNegated();
- super.setLocation(p.getTranslated(delta));
- }
-
- public void setReferencePoint(final Point p) {
- // nothing
- }
-
- @Override
- protected void fillShape(final Graphics graphics) {
- final Color oldBack = graphics.getBackgroundColor();
- graphics.setBackgroundColor(graphics.getForegroundColor());
- graphics.fillOval(getOptimizedBounds());
- graphics.setBackgroundColor(oldBack);
- }
-
- private Rectangle getOptimizedBounds() {
- final float lineInset = Math.max(1.0f, getLineWidthFloat()) / 2.0f;
- final int inset = (int)Math.floor(lineInset);
- final Rectangle r = Rectangle.SINGLETON.setBounds(getBounds());
- r.x += inset;
- r.y += inset;
- return r;
- }
-
- @Override
- protected void outlineShape(final Graphics graphics) {
- // no outline
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java
deleted file mode 100644
index cb8518510dc..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
-
-public class FullLifelineFigure extends LifelineFigure {
-
- private RectangleFigure stateDefinitionContainerFigure;
-
- // Chronogram contains statedefinition and timeline
- private RectangleFigure chronogramContainerFigure;
-
- @Override
- protected void createContents() {
- this.nameLabelContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "FullLifelineFigure_nameLabelContainerFigure"; //$NON-NLS-1$
- };
- add(this.nameLabelContainerFigure);
-
- this.nameLabel = new LifelineVerticalLabel();
- this.nameLabelContainerFigure.add(this.nameLabel);
- this.nameLabelContainerFigure.setLayoutManager(new CenterLayout());
-
- this.lifelineDataContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "FullLifelineFigure_lifelineDataContainerFigure"; //$NON-NLS-1$
- };
- this.lifelineDataContainerFigure.setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- final Rectangle clientArea = container.getClientArea();
- final List<?> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure)children.get(i);
- if(child == getChronogramContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height - Constants.TIME_RULER_HEIGHT));
- } else if(child == getTimeRulerContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width, Constants.TIME_RULER_HEIGHT));
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
-
- add(this.lifelineDataContainerFigure);
- createDataContainerContents();
-
- }
-
- private void createDataContainerContents() {
- this.chronogramContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "FullLifelineFigure_chronogramContainerFigure"; //$NON-NLS-1$
- };
- this.lifelineDataContainerFigure.add(this.chronogramContainerFigure);
- this.chronogramContainerFigure.setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- final Rectangle clientArea = container.getClientArea();
- final List<?> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure)children.get(i);
- if(child == getStateDefinitionContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
- } else if(child == getTimelineContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x + Constants.STATE_DEFINITIONS_WIDTH, clientArea.y, clientArea.width - Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
- createChronogramContainerContents();
-
- this.timeRulerContainerFigure = new TimeRulerFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "FullLifelineFigure_timeRulerContainerFigure"; //$NON-NLS-1$
- };
- this.lifelineDataContainerFigure.add(this.timeRulerContainerFigure);
- }
-
- private void createChronogramContainerContents() {
-
- this.stateDefinitionContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "FullLifelineFigure_stateDefinitionContainerFigure"; //$NON-NLS-1$
- };
- this.chronogramContainerFigure.add(this.stateDefinitionContainerFigure);
-
- this.timelineContainerFigure = new InvisibleRectangleFigure() {
-
- @SuppressWarnings("unused")
- String DEBUG_ID = "FullLifelineFigure_timelineContainerFigure"; //$NON-NLS-1$
- };
- this.chronogramContainerFigure.add(this.timelineContainerFigure);
- }
-
- public RectangleFigure getStateDefinitionContainerFigure() {
- return this.stateDefinitionContainerFigure;
- }
-
- public RectangleFigure getChronogramContainerFigure() {
- return this.chronogramContainerFigure;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java
deleted file mode 100644
index 8e2b5e59883..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Image;
-
-public class FullStateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
-
- private int posY;
-
- public FullStateFigure() {
- super();
- setBorder(null);
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- // super.paintFigure(g);
- g.pushState();
-
- // DEBUG
- // g.setLineDash(new int[] { 1, 5 });
- // g.drawRectangle(this.bounds.x, this.bounds.y, this.bounds.width - 1, this.bounds.height - 1);
- // g.setLineDash(new int[] {});
- // END DEBUG
-
- // final int y = this.bounds.y;
- final int x = this.bounds.x;
- final int w = this.bounds.width;
- final int y = this.posY;
-
- g.setLineWidth(1);
- g.drawLine(x, y, x + w, y);
-
- g.popState();
- }
-
- public void setPosY(final int endY) {
- this.posY = endY;
- }
-
- @Override
- protected void paintBorder(final Graphics graphics) {
- // no border
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.java
deleted file mode 100644
index 9b1b047efed..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-
-public class FullStateInvariantVerticalLineFigure extends PapyrusNodeFigure {
-
- public FullStateInvariantVerticalLineFigure() {
- super();
- setBorder(null);
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- // super.paintFigure(g);
- g.setLineWidth(1);
- final int middleX = this.bounds.x + this.bounds.width / 2;
- g.drawLine(middleX, this.bounds.y, middleX, this.bounds.y + this.bounds.height);
- }
-
- @Override
- protected void paintBorder(final Graphics graphics) {
- // no border
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.java
deleted file mode 100644
index f397f2a31ae..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Image;
-
-public class GateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
-
- public static final int SQUARE_SIZE = 5;
-
- public GateFigure() {
- super();
- setShadow(false);
- setBorder(null);
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- g.pushState();
-
- final int middleX = this.bounds.x + this.bounds.width / 2;
- final int middleY = this.bounds.y + this.bounds.height / 2;
-
- g.setLineWidth(1);
-
- g.fillRectangle(middleX - SQUARE_SIZE / 2, middleY - SQUARE_SIZE / 2, SQUARE_SIZE, SQUARE_SIZE);
- g.popState();
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(SQUARE_SIZE, SQUARE_SIZE);
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // nothing
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java
deleted file mode 100644
index 1e2ba26aecc..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.SWT;
-
-public class GeneralOrderingHorizontalFigure extends PapyrusNodeFigure {
-
- private static final int PREFERRED_HEIGHT = 11;
-
- public GeneralOrderingHorizontalFigure() {
- super();
- setShadow(false);
- setBorder(null);
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- g.pushState();
-
- final int middleX = this.bounds.x + this.bounds.width / 2;
- final int middleY = this.bounds.y + this.bounds.height / 2;
- final int x = this.bounds.x;
- final int w = this.bounds.width - 1;
- final int arrowSize = Math.max(Math.min(w / 3, 12), 6);
- final int a = arrowSize / 2;
-
- g.setLineWidth(1);
-
- // horizontal line
- g.setLineDash(new int[]{ 4, 4 });
- g.drawLine(x, middleY, x + w, middleY);
- g.setLineDash(new int[]{});
-
- // arrow
- g.setAntialias(SWT.ON);
- g.setBackgroundColor(getForegroundColor());
- g.fillPolygon(new int[]{ middleX - a, this.bounds.y, middleX + a, middleY, middleX - a, this.bounds.y + this.bounds.height });
-
- g.popState();
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(-1, PREFERRED_HEIGHT);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
deleted file mode 100644
index 4ee68b24b97..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RectangleFigure;
-
-/** A rectangle that is not painted: useful for simplifying layouts */
-public class InvisibleRectangleFigure extends RectangleFigure {
-
- /**
- * Creates a RectangleFigure.
- */
- public InvisibleRectangleFigure() {
- }
-
- /**
- * @see Shape#fillShape(Graphics)
- */
- @Override
- protected void fillShape(final Graphics graphics) {
- // don't fill
- }
-
- /**
- * @see Shape#outlineShape(Graphics)
- */
- @Override
- protected void outlineShape(final Graphics graphics) {
- // don't draw an outline
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
deleted file mode 100644
index e979c65d193..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Image;
-
-public class LifelineFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- protected final int LABEL_WIDTH = 30;
-
- protected RectangleFigure nameLabelContainerFigure;
-
- protected LifelineVerticalLabel nameLabel;
-
- protected RectangleFigure timeRulerContainerFigure;
-
- protected RectangleFigure lifelineDataContainerFigure;
-
- protected RectangleFigure timelineContainerFigure;
-
- private boolean selected;
-
- private boolean displayTimeRuler;
-
- public LifelineFigure() {
- setShadow(false);
- createContents();
- setLayoutManager(new AbstractLayout() {
-
- public void layout(final IFigure container) {
- final Rectangle clientArea = container.getClientArea();
- final List<?> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure)children.get(i);
- if(child == getNameLabelContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y, LifelineFigure.this.LABEL_WIDTH, clientArea.height));
- } else if(child == getLifelineDataContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x + LifelineFigure.this.LABEL_WIDTH, clientArea.y, clientArea.width - LifelineFigure.this.LABEL_WIDTH, clientArea.height));
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
- });
- }
-
- protected void createContents() {
- // meant to be overridden
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.draw2d.Figure#setPreferredSize(org.eclipse.draw2d.geometry.Dimension)
- */
- @Override
- public void setPreferredSize(final Dimension size) {
- final IFigure container = getParent();
- final int childrenSize = container.getChildren().size();
- final Rectangle containerRectangle = container.getBounds();
- final Rectangle resultBounds = new Rectangle(0, 0, containerRectangle.width(), containerRectangle.height() / childrenSize);
- this.prefSize = resultBounds.getSize();
- }
-
- public void setSelected(final boolean selected) {
- this.selected = selected;
- }
-
- @Override
- public void paintFigure(final Graphics graphics) {
- super.paintFigure(graphics);
- if(this.selected) {
- graphics.pushState();
- graphics.setForegroundColor(ColorConstants.black);
- graphics.setLineWidth(1);
- graphics.drawRectangle(getBounds().getShrinked(1, 1).resize(-1, -1));
- graphics.popState();
- }
- }
-
- public boolean isDisplayTimeRuler() {
- return this.displayTimeRuler;
- }
-
- public void setDisplayTimeRuler(final boolean visible) {
- this.displayTimeRuler = visible;
- }
-
- public LifelineVerticalLabel getLifelineLabelFigure() {
- return this.nameLabel;
- }
-
- public RectangleFigure getNameLabelContainerFigure() {
- return this.nameLabelContainerFigure;
- }
-
- public RectangleFigure getTimelineContainerFigure() {
- return this.timelineContainerFigure;
- }
-
- public RectangleFigure getTimeRulerContainerFigure() {
- return this.timeRulerContainerFigure;
- }
-
- public RectangleFigure getLifelineDataContainerFigure() {
- return this.lifelineDataContainerFigure;
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // TODO implement LifelineFigure#setStereotypeDisplay
- }
-
- public void setStereotypePropertiesInBrace(final String stereotypeProperties) {
- // TODO implement LifelineFigure#setStereotypePropertiesInBrace
- }
-
- public void setStereotypePropertiesInCompartment(final String stereotypeProperties) {
- // TODO implement LifelineFigure#setStereotypePropertiesInCompartment
- }
-
- public Label getStereotypesLabel() {
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
deleted file mode 100644
index 9db8f3be301..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-
-public class LifelineVerticalLabel extends VerticalLabel implements ILabelFigure {
-
- private boolean selected;
-
- private boolean focus;
-
- @Override
- public Color getBackgroundColor() {
- if(this.selected) {
- return Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION);
- }
- // the transparency color for the label
- return ColorConstants.white;
- }
-
- @Override
- public Color getForegroundColor() {
- if(this.selected) {
- return Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
- }
- return super.getForegroundColor();
- }
-
- @Override
- public String getText() {
- final String text = super.getText();
- // vertical label triggers IllegalArgumentException if text is empty
- return text == null || "".equals(text) ? " " : text; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- public void setIcon(final Image icon) {
- // no icon
- }
-
- public Image getIcon() {
- return null;
- }
-
- public void setSelected(final boolean value) {
- this.selected = value;
- // display the blue background when the figure is selected
- setOpaque(value);
- updateImage();
- }
-
- public void setFocus(final boolean value) {
- this.focus = value;
- repaint();
- }
-
- @Override
- protected void paintFigure(final Graphics graphics) {
- super.paintFigure(graphics);
- if(this.focus) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.java
deleted file mode 100644
index 5a5cbb4eeab..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.PolylineDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageAsyncFigure extends AbstractMessageFigure {
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final PolylineDecoration df = new PolylineDecoration();
- df.setForegroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- df.setTemplate(pl);
- return df;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.java
deleted file mode 100644
index f61206b6961..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolylineDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageCreateFigure extends AbstractMessageFigure {
-
- public MessageCreateFigure() {
- super();
- setLineStyle(Graphics.LINE_DASH);
- }
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final PolylineDecoration df = new PolylineDecoration();
- df.setForegroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- df.setTemplate(pl);
- return df;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
deleted file mode 100644
index 10499a9fd3e..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageDeleteFigure extends AbstractMessageFigure {
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final PolygonDecoration df = new PolygonDecoration() {
-
- @Override
- protected void outlineShape(final Graphics g) {
- // no outline: this is a filled arrow
- }
- };
- df.setFill(true);
- df.setForegroundColor(getForegroundColor());
- df.setBackgroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- df.setTemplate(pl);
- return df;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java
deleted file mode 100644
index 9b1219efc44..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.PolylineDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageFoundFigure extends AbstractMessageFigure {
-
- @Override
- protected RotatableDecoration createSourceDecoration() {
- final EllipseDecoration df = new EllipseDecoration();
- df.setPreferredSize(new Dimension(10, 10));
- return df;
- }
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final PolylineDecoration df = new PolylineDecoration();
- df.setForegroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- df.setTemplate(pl);
- return df;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java
deleted file mode 100644
index 1d081643a43..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.ArrowLocator;
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.PolylineDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageLostFigure extends AbstractMessageFigure {
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final EllipseDecoration df = new EllipseDecoration();
- df.setPreferredSize(new Dimension(10, 10));
- // add the ellipse as a child figure
- add(df, new ArrowLocator(this, ConnectionLocator.TARGET));
-
- final PolylineDecoration arrow = new PolylineDecoration();
- arrow.setForegroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- arrow.setTemplate(pl);
-
- return arrow;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java
deleted file mode 100644
index dea5be003a8..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageReplyFigure extends AbstractMessageFigure {
-
- public MessageReplyFigure() {
- super();
- setLineStyle(Graphics.LINE_DASH);
- }
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final PolygonDecoration df = new PolygonDecoration();
- df.setFill(true);
- df.setForegroundColor(getForegroundColor());
- df.setBackgroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- df.setTemplate(pl);
- return df;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
deleted file mode 100644
index 7e50f113df1..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.RotatableDecoration;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class MessageSyncFigure extends AbstractMessageFigure {
-
- @Override
- protected RotatableDecoration createTargetDecoration() {
- final PolygonDecoration df = new PolygonDecoration() {
-
- @Override
- protected void outlineShape(final Graphics g) {
- // no outline: this is a filled arrow
- }
- };
- df.setFill(true);
- df.setForegroundColor(getForegroundColor());
- df.setBackgroundColor(getForegroundColor());
- final PointList pl = new PointList();
- final IMapMode mapMode = getMapMode();
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
- pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
- df.setTemplate(pl);
- return df;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java
deleted file mode 100644
index b837dd49b4e..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Image;
-
-public class SmallSquareFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
-
- public static final int SQUARE_SIZE = 5;
-
- /** How many pixels the Figure must be moved upwards and leftwards in order to center it */
- public static final int RADIUS = SQUARE_SIZE / 2;
-
- public SmallSquareFigure() {
- super();
- }
-
- @Override
- public void paintFigure(final Graphics g) {
- g.pushState();
-
- final int middleX = this.bounds.x + this.bounds.width / 2;
- final int middleY = this.bounds.y + this.bounds.height / 2;
-
- g.setLineWidth(1);
-
- g.fillRectangle(middleX - SQUARE_SIZE / 2, middleY - SQUARE_SIZE / 2, SQUARE_SIZE, SQUARE_SIZE);
- g.popState();
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(SQUARE_SIZE, SQUARE_SIZE);
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // nothing
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
deleted file mode 100644
index 502914419b3..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
-
-public class StateDefinitionFigure extends NodeNamedElementFigure {
-
- private boolean selected;
-
- public StateDefinitionFigure() {
- super();
- setShadow(false);
- setBorder(null);
- }
-
- public void setSelected(final boolean selected) {
- this.selected = selected;
- }
-
- public boolean isSelected() {
- return this.selected;
- }
-
- @Override
- public void paintFigure(final Graphics graphics) {
- paintClientArea(graphics);
- paintFocusRectangle(graphics);
- }
-
- @Override
- protected void paintClientArea(final Graphics graphics) {
- super.paintClientArea(graphics);
- }
-
- private void paintFocusRectangle(final Graphics g) {
- if(isSelected()) {
- g.pushState();
- g.setXORMode(true);
- g.setForegroundColor(ColorConstants.menuBackgroundSelected);
- g.setBackgroundColor(ColorConstants.menuForegroundSelected);
- final Rectangle b = getBounds();
- final Rectangle focusRect = new Rectangle(b.x, b.y, b.width - 1, b.height - 1);
- g.setLineWidth(1);
- g.drawFocus(focusRect);
- g.popState();
- }
- }
-
- @Override
- protected void paintBorder(final Graphics graphics) {
- // no border
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java
deleted file mode 100644
index 9bd2d289b2d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class TimeRulerFigure extends InvisibleRectangleFigure {
-
- @Override
- protected void outlineShape(final Graphics graphics) {
- final Rectangle bounds = getBounds();
- graphics.setForegroundColor(ColorConstants.gray);
- graphics.drawLine(bounds.getTopLeft(), bounds.getTopRight());
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java
deleted file mode 100644
index 13ad551db62..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
-
-public class TimingRulerFigure extends InvisibleRectangleFigure {
-
- private final InvisibleRectangleFigure tickContainer;
-
- public TimingRulerFigure() {
- super();
- this.tickContainer = new InvisibleRectangleFigure();
- this.tickContainer.setLayoutManager(new FillLayout());
- add(this.tickContainer);
- }
-
- public IFigure getTickContainerFigure() {
- return this.tickContainer;
- }
-
- public IFigure getFreeTimeRulerContainerFigure() {
- return this.tickContainer;
- }
-
- public IFigure getLinearTimeRulerContainerFigure() {
- return this.tickContainer;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
deleted file mode 100644
index 53d5565cd91..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.AbstractImageFigure;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.Transform;
-import org.eclipse.swt.widgets.Display;
-
-public class VerticalLabel extends AbstractImageFigure {
-
- private Image img;
-
- private String myText;
-
- private Font myImageFont;
-
- private Color myForegroundColor;
-
- private Color myBackgroundColor;
-
- @Override
- protected void paintFigure(final Graphics g) {
- final Image image = getImage();
- if(image != null) {
- g.drawImage(image, this.bounds.x, this.bounds.y);
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void addNotify() {
- updateImage();
- super.addNotify();
- }
-
- /** {@inheritDoc} */
- @Override
- public void removeNotify() {
- if(this.img != null) {
- this.img.dispose();
- this.img = null;
- }
- super.removeNotify();
- }
-
- /** {@inheritDoc} */
- public Image getImage() {
- boolean update = false;
- if(this.myImageFont != getFont()) {
- this.myImageFont = getFont();
- update = true;
- }
- if(needsUpdate(this.myForegroundColor, getForegroundColor())) {
- this.myForegroundColor = getForegroundColor();
- update = true;
- }
- if(needsUpdate(this.myBackgroundColor, getBackgroundColor())) {
- this.myBackgroundColor = getBackgroundColor();
- update = true;
- }
-
- if(update) {
- updateImage();
- }
- return this.img;
- }
-
- /**
- * Updates the image with the string provided.
- *
- * @param text
- * to display
- */
- public void setText(final String text) {
- this.myText = text;
- updateImage();
- }
-
- public String getText() {
- return this.myText;
- }
-
- /**
- * Redraws / creates the image of the rotated String.
- *
- * @return image created
- */
- public void updateImage() {
- if(this.img != null) {
- this.img.dispose();
- this.img = null;
- }
- if(getText() == null || getFont() == null) {
- return;
- }
- setImage(createRotatedImageOfString(getText(), getFont(), getForegroundColor(), getBackgroundColor(), isOpaque()));
- }
-
- private void setImage(final Image image) {
- if(this.img == image) {
- return;
- }
- this.img = image;
- revalidate();
- notifyImageChanged();
- repaint();
- }
-
- public static Image createRotatedImageOfString(final String string, final Font font, final Color foreground, final Color background, final boolean opaque) {
- final Display display = Display.getDefault();
-
- final FontMetrics metrics = FigureUtilities.getFontMetrics(font);
- final Dimension strSize = FigureUtilities.getStringExtents(string, font);
-
- final int height = strSize.width;
- final int width = metrics.getAscent() + metrics.getDescent() + metrics.getLeading();
-
- final ImageData data = new ImageData(width, height, 32, new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000));
- if(!opaque) {
- data.transparentPixel = data.palette.getPixel(background.getRGB());
- }
-
- final Image image = new Image(display, data);
- final GC gc = new GC(image);
- gc.setFont(font);
- gc.setBackground(background);
- gc.fillRectangle(image.getBounds());
- gc.setForeground(foreground);
- final Transform transform = new Transform(Display.getCurrent());
- transform.translate(0, height);
- transform.rotate(-90);
- gc.setTransform(transform);
- gc.drawString(string, 0, 0, true);
- gc.dispose();
- return image;
- }
-
- private static final boolean needsUpdate(final Color cachedColor, final Color actualColor) {
- if(cachedColor == null && actualColor == null) {
- return false;
- }
- return cachedColor == null || !cachedColor.equals(actualColor);
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- if(this.img != null) {
- return new Rectangle(this.img.getBounds()).getSize();
- }
- return super.getPreferredSize(wHint, hHint);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
deleted file mode 100644
index 29859a226a6..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.swt.graphics.Image;
-
-public class VerticalMarkFigure extends org.eclipse.draw2d.Figure implements IPapyrusUMLElementFigure {
-
- public static final int PREFERRED_WIDTH = 5;
-
- public static final int PREFERRED_HEIGHT = 12;
-
- public VerticalMarkFigure() {
- super();
- }
-
- @Override
- protected void paintFigure(final Graphics g) {
- super.paintFigure(g);
- g.pushState();
- final int middleX = this.bounds.x + this.bounds.width / 2;
- g.setLineWidth(3);
- g.drawLine(middleX, this.bounds.y, middleX, this.bounds.y + this.bounds.height);
- g.popState();
- }
-
- @Override
- public Dimension getPreferredSize(final int wHint, final int hHint) {
- return new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT);
- }
-
- public void setStereotypeDisplay(final String stereotypes, final Image image) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java
deleted file mode 100644
index 4046168e1d9..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.helper;
-
-import java.util.Collection;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonSourceUMLSwitch;
-import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonTargetUMLSwitch;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * Specialization of the link mapping helper for the timing diagram
- */
-public class TimingDiagramLinkMappingHelper implements ILinkMappingHelper {
-
- private static TimingDiagramLinkMappingHelper INSTANCE;
-
- /**
- * Gets the single instance of {@link TimingDiagramLinkMappingHelper}.
- *
- * @return single instance of {@link TimingDiagramLinkMappingHelper}
- */
- public static TimingDiagramLinkMappingHelper getInstance() {
- if(INSTANCE == null) {
- INSTANCE = new TimingDiagramLinkMappingHelper();
- }
- return INSTANCE;
- }
-
- private TimingDiagramLinkMappingHelper() {
- // singleton helper
- }
-
- public Collection<?> getSource(final Element link) {
- // TODO: define source link mapping
- return LinkMappingHelper.getSource(link, new CommonSourceUMLSwitch() {
- // @Override
- // public Collection<?> caseGeneralOrdering(final GeneralOrdering object) {
- // return Collections.singleton(object.getBefore());
- // }
- });
- }
-
- public Collection<?> getTarget(final Element link) {
- // TODO: define target link mapping
- return LinkMappingHelper.getTarget(link, new CommonTargetUMLSwitch() {
- // @Override
- // public Collection<?> caseGeneralOrdering(final GeneralOrdering object) {
- // return Collections.singleton(object.getAfter());
- // }
- });
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
deleted file mode 100644
index 4e44ce591ad..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-
-/** This HelperAdvice disapproves destroy requests for VerticalLines. */
-public class DefaultTypeHelperAdvice extends AbstractEditHelperAdvice {
-
- private static String VERTICAL_LINE_ID = Integer.toString(FullStateInvariantVerticalLineEditPart.VISUAL_ID);
-
- @Override
- public boolean approveRequest(final IEditCommandRequest request) {
- if(request instanceof DestroyElementRequest) {
- final DestroyElementRequest destroyElementRequest = (DestroyElementRequest)request;
- final EObject elementToDestroy = destroyElementRequest.getElementToDestroy();
- if(elementToDestroy instanceof View) {
- final View view = (View)elementToDestroy;
- if(VERTICAL_LINE_ID.equals(view.getType()) && TimingDiagramEditPart.MODEL_ID == ViewUtils.getContainingDiagramType(view)) {
- return false;
- }
- }
- }
- return super.approveRequest(request);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java
deleted file mode 100644
index 7357fccc600..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.GateUtils;
-import org.eclipse.uml2.uml.Gate;
-
-/**
- * This HelperAdvice completes {@link Gate} edit commands with commands specific to the timing diagram in order to keep
- * the model consistent when deleting a {@link Gate}.
- */
-public class GateHelperAdvice extends AbstractEditHelperAdvice {
-
- @Override
- protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
- final EObject destructee = request.getElementToDestroy();
- if(destructee instanceof Gate) {
- final Gate gate = (Gate)destructee;
- final Collection<EObject> elementsToDestroy = GateUtils.getElementsToDelete(gate);
- if(!elementsToDestroy.isEmpty()) {
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.GateHelperAdvice_DestroyGate);
- // destroy related elements
- for(final EObject eObject : elementsToDestroy) {
- final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
- final DestroyElementCommand destroyElementCommand = new DestroyElementCommand(destroyElementRequest);
- if(destroyElementCommand.canExecute()) {
- compositeCommand.add(destroyElementCommand);
- }
- }
- return compositeCommand;
- }
- }
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
deleted file mode 100644
index 2ffc4272555..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
-
-import java.util.Collection;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-/**
- * This HelperAdvice completes {@link OccurrenceSpecification} edit commands with commands specific to the timing
- * diagram in order to keep the model and diagram consistent when deleting an {@link OccurrenceSpecification}.
- */
-public class OccurrenceSpecificationHelperAdvice extends AbstractEditHelperAdvice {
-
- @Override
- protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
- final EObject destructee = request.getElementToDestroy();
- if(destructee instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)destructee;
- final Collection<EObject> elementsToDestroy = OccurrenceSpecificationUtils.getElementsToDelete(occurrenceSpecification);
- if(!elementsToDestroy.isEmpty()) {
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification);
- // destroy related elements
- for(final EObject eObject : elementsToDestroy) {
- final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
- final DestroyElementCommand destroyElementCommand = new DestroyElementCommand(destroyElementRequest);
- if(destroyElementCommand.canExecute()) {
- compositeCommand.add(destroyElementCommand);
- }
- }
- final IUndoableOperation updateFragmentNamesCommand = LifelineUtils.getUpdateFragmentNamesCommand(occurrenceSpecification);
- if(updateFragmentNamesCommand != null) {
- compositeCommand.add(updateFragmentNamesCommand);
- }
- return compositeCommand;
- }
- }
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
deleted file mode 100644
index 8e3ddff7506..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
-
-import java.util.Collection;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.OperationForbiddenException;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.uml2.uml.StateInvariant;
-
-/**
- * This HelperAdvice completes {@link StateInvariant} edit commands with commands specific to the timing diagram in
- * order to keep the model and diagram consistent when deleting a {@link StateInvariant}.
- */
-public class StateInvariantHelperAdvice extends AbstractEditHelperAdvice {
-
- @Override
- protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
- final EObject destructee = request.getElementToDestroy();
- if(destructee instanceof StateInvariant) {
- try {
- final StateInvariant stateInvariant = (StateInvariant)destructee;
- final Collection<EObject> elementsToDestroy = StateInvariantUtils.getElementsToDelete(stateInvariant);
- if(!elementsToDestroy.isEmpty()) {
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.StateInvariantHelperAdvice_DestroyStateInvariant);
-
- for(final EObject eObject : elementsToDestroy) {
- final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
- compositeCommand.add(new DestroyElementCommand(destroyElementRequest));
- }
- final IUndoableOperation updateFragmentNamesCommand = LifelineUtils.getUpdateFragmentNamesCommand(stateInvariant);
- if(updateFragmentNamesCommand != null) {
- compositeCommand.add(updateFragmentNamesCommand);
- }
- return compositeCommand;
- }
- } catch (final OperationForbiddenException e) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
deleted file mode 100644
index 1d365eb2a64..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.layouts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.FreeformLayer;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class FillLayout extends AbstractLayout {
-
- public void layout(final IFigure container) {
- final Rectangle clientArea = container.getClientArea();
- final List<?> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure)children.get(i);
- child.setBounds(clientArea);
- if(child instanceof FreeformLayer) {
- final FreeformLayer freeformLayer = (FreeformLayer)child;
- freeformLayer.setFreeformBounds(clientArea);
- }
- }
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java
deleted file mode 100644
index ef14640691a..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.layouts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class TimeRulerLayout extends AbstractLayout {
-
- public void layout(final IFigure container) {
- // reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- // if (!(container.getParent().getLayoutManager() instanceof FillLayout)) {
- // container.getParent().setLayoutManager(new FillLayout());
- // }
-
- // The grand-parent is a FreeformViewport, which lets its child expand outside of its clientArea, and
- // constantly resets the bounds (in org.eclipse.draw2d.FreeformViewport#readjustScrollBars)
- // So, layout based on the grand-parent's clientArea.
- final Rectangle clientArea = container.getParent().getClientArea();
- @SuppressWarnings("unchecked")
- final List<IFigure> children = container.getChildren();
- for(int i = 0; i < children.size(); i++) {
- final IFigure child = children.get(i);
- child.setBounds(clientArea);
- }
-
- }
-
- @Override
- protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
- return new Dimension(-1, -1);
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.java
deleted file mode 100644
index 027ea9a0be0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.locator;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-
-/**
- * Lets the user move a Label anywhere inside its containing compartment, but don't let the label stick out of the
- * compartment.
- */
-public class LabelInCompartmentLocator extends ExternalLabelPositionLocator {
-
- public LabelInCompartmentLocator(final IFigure parentFigure) {
- super(parentFigure);
- }
-
- @Override
- public Rectangle getValidLocation(final Rectangle proposedLocation, final IFigure borderItem) {
- return FigureUtils.constrainBoundsWithinContainingCompartment(proposedLocation, borderItem);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties
deleted file mode 100644
index bcd7961a0d6..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties
+++ /dev/null
@@ -1,93 +0,0 @@
-###############################################################################
-# Copyright (c) 2012 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
-###############################################################################
-AbstractTimelineLayoutPolicy_MoveOccurrenceSpecification=Move OccurrenceSpecification
-AbstractTimelineLayoutPolicy_UpdateLocationOfTimeElements=Update Location of Time Elements
-AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification=Create Occurrence Specification
-ChangeLifelineFromCompactToFull_commandLabel=Change Lifeline From Compact To Full
-ChangeLifelineFromFullToCompact_commandLabel=Change Lifeline From Full To Compact
-CompactStateInvariantNameParser_SetStateInvariantName=Set State Invariant Name
-CompactStateInvariantNameParser_Unnamed=<unnamed>
-CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_CreateStateInvariant=Create State Invariant
-CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant=Initialize State Invariant
-CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement=Move element
-CustomCompactLifelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification=Move OccurrenceSpecification
-CustomCompactLifelineCompartmentLayoutEditPolicy_ResizeStateInvariant=Resize StateInvariant
-CustomCompactStateInvariantEditPartCN_CreateOccurrenceSpecification=Create OccurrenceSpecification
-CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition=Create State Definition
-CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition=Initialize State Definition
-CustomFullLifelineStateDefinitionCompartmentEditPartCN_AddStateDefinitionsHere=add State Definitions here
-CustomFullStateInvariantEditPartCN_CreateOccurrenceSpecification=Create OccurrenceSpecification
-hideStateInvariant=Hide StateInvariant
-CustomInteractionCompartmentCreationEditPolicy_CreateCompactLifeline=Create Compact Lifeline
-CustomInteractionCompartmentCreationEditPolicy_CreateFullLifeline=Create Full Lifeline
-CustomInteractionCreationEditPolicy_CreateGate=Create Gate
-CustomInteractionCreationEditPolicy_PositionGate=Position Gate
-CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation=Set MessageFound source location
-CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation=Set MessageLost target location
-OccurrenceSpecificationUtils_DestroyOccurrenceSpecification=Destroy OccurrenceSpecification
-OccurrenceSpecificationUtils_HideOccurrenceSpecification=Hide OccurrenceSpecification
-LifelineUtils_CreationOccurrence=Creation
-LifelineUtils_DestructionOccurrence=Destruction
-LifelineUtils_UpdateFragmentNames=Update Fragment Names
-LifelineUtils_UpdateLifelineFragmentNames=Update Lifeline Fragment Names
-CustomPaletteFactory_SetFoundMessageTarget=Set FoundMessage target
-CustomPaletteFactory_SetLostMessageOrigin=Set LostMessage origin
-CustomStateDefinitionEditPart_DeleteStateDefinition=Delete StateDefinition
-CustomTimelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification=Move OccurrenceSpecification
-CustomTimelineCompartmentLayoutEditPolicy_MoveStateInvariant=Move State Invariant
-CustomTimelineCompartmentLayoutEditPolicy_MoveVerticalLine=Move Vertical Line
-CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant=Update State Invariant
-CutAndInsertOccurrenceSpecificationCommand_CreateOccurrenceSpecification=Create Occurrence Specification
-CutAndInsertOccurrenceSpecificationCompactLifelineCommand_CreateOccurrenceSpecification=Create Occurrence Specification
-DeleteStateDefinitionCommand_DeleteStateDefinition=Delete StateDefinition
-DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification=Create DestructionOccurrenceSpecification
-DropUtils_DropElement=Drop Element
-DropUtils_DropGate=Drop Gate
-DurationCreationTool_ClickEndElement=Click on the end element of the duration (OccurrenceSpecification or StateInvariant)
-DurationCreationTool_ClickStartElement=Click on the start element of the duration (OccurrenceSpecification or StateInvariant)
-ModelValidationUtils_CoveredByFragmentsWereReOrdered={0} fragments in the Lifeline\#coveredBy list were re-ordered to match the Interaction\#fragments list.
-ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification={0} fragments after a DestructionOccurrenceSpecification was found.
-ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification={0} fragments after a DestructionOccurrenceSpecification was removed.
-ModelValidationUtils_MissingOccurrenceSpecificationAdded={0} missing OccurrenceSpecification between StateInvariants was added.
-ModelValidationUtils_MissingOccurrenceSpecificationFound={0} missing OccurrenceSpecification between StateInvariants was found.
-ModelValidationUtils_ModelValidation=Model Validation
-OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification=Create OccurrenceSpecification
-OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification=Destroy OccurrenceSpecification
-OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName=Set OccurrenceSpecification Name
-StateDefinitionParser_SetStateDefinitionName=Set State Definition Name
-StateDefinitionParser_Unnamed=<unnamed>
-StateDefinitionUtils_State=State
-StateInvariantHelperAdvice_DestroyStateInvariant=Destroy StateInvariant
-SwitchLifelineCommand_createLifelineFragments=Create Lifeline Fragments
-SwitchLifelineCommand_CreateLinkedElements=Create Linked Elements
-SwitchLifelineCommand_CreateTimeRuler=Create Time Ruler
-SwitchLifelineCommand_createMessages=Create Messages
-SwitchLifelineCommand_createStateDefinitions=Create State Definitions
-SwitchLifelineCommand_NameUnnamedStateInvariants=Name Unnamed StateInvariants
-SwitchLifelineCommand_ReAssociateTicks=Re-associate Ticks
-SwitchLifelineCommand_switchLifeline=Switch Lifeline
-SwitchLifelineCommand_unnamed=unnamed
-ConstraintParser_SetConstraint=Set Constraint
-GateHelperAdvice_DestroyGate=Destroy Gate
-GeneralOrderingCreationTool_ClickAfter=Click on the "after" OccurrenceSpecification of the ordering
-GeneralOrderingCreationTool_ClickBefore=Click on the "before" OccurrenceSpecification of the ordering
-TimingDiagramDragDropEditPolicy_Drop=Drop
-TimingDiagramDragDropEditPolicy_DropLifeline=Drop Lifeline
-TimingDiagramDragDropEditPolicy_DropLifelineFragments=Drop Lifeline Fragments
-TimingDiagramDragDropEditPolicy_DropMessage=Drop Message
-TimingDiagramDragDropEditPolicy_DropStateDefinitions=Drop State Definitions
-ToggleTimeRulerVisibility_ToggleTimeRulerVisibility=Toggle Time Ruler Visibility
-UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage=Cannot open input element:
-UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle=Problem opening
-ValidateInteractionCommand_ValidateInteraction=Validate Interaction
-ViewUtils_MoveView=Move View
-CreateTickCommand_attachTick=Attach Tick
-CreateTickCommand_CreateTick=Create Tick
-CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler=Create Free Time Ruler
-CustomTimingDiagramCreationEditPolicy_CreateInteraction=Create Interaction
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
deleted file mode 100644
index 8639de0bc92..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-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.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-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.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Used to get and set the name of a StateInvariant when editing a StateInvariant's label (this gets and sets the body
- * in the OpaqueExpression of the Constraint of the StateInvariant)
- */
-public class CompactStateInvariantNameParser implements ISemanticParser {
-
- public String getEditString(final IAdaptable adaptable, final int flags) {
- final StateInvariant stateInvariant = getStateInvariant(adaptable);
- final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if(name == null) {
- return ""; //$NON-NLS-1$
- }
- return name;
- }
-
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
- final StateInvariant stateInvariant = getStateInvariant(adaptable);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return new AbstractTransactionalCommand(editingDomain, Messages.CompactStateInvariantNameParser_SetStateInvariantName, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- // set the name on the Constraint and OpaqueExpression
- StateInvariantUtils.setInnerStateInvariantName(stateInvariant, newString);
- // set the name directly on the StateInvariant (note that this triggers a refresh of the label)
- stateInvariant.setName(newString);
- for(final Lifeline coveredLifeline : stateInvariant.getCovereds()) {
- LifelineUtils.updateFragmentNames(coveredLifeline, null);
- // XXX what if the StateInvariant appears both on a compact and on a full lifeline?
- StateDefinitionUtils.updateStateDefinitionNamesForCompactLifeline(coveredLifeline);
- }
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- private static StateInvariant getStateInvariant(final IAdaptable adaptable) {
- return (StateInvariant)adaptable.getAdapter(EObject.class);
- }
-
- public String getPrintString(final IAdaptable adaptable, final int flags) {
- final StateInvariant stateInvariant = getStateInvariant(adaptable);
- final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if(name == null || name.length() == 0) {
- return Messages.CompactStateInvariantNameParser_Unnamed;
- }
- return name;
- }
-
- public boolean isAffectingEvent(final Object event, final int flags) {
- return true;
- }
-
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- return null;
- }
-
- public List<?> getSemanticElementsBeingParsed(final EObject element) {
- final List<EObject> list = new ArrayList<EObject>();
- if(element instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)element;
- final Constraint invariant = stateInvariant.getInvariant();
- if(invariant != null) {
- final ValueSpecification specification = invariant.getSpecification();
- if(specification != null) {
- list.add(specification);
- }
- }
- }
- return list;
- }
-
- public boolean areSemanticElementsAffected(final EObject listener, final Object notification) {
- final EStructuralFeature feature = EcoreUtils.getEStructuralFeature(notification);
- return UMLPackage.eINSTANCE.getStateInvariant_Invariant().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
deleted file mode 100644
index aef1e6718a5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-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.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Duration;
-import org.eclipse.uml2.uml.DurationInterval;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.TimeExpression;
-import org.eclipse.uml2.uml.TimeInterval;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/** A parser for {@link TimeConstraint}s and {@link DurationConstraint}s */
-public class ConstraintParser implements ISemanticParser {
-
- private static final String ERROR = "<error>"; //$NON-NLS-1$
-
- private static final Pattern pattern = Pattern.compile("\\{(.*?)\\.\\.(.*?)\\}"); //$NON-NLS-1$
-
- private class MinMax {
-
- LiteralString min;
-
- LiteralString max;
-
- public MinMax(final LiteralString min, final LiteralString max) {
- this.min = min;
- this.max = max;
- }
-
- public LiteralString getMin() {
- return this.min;
- }
-
- public LiteralString getMax() {
- return this.max;
- }
- }
-
- public String getPrintString(final IAdaptable element, final int flags) {
- return getEditString(element, flags);
- }
-
- public String getEditString(final IAdaptable element, final int flags) {
- final Constraint constraint = doAdapt(element);
- final MinMax minMax = getMinMax(constraint);
- if(minMax == null) {
- return ERROR;
- }
- return getMinMaxLabel(minMax);
- }
-
- protected static String getMinMaxLabel(final MinMax minMax) {
- return "{" + minMax.getMin().stringValue() + ".." + minMax.getMax().stringValue() + "}";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public ICommand getParseCommand(final IAdaptable element, final String newString, final int flags) {
- final Constraint constraint = doAdapt(element);
- final MinMax minMax = getMinMax(constraint);
- if(minMax == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final Matcher matcher = ConstraintParser.pattern.matcher(newString);
- if(matcher.matches()) {
- final String min = matcher.group(1);
- final String max = matcher.group(2);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint);
- return createSetMinMaxCommand(constraint, minMax, min, max, editingDomain);
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- private MinMax getMinMax(final Constraint constraint) {
- if(constraint == null) {
- return null;
- }
- final ValueSpecification specification = constraint.getSpecification();
- if(specification instanceof TimeInterval) {
- return getTimeIntervalMinMax((TimeInterval)specification);
- } else if(specification instanceof DurationInterval) {
- return getDurationIntervalMinMax((DurationInterval)specification);
- }
-
- return null;
- }
-
- private MinMax getTimeIntervalMinMax(final TimeInterval timeInterval) {
- final ValueSpecification min = timeInterval.getMin();
- final ValueSpecification max = timeInterval.getMax();
-
- if(!(min instanceof TimeExpression) || !(max instanceof TimeExpression)) {
- return null;
- }
-
- final TimeExpression minTime = (TimeExpression)min;
- final TimeExpression maxTime = (TimeExpression)max;
-
- final ValueSpecification minValue = minTime.getExpr();
- final ValueSpecification maxValue = maxTime.getExpr();
- if(!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
- return null;
- }
-
- final LiteralString minStr = (LiteralString)minValue;
- final LiteralString maxStr = (LiteralString)maxValue;
-
- return new MinMax(minStr, maxStr);
- }
-
- private MinMax getDurationIntervalMinMax(final DurationInterval durationInterval) {
- final ValueSpecification min = durationInterval.getMin();
- final ValueSpecification max = durationInterval.getMax();
-
- if(!(min instanceof Duration) || !(max instanceof Duration)) {
- return null;
- }
-
- final Duration minDuration = (Duration)min;
- final Duration maxDuration = (Duration)max;
-
- final ValueSpecification minValue = minDuration.getExpr();
- final ValueSpecification maxValue = maxDuration.getExpr();
- if(!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
- return null;
- }
-
- final LiteralString minStr = (LiteralString)minValue;
- final LiteralString maxStr = (LiteralString)maxValue;
-
- return new MinMax(minStr, maxStr);
- }
-
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- private static ICommand createSetMinMaxCommand(final Constraint constraint, final MinMax minMax, final String min, final String max, final TransactionalEditingDomain editingDomain) {
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return new AbstractTransactionalCommand(editingDomain, Messages.ConstraintParser_SetConstraint, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- minMax.getMin().setValue(min);
- minMax.getMax().setValue(max);
- // setting this label is more user-friendly and it makes the label refresh since
- // we are changing a direct property of the semantic element
- constraint.setName(getMinMaxLabel(minMax));
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- /**
- * Obtain the constraint element from the adaptable.
- *
- * @param element
- * the given IAdaptable
- * @return the constraint or null if it can't be found.
- */
- protected static Constraint doAdapt(final IAdaptable element) {
- final Object obj = element.getAdapter(EObject.class);
- if(obj instanceof Constraint) {
- return (Constraint)obj;
- }
- return null;
- }
-
- public boolean isAffectingEvent(final Object event, final int flags) {
- return true;
- }
-
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- return null;
- }
-
- public List<?> getSemanticElementsBeingParsed(final EObject element) {
- final List<EObject> list = new ArrayList<EObject>();
- if(element instanceof Constraint) {
- final Constraint constraint = (Constraint)element;
- final MinMax minMax = getMinMax(constraint);
- if(minMax != null) {
- list.add(minMax.getMin());
- list.add(minMax.getMax());
- }
- }
- return list;
- }
-
- public boolean areSemanticElementsAffected(final EObject listener, final Object notification) {
- final EStructuralFeature feature = EcoreUtils.getEStructuralFeature(notification);
- return UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
deleted file mode 100644
index 2c775757a05..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-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.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-/**
- * Used to get and set the name of an OccurrenceSpecification. An OccurrenceSpecification has a default name that
- * indicates what state transition it represents (when the OccurrenceSpecification is a state change). Changing the name
- * of such an OccurrenceSpecification removes the "autogenerated name" EAnnotation.
- */
-public class OccurrenceSpecificationNameParser implements IParser {
-
- public String getEditString(final IAdaptable adaptable, final int flags) {
- final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if(occurrenceSpecification == null) {
- return ""; //$NON-NLS-1$
- }
- return nonNullString(occurrenceSpecification.getName());
- }
-
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
- final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if(occurrenceSpecification == null) {
- return UnexecutableCommand.INSTANCE;
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return new AbstractTransactionalCommand(editingDomain, Messages.OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- occurrenceSpecification.setName(newString);
- OccurrenceSpecificationUtils.setAutogeneratedName(occurrenceSpecification, false);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- public String getPrintString(final IAdaptable adaptable, final int flags) {
- final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if(occurrenceSpecification == null || OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
- // don't display the auto-generated name (pollutes the view without any benefit)
- return ""; //$NON-NLS-1$
- }
- return occurrenceSpecification.getName();
- }
-
- public boolean isAffectingEvent(final Object event, final int flags) {
- return true;
- }
-
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- return null;
- }
-
- private static OccurrenceSpecification getOccurrenceSpecification(final IAdaptable adaptable) {
- final Object adapter = adaptable.getAdapter(EObject.class);
- if(adapter instanceof OccurrenceSpecification) {
- return (OccurrenceSpecification)adapter;
- }
- return null;
- }
-
- private static String nonNullString(final String string) {
- if(string == null) {
- return ""; //$NON-NLS-1$
- }
- return string;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
deleted file mode 100644
index d085c89faac..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-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.emf.transaction.util.TransactionUtil;
-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.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.uml2.uml.Lifeline;
-
-/** Used to get and set the name of a StateDefinition when editing a StateDefinition's label */
-public class StateDefinitionParser implements IParser {
-
- public String getEditString(final IAdaptable adaptable, final int flags) {
- final View stateDefinitionLabelView = (View)adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View)stateDefinitionLabelView.eContainer();
- final String name = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- if(name == null) {
- return ""; //$NON-NLS-1$
- }
- return name;
- }
-
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
- final View stateDefinitionLabelView = (View)adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View)stateDefinitionLabelView.eContainer();
- final View lifelineView = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineEditPartCN.VISUAL_ID);
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- return new AbstractTransactionalCommand(editingDomain, Messages.StateDefinitionParser_SetStateDefinitionName, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, newString);
- LifelineUtils.updateFragmentNames(lifeline, lifelineView);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- public String getPrintString(final IAdaptable adaptable, final int flags) {
- final View stateDefinitionLabelView = (View)adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View)stateDefinitionLabelView.eContainer();
- final String name = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- if(name == null || name.length() == 0) {
- return Messages.StateDefinitionParser_Unnamed;
- }
- return name;
- }
-
- public boolean isAffectingEvent(final Object event, final int flags) {
- return true;
- }
-
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java
deleted file mode 100644
index ca40a1332c5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-
-/** Dummy parser; only present because the gmfgen generation fails otherwise. */
-public class TickParser implements IParser {
-
- public String getEditString(final IAdaptable element, final int flags) {
- throw new UnsupportedOperationException();
- }
-
- public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
- throw new UnsupportedOperationException();
- }
-
- public ICommand getParseCommand(final IAdaptable element, final String newString, final int flags) {
- throw new UnsupportedOperationException();
- }
-
- public String getPrintString(final IAdaptable element, final int flags) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isAffectingEvent(final Object event, final int flags) {
- throw new UnsupportedOperationException();
- }
-
- public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
deleted file mode 100644
index 546b00923fa..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.draw2d.Cursors;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
-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.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
-import org.eclipse.ui.PlatformUI;
-
-/** This tool allows clicking on a first Node then on a second Node to create some kind of element linked to those Nodes */
-public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedTypeCreationTool {
-
- /** The tool is in this state after clicking on the start element of the duration */
- private static final int STATE_FIRST = 1 << 16;
-
- /** A request parameter that indicates the first clicked element */
- public final static String FIRST_TARGET = "FIRST_TARGET"; //$NON-NLS-1$
-
- /** A request parameter that indicates the second clicked element */
- public final static String SECOND_TARGET = "SECOND_TARGET"; //$NON-NLS-1$
-
- protected EditPart first = null;
-
- protected EditPart second = null;
-
- public AbstractTwoPointCreationTool(final IElementType elementType) {
- super(Collections.singletonList(elementType));
- setDefaultCursor(Cursors.CROSS);
- setDisabledCursor(Cursors.NO);
- }
-
- @Override
- public void activate() {
- super.activate();
- this.first = null;
- this.second = null;
- started();
- }
-
- @Override
- public void deactivate() {
- super.deactivate();
- setStatusMessage(null);
- }
-
- @Override
- protected boolean handleButtonDown(final int button) {
- if(button != 1) {
- setState(STATE_INVALID);
- handleInvalidInput();
- }
-
- final Command command = getCommand();
- final EditPart targetEditPart = getTargetEditPart();
-
- if(isInState(STATE_INITIAL) && command.canExecute()) {
- this.first = targetEditPart;
- setState(STATE_FIRST);
- // make it possible to double-click so that the first and second elements are the same
- handleMove();
- firstElementSelected();
- } else if(isInState(STATE_FIRST) && command.canExecute()) {
- this.second = targetEditPart;
- eraseTargetFeedback();
- // update the request and command with the second edit part
- setTargetRequest(createTargetRequest());
- setCurrentCommand(getCommand());
- performCreation(button);
- handleFinished();
- setState(STATE_TERMINAL);
- }
- return true;
- }
-
- @Override
- protected Request createTargetRequest() {
- final CreateAspectUnspecifiedTypeRequest request = new CreateAspectUnspecifiedTypeRequest(getElementTypes(), getPreferencesHint()) {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void createRequests() {
- final IElementType elementType = (IElementType)getElementTypes().get(0);
- // set the first and second edit parts on the CreateElementRequest that will be received
- // by the create command
- final CreateElementRequest createElementRequest = new CreateElementRequest(elementType);
- createElementRequest.setParameter(FIRST_TARGET, AbstractTwoPointCreationTool.this.first);
- createElementRequest.setParameter(SECOND_TARGET, AbstractTwoPointCreationTool.this.second);
-
- final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(createElementRequest), Node.class, getGraphicalHint((IHintedType)elementType), getPreferencesHint());
- final Request request = new CreateViewAndElementRequest(viewDescriptor);
- request.setExtendedData(getExtendedData());
- request.setType(getType());
- this.requests.put(elementType, request);
- }
- };
- @SuppressWarnings("unchecked")
- final Map<Object, Object> extendedData = request.getExtendedData();
- extendedData.put(FIRST_TARGET, this.first);
- extendedData.put(SECOND_TARGET, this.second);
- return request;
- }
-
- @Override
- protected void updateTargetRequest() {
- final CreateRequest createRequest = getCreateRequest();
- createRequest.setSize(null);
- createRequest.setLocation(getLocation());
- createRequest.setSnapToEnabled(false);
- }
-
- @Override
- protected boolean handleButtonUp(final int button) {
- return false;
- }
-
- @Override
- protected boolean handleDrag() {
- return false;
- }
-
- @Override
- protected boolean handleDragStarted() {
- return false;
- }
-
- @Override
- protected boolean handleDragInProgress() {
- return false;
- }
-
- @Override
- protected Command getCommand() {
- final Request request = getTargetRequest();
- final EditPart firstTarget;
- final EditPart secondTarget;
- if(isInState(STATE_INITIAL)) {
- firstTarget = getTargetEditPart();
- secondTarget = null;
- } else {
- firstTarget = this.first;
- secondTarget = getTargetEditPart();
- }
-
- if(!validateFirstTarget(firstTarget)) {
- return UnexecutableCommand.INSTANCE;
- }
-
- if(isInState(STATE_INITIAL)) {
- // dummy executable command (to accept a creation in progress)
- return new Command() {
-
- @Override
- public void execute() {
- throw new IllegalStateException("This dummy command must never be executed"); //$NON-NLS-1$
- }
- };
- }
-
- if(!validateSecondTarget(firstTarget, secondTarget)) {
- return UnexecutableCommand.INSTANCE;
- }
- return getCommand(firstTarget, secondTarget, request);
- }
-
- /**
- * Return the creation command that should be executed after clicking the second node.
- *
- * @param firstTarget
- * the first node that was clicked
- * @param secondTarget
- * the second node that was clicked
- * @param request
- * the request for which a creation command should be returned
- * @return the creation command
- */
- protected abstract Command getCommand(EditPart firstTarget, EditPart secondTarget, Request request);
-
- /**
- * Validate the first selection
- *
- * @param firstTarget
- * the first selected element
- * @return whether the first selected element is valid
- */
- protected abstract boolean validateFirstTarget(final EditPart firstTarget);
-
- /**
- * Validate the second selection
- *
- * @param firstTarget
- * the first selected element
- * @param secondTarget
- * the second selected element
- * @return whether the second selected element is valid
- */
- protected abstract boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget);
-
- /** Called when the tool is activated */
- protected abstract void started();
-
- /** Called after the first element was selected */
- protected abstract void firstElementSelected();
-
- /**
- * Set a help message in the status bar.
- *
- * @param message
- * a message that should help the user using the tool
- */
- protected static void setStatusMessage(final String message) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars().getStatusLineManager().setMessage(message);
- }
-
- /** Does the View for the first EditPart appear before the View for the second EditPart in their container? */
- protected static boolean ordered(final EditPart first, final EditPart second) {
- if(!(first.getModel() instanceof View) || !(second.getModel() instanceof View)) {
- return false;
- }
- final View firstView = (View)first.getModel();
- final View secondView = (View)second.getModel();
- if(firstView.eContainer() != secondView.eContainer()) {
- return false;
- }
- final View compartment = (View)firstView.eContainer();
- final int firstIndex = compartment.getChildren().indexOf(firstView);
- final int secondIndex = compartment.getChildren().indexOf(secondView);
- return firstIndex <= secondIndex;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
deleted file mode 100644
index ef6a986918e..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import java.util.ArrayList;
-import java.util.Collections;
-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.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.Tool;
-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.CommandResult;
-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.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLPaletteFactory;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class CustomPaletteFactory extends UMLPaletteFactory {
-
- private final static String CREATEOCCURRENCESPECIFICATIONCREATIONTOOL = "createOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL = "createDestructionOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
-
- private final static String CREATESTATEDEFINITIONCREATIONTOOL = "createStateDefinitionCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEMESSAGESYNCCREATIONTOOL = "createMessageSyncCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEMESSAGEASYNCCREATIONTOOL = "createMessageAsyncCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEMESSAGEREPLYCREATIONTOOL = "createMessageReplyCreationTool"; //$NON-NLS-1$
-
- private final static String CREATECREATEMESSAGECREATIONTOOL = "createCreateMessageCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEDELETEMESSAGECREATIONTOOL = "createDeleteMessageCreationTool"; //$NON-NLS-1$
-
- private final static String CREATELOSTMESSAGECREATIONTOOL = "createLostMessageCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEFOUNDMESSAGECREATIONTOOL = "createFoundMessageCreationTool"; //$NON-NLS-1$
-
- private final static String CREATETIMEOBSERVATIONCREATIONTOOL = "createTimeObservationCreationTool"; //$NON-NLS-1$
-
- private final static String CREATETIMECONSTRAINTCREATIONTOOL = "createTimeConstraintCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEDURATIONOBSERVATIONCREATIONTOOL = "createDurationObservationCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEDURATIONCONSTRAINTCREATIONTOOL = "createDurationConstraintCreationTool"; //$NON-NLS-1$
-
- private final static String CREATEGENERALORDERINGCREATIONTOOL = "createGeneralOrderingCreationTool"; //$NON-NLS-1$
-
- public final static String ORIGINAL_TARGET = "ORIGINAL_TARGET"; //$NON-NLS-1$
-
- @Override
- public Tool createTool(final String toolId) {
- if(toolId.equals(CREATEOCCURRENCESPECIFICATIONCREATIONTOOL)) {
- return createOccurrenceSpecificationCreationTool();
- } else if(toolId.equals(CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL)) {
- return createDestructionOccurrenceSpecificationCreationTool();
- } else if(toolId.equals(CREATESTATEDEFINITIONCREATIONTOOL)) {
- return createStateDefinitionCreationTool();
- } else if(toolId.equals(CREATEMESSAGESYNCCREATIONTOOL)) {
- return createSyncMessageCreationTool();
- } else if(toolId.equals(CREATEMESSAGEASYNCCREATIONTOOL)) {
- return createAsyncMessageCreationTool();
- } else if(toolId.equals(CREATEMESSAGEREPLYCREATIONTOOL)) {
- return createReplyMessageCreationTool();
- } else if(toolId.equals(CREATECREATEMESSAGECREATIONTOOL)) {
- return createCreateMessageCreationTool();
- } else if(toolId.equals(CREATEDELETEMESSAGECREATIONTOOL)) {
- return createDeleteMessageCreationTool();
- } else if(toolId.equals(CREATELOSTMESSAGECREATIONTOOL)) {
- return createLostMessageCreationTool();
- } else if(toolId.equals(CREATEFOUNDMESSAGECREATIONTOOL)) {
- return createFoundMessageCreationTool();
- } else if(toolId.equals(CREATETIMEOBSERVATIONCREATIONTOOL)) {
- return createTimeObservationCreationTool();
- } else if(toolId.equals(CREATETIMECONSTRAINTCREATIONTOOL)) {
- return createTimeConstraintCreationTool();
- } else if(toolId.equals(CREATEDURATIONOBSERVATIONCREATIONTOOL)) {
- return createDurationObservationCreationTool();
- } else if(toolId.equals(CREATEDURATIONCONSTRAINTCREATIONTOOL)) {
- return createDurationConstraintCreationTool();
- } else if(toolId.equals(CREATEGENERALORDERINGCREATIONTOOL)) {
- return createNewGeneralOrderingCreationTool();
- }
- return super.createTool(toolId);
- }
-
- private static Tool createTimeObservationCreationTool() {
- return createNewTimeTool(UMLElementTypes.TimeObservation_16);
- }
-
- private static Tool createTimeConstraintCreationTool() {
- return createNewTimeTool(UMLElementTypes.TimeConstraint_15);
- }
-
- private static Tool createDurationObservationCreationTool() {
- return createNewDurationTool(UMLElementTypes.DurationObservation_17);
- }
-
- private static Tool createDurationConstraintCreationTool() {
- return createNewDurationTool(UMLElementTypes.DurationConstraint_18);
- }
-
- private static Tool createNewTimeTool(final IElementType elementType) {
- return new AspectUnspecifiedTypeCreationTool(Collections.singletonList(elementType)) {
-
- /**
- * Redirect the creation request to the parent (Lifeline compartment), but keep the original target in the
- * extended data for the creation command.
- */
- @Override
- protected Command getCommand() {
- EditPart target = getTargetEditPart();
- final Request request = getTargetRequest();
- if(target != null && EditPartUtils.isEditPartFor(target, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
- @SuppressWarnings("unchecked")
- final Map<Object, Object> extendedData = request.getExtendedData();
- extendedData.put(ORIGINAL_TARGET, target);
- target = target.getParent();
- return target.getCommand(request);
- }
- return UnexecutableCommand.INSTANCE;
- }
- };
- }
-
- private static Tool createNewDurationTool(final IElementType elementType) {
- return new DurationCreationTool(elementType);
- }
-
- private static Tool createOccurrenceSpecificationCreationTool() {
- return new OccurrenceSpecificationCreationTool();
- }
-
- private static Tool createDestructionOccurrenceSpecificationCreationTool() {
- return new DestructionOccurrenceSpecificationCreationTool();
- }
-
- private static Tool createNewGeneralOrderingCreationTool() {
- return new GeneralOrderingCreationTool();
- }
-
- /** Overloaded to only let StateDefinitions be created in the StateDefinition compartment. */
- private static Tool createStateDefinitionCreationTool() {
- final List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Node_9);
-
- final Tool tool = new AspectUnspecifiedTypeCreationTool(types) {
-
- @Override
- protected Command getCommand() {
- if(!(getTargetEditPart() instanceof FullLifelineStateDefinitionCompartmentEditPartCN)) {
- return UnexecutableCommand.INSTANCE;
- }
- return super.getCommand();
- }
- };
- return tool;
- }
-
- private static Tool createSyncMessageCreationTool() {
- return new SpecificTypeCreationTool(UMLElementTypes.Message_3, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
- }
-
- private static Tool createAsyncMessageCreationTool() {
- return new SpecificTypeCreationTool(UMLElementTypes.Message_4, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
- }
-
- private static Tool createReplyMessageCreationTool() {
- return new SpecificTypeCreationTool(UMLElementTypes.Message_41, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
- }
-
- private static Tool createCreateMessageCreationTool() {
- return new SpecificTypeCreationTool(UMLElementTypes.Message_44, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
- }
-
- private static Tool createDeleteMessageCreationTool() {
- return new SpecificTypeCreationTool(UMLElementTypes.Message_47, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
- }
-
- private static Tool createLostMessageCreationTool() {
- return new AspectUnspecifiedTypeConnectionTool(Collections.singletonList(UMLElementTypes.Message_50)) {
-
- @Override
- protected Command getCommand() {
- final Object type = getTargetRequest().getType();
- if(RequestConstants.REQ_CONNECTION_END == type) {
- final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest)getTargetRequest();
- final EditPart sourceEditPart = request.getSourceEditPart();
-
- // Note: the bounds must be computed before executing the command because the source may be an
- // OccurrenceSpecification that will get swapped to a MessageOccurrenceSpecification, thereby
- // changing the Figure and EditPart.
- final IFigure figure = ((GraphicalEditPart)sourceEditPart).getFigure();
- final Point figureLocation = new Point(figure.getBounds().getCenter());
- figure.getParent().translateToAbsolute(figureLocation);
- final Point location = request.getLocation();
- final double scale = FigureUtils.getScale(figure);
- final Point anchorLocation = new Point(location.x - figureLocation.x, location.y - figureLocation.y).scale(1.0 / scale);
-
- final Command superCommand = super.getCommand();
- final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(superCommand);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(sourceEditPart.getModel());
-
- // add a command that sets the initial anchor position using an EAnnotation
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetLostMessageOrigin, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final Connector connector = findCreatedConnector(superCommand);
- MessageUtils.setMessageConnectorLocation(connector, anchorLocation);
- return CommandResult.newOKCommandResult();
- }
- }));
- return compoundCommand;
- }
- return super.getCommand();
- }
- };
- }
-
- private static Tool createFoundMessageCreationTool() {
- return new AspectUnspecifiedTypeConnectionTool(Collections.singletonList(UMLElementTypes.Message_53)) {
-
- @Override
- protected Command getCommand() {
- final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest)getTargetRequest();
- final EditPart targetEditPart = request.getTargetEditPart();
-
- final Object type = getTargetRequest().getType();
- if(RequestConstants.REQ_CONNECTION_START == type) {
- MessageUtils.saveRequestStartLocation(request);
- }
-
- if(RequestConstants.REQ_CONNECTION_END == type) {
- final Point startLocation = MessageUtils.retrieveRequestStartLocation(request);
-
- // Note: the bounds must be computed before executing the command because the source may be an
- // OccurrenceSpecification that will get swapped to a MessageOccurrenceSpecification, thereby
- // changing the Figure and EditPart.
- final IFigure figure = ((GraphicalEditPart)targetEditPart).getFigure();
- final Point figureLocation = new Point(figure.getBounds().getCenter());
- figure.getParent().translateToAbsolute(figureLocation);
- final double scale = FigureUtils.getScale(figure);
- final Point anchorLocation = new Point(startLocation.x - figureLocation.x, startLocation.y - figureLocation.y).scale(1.0 / scale);
-
- final Command superCommand = super.getCommand();
- final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(superCommand);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(targetEditPart.getModel());
-
- // add a command that sets the initial anchor position using an EAnnotation
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetFoundMessageTarget, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final Connector connector = findCreatedConnector(superCommand);
- MessageUtils.setMessageConnectorLocation(connector, anchorLocation);
- return CommandResult.newOKCommandResult();
- }
- }));
- return compoundCommand;
- }
- return super.getCommand();
- }
- };
- }
-
- /** Find the Connector in the haystack (buried deep in a CommandResult within the command). */
- protected static Connector findCreatedConnector(final Command command) {
- if(command instanceof ICommandProxy) {
- final ICommandProxy commandProxy = (ICommandProxy)command;
- final ICommand iCommand = commandProxy.getICommand();
- final CommandResult commandResult = iCommand.getCommandResult();
- final Object returnValue = commandResult.getReturnValue();
- if(returnValue instanceof List<?>) {
- final List<?> resultList = (List<?>)returnValue;
- for(final Object resultElement : resultList) {
- if(resultElement instanceof ConnectionViewAndElementDescriptor) {
- final ConnectionViewAndElementDescriptor connectionViewAndElementDescriptor = (ConnectionViewAndElementDescriptor)resultElement;
- final View view = (View)connectionViewAndElementDescriptor.getAdapter(View.class);
- if(view instanceof Connector) {
- final Connector connector = (Connector)view;
- return connector;
- }
- }
- }
- }
- }
- throw new IllegalStateException("connector not found"); //$NON-NLS-1$
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
deleted file mode 100644
index f53f89118d0..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import org.eclipse.draw2d.Cursors;
-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.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCompactLifelineCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-
-/**
- * Creating an OccurrenceSpecification means cutting a StateInvariant in two, and inserting the OccurrenceSpecification
- * in-between (and adding a VerticalLine View).
- */
-public class DestructionOccurrenceSpecificationCreationTool extends CreationTool {
-
- public DestructionOccurrenceSpecificationCreationTool() {
- super(UMLElementTypes.DestructionOccurrenceSpecification_27);
- setDefaultCursor(Cursors.CROSS);
- setDisabledCursor(Cursors.NO);
- }
-
- @Override
- protected Command getCommand() {
- final EditPart targetEditPart = getTargetEditPart();
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification);
- EditPart timeline;
- if(targetEditPart instanceof FullStateInvariantEditPartCN) {
- final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN)targetEditPart;
- timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(fullStateInvariantEditPartCN, getLocation(), true));
- } else if(targetEditPart instanceof CompactStateInvariantEditPartCN) {
- final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN)targetEditPart;
- timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- compositeCommand.add(new CutAndInsertOccurrenceSpecificationCompactLifelineCommand(compactStateInvariantEditPartCN, getLocation(), true));
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- final Command updateLayoutCommand = timeline.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
- compositeCommand.add(new CommandProxy(updateLayoutCommand));
- return new ICommandProxy(compositeCommand);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
deleted file mode 100644
index 4f460889aba..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class DurationCreationTool extends AbstractTwoPointCreationTool {
-
- public DurationCreationTool(final IElementType elementType) {
- super(elementType);
- }
-
- @Override
- protected boolean validateFirstTarget(final EditPart firstTarget) {
- return firstTarget != null && EditPartUtils.isEditPartFor(firstTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant());
- }
-
- @Override
- protected boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget) {
- if(secondTarget == null || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
- return false;
- }
- return ordered(firstTarget, secondTarget);
- }
-
- /** Redirect the creation request to the parent (Lifeline compartment) */
- @Override
- protected Command getCommand(final EditPart firstTarget, final EditPart secondTarget, final Request request) {
- return secondTarget.getParent().getCommand(request);
- }
-
- @Override
- protected void started() {
- setStatusMessage(Messages.DurationCreationTool_ClickStartElement);
-
- }
-
- @Override
- protected void firstElementSelected() {
- setStatusMessage(Messages.DurationCreationTool_ClickEndElement);
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java
deleted file mode 100644
index 91a2286abcc..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import org.eclipse.draw2d.ConnectionAnchorBase;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
-
-/**
- * This is an anchor for either a lost or found Message. It floats on a Lifeline, and is not actually attached to
- * anything, because a lost message doesn't have a target, and a found message doesn't have a source. So this anchor
- * gets its relative location from an EAnnotation stored on the Connector.
- */
-public class FloatingMessageAnchor extends ConnectionAnchorBase {
-
- private final ConnectionEditPart connectionEditPart;
-
- private final Point defaultOffset;
-
- public FloatingMessageAnchor(final ConnectionEditPart connEditPart, final Point defaultOffset) {
- this.connectionEditPart = connEditPart;
- this.defaultOffset = defaultOffset;
- }
-
- public Point getReferencePoint() {
- return new Point(0, 0);
- }
-
- public IFigure getOwner() {
- return null;
- }
-
- public Point getLocation(final Point reference) {
- final Point point = MessageUtils.getMessageConnectorLocation(this.connectionEditPart);
- if(point != null) {
- return new Point(reference.x + point.x, reference.y + point.y);
- }
- return new Point(reference.x + this.defaultOffset.x, reference.y + this.defaultOffset.y);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java
deleted file mode 100644
index 3018ae310ec..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class GeneralOrderingCreationTool extends AbstractTwoPointCreationTool {
-
- public GeneralOrderingCreationTool() {
- super(UMLElementTypes.GeneralOrdering_67);
- }
-
- @Override
- protected boolean validateFirstTarget(final EditPart firstTarget) {
- return firstTarget != null && EditPartUtils.isEditPartFor(firstTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification());
- }
-
- @Override
- protected boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget) {
- if(secondTarget == null || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- return false;
- }
- return ordered(firstTarget, secondTarget);
- }
-
- /** Redirect the creation request to the parent (Lifeline compartment) */
- @Override
- protected Command getCommand(final EditPart firstTarget, final EditPart secondTarget, final Request request) {
- return secondTarget.getParent().getCommand(request);
- }
-
- @Override
- protected void started() {
- setStatusMessage(Messages.GeneralOrderingCreationTool_ClickBefore);
- }
-
- @Override
- protected void firstElementSelected() {
- setStatusMessage(Messages.GeneralOrderingCreationTool_ClickAfter);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java
deleted file mode 100644
index ff01e4d430a..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx;
-
-public class NoScrollNoBorderDragEditPartsTracker extends NoScrollDragEditPartsTrackerEx {
-
- public NoScrollNoBorderDragEditPartsTracker(final EditPart sourceEditPart) {
- super(sourceEditPart);
- setBorder(0);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
deleted file mode 100644
index 062f7505474..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import org.eclipse.draw2d.Cursors;
-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.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.AddOccurrenceSpecificationInCompactLifelineCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCommand;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-
-/**
- * Creating an OccurrenceSpecification means cutting a StateInvariant in two, and inserting the OccurrenceSpecification
- * in-between (and adding a VerticalLine View).
- */
-public class OccurrenceSpecificationCreationTool extends CreationTool {
-
- public OccurrenceSpecificationCreationTool() {
- super(UMLElementTypes.OccurrenceSpecification_12);
- setDefaultCursor(Cursors.CROSS);
- setDisabledCursor(Cursors.NO);
- }
-
- @Override
- protected Command getCommand() {
- final EditPart targetEditPart = getTargetEditPart();
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification);
- EditPart timeline;
- if(targetEditPart instanceof FullStateInvariantEditPartCN) {
- final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN)targetEditPart;
- timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(fullStateInvariantEditPartCN, getLocation(), false));
- } else if(targetEditPart instanceof CompactStateInvariantEditPartCN) {
- final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN)targetEditPart;
- timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- compositeCommand.add(new AddOccurrenceSpecificationInCompactLifelineCommand(compactStateInvariantEditPartCN, getLocation()));
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- final Command updateLayoutCommand = timeline.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
- compositeCommand.add(new CommandProxy(updateLayoutCommand));
- return new ICommandProxy(compositeCommand);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java
deleted file mode 100644
index d92283f08ea..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-
-public class PropertyDiagramUpdater implements ICustomDiagramUpdater {
-
- public List<?> getSemanticChildren(final View view) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List<UMLNodeDescriptor> getLifelineFullLifelineTimelineCompartment_8SemanticChildren(final View view) {
- if(false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- final View containerView = (View)view.eContainer();
- if(!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- final Lifeline modelElement = (Lifeline)containerView.getElement();
- final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
-
- if((modelElement).getCoveredBys().size() > 0) {
- final Interaction interaction = modelElement.getInteraction();
-
- for(final Object element : interaction.getFragments()) {
-
- final InteractionFragment childElement = (InteractionFragment)element;
- final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == FullStateInvariantEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- }
-
- if((modelElement).getCoveredBys().size() > 0) {
- final Interaction interaction = modelElement.getInteraction();
-
- for(final Object element : interaction.getOwnedRules()) {
- final Constraint childElement = (Constraint)element;
- final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == DurationConstraintEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == DurationObservationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- }
- return result;
- }
-
- public static List<UMLNodeDescriptor> createLifelineCompactLifelineCompartment_23Children(final View view) {
- if(false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- final View containerView = (View)view.eContainer();
- if(!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- final Lifeline modelElement = (Lifeline)containerView.getElement();
- final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
-
- if((modelElement).getCoveredBys().size() > 0) {
- final Interaction interaction = modelElement.getInteraction();
-
- for(final Object element : interaction.getFragments()) {
-
- final InteractionFragment childElement = (InteractionFragment)element;
- final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == CompactStateInvariantEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- }
-
- if((modelElement).getCoveredBys().size() > 0) {
- final Interaction interaction = modelElement.getInteraction();
-
- for(final Object element : interaction.getOwnedRules()) {
- final Constraint childElement = (Constraint)element;
- final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == DurationConstraintEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == DurationObservationEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- }
- return result;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
deleted file mode 100644
index e3393a48ac6..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
-
-/** A creation tool that only allows creating connections between specific types. */
-public class SpecificTypeCreationTool extends AspectUnspecifiedTypeConnectionTool {
-
- private final Collection<EClass> sourceTypes;
-
- private final Collection<EClass> targetTypes;
-
- /**
- * @param connectionTypeToCreate
- * the element type of the connection to create
- * @param sourceTypes
- * the connection will only be allowed if the source is of one of these types
- * @param targetTypes
- * the connection will only be allowed if the target is of one of these types
- */
- public SpecificTypeCreationTool(final IElementType connectionTypeToCreate, final Collection<EClass> sourceTypes, final Collection<EClass> targetTypes) {
- super(Collections.singletonList(connectionTypeToCreate));
- this.sourceTypes = sourceTypes;
- this.targetTypes = targetTypes;
- }
-
- @Override
- protected Command getCommand() {
- final EditPart targetEditPart = getTargetEditPart();
- EObject element = null;
- if(targetEditPart != null && targetEditPart.getModel() instanceof View) {
- element = ((View)targetEditPart.getModel()).getElement();
- }
-
- // only allow creating a connection that starts from the sourceType
- if(isInState(STATE_INITIAL)) {
- if(!isOfType(element, this.sourceTypes)) {
- return null;
- }
- }
-
- // only allow creating a connection that goes to the targetType
- if(isInState(STATE_CONNECTION_STARTED) || isInState(STATE_TERMINAL)) {
- if(!isOfType(element, this.targetTypes)) {
- return null;
- }
- }
- return super.getCommand();
- }
-
- private static boolean isOfType(final EObject element, final Collection<EClass> types) {
- for(final EClass eClass : types) {
- if(eClass.isInstance(element)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.java
deleted file mode 100644
index 4414fbf478d..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.providers;
-
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomUMLEditPartFactory;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLEditPartProvider;
-
-public class CustomUMLEditPartProvider extends UMLEditPartProvider {
-
- public CustomUMLEditPartProvider() {
- setFactory(new CustomUMLEditPartFactory());
- setAllowCaching(true);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
deleted file mode 100644
index 89063dc39b5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
-
-public final class Constants {
-
- private Constants() {
- // not instantiable
- }
-
- /**
- * The minimum distance between the center of two occurrence specifications (to avoid indistinguishable overlapping
- * figures)
- */
- public static final int MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS = 4;
-
- public static final int MARGIN_BETWEEN_LIFELINES = 8;
-
- public static final int TIME_RULER_HEIGHT = 30;
-
- public static final int STATE_DEFINITIONS_WIDTH = 100;
-
- public static final String fullStateInvariantId = Integer.toString(FullStateInvariantEditPartCN.VISUAL_ID);
-
- public static final String compactStateInvariantId = Integer.toString(CompactStateInvariantEditPartCN.VISUAL_ID);
-
- public static final String verticalLineId = Integer.toString(FullStateInvariantVerticalLineEditPart.VISUAL_ID);
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
deleted file mode 100644
index 6ac554738a6..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-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.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-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.requests.CreateConnectionViewRequest;
-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.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.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageKind;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.TimeObservation;
-
-public final class DropUtils {
-
- private DropUtils() {
- // utility class
- }
-
- public static ICommand getDropMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
- if(message.getMessageKind() == MessageKind.LOST_LITERAL) {
- return getDropLostMessageCommand(message, dropTarget, viewer);
- }
- if(message.getMessageKind() == MessageKind.FOUND_LITERAL) {
- return getDropFoundMessageCommand(message, dropTarget, viewer);
- }
-
- final MessageEnd sendEvent = message.getSendEvent();
- final MessageEnd receiveEvent = message.getReceiveEvent();
- if(sendEvent == null || receiveEvent == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- final List<View> sourceViews = new ArrayList<View>(CrossReferencerUtil.getCrossReferencingViews(sendEvent, TimingDiagramEditPart.MODEL_ID));
- final List<View> targetViews = new ArrayList<View>(CrossReferencerUtil.getCrossReferencingViews(receiveEvent, TimingDiagramEditPart.MODEL_ID));
-
- // Messages can only be created between MessageEnds
- filterMessageSourceOrTargetViews(sourceViews);
- filterMessageSourceOrTargetViews(targetViews);
-
- if(sourceViews.size() != 1 || targetViews.size() != 1) {
- return UnexecutableCommand.INSTANCE;
- }
- final View sourceView = sourceViews.get(0);
- final View targetView = targetViews.get(0);
-
- if(sourceView == null || sourceView.getDiagram() == null || targetView == null || targetView.getDiagram() == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
- // the drop must be targeted inside the interaction
- if(interactionView == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // the source and target views must be inside the interaction view
- if(!ViewUtils.isContained(sourceView, interactionView) || !ViewUtils.isContained(targetView, interactionView)) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // don't allow multiple Views for the same Message in the same Diagram
- if(ViewUtils.containsConnectorFor(dropTarget, message)) {
- return UnexecutableCommand.INSTANCE;
- }
- // create the connection for the existing message, from the sourceView to the targetView
- return createMessageConnectionView(message, viewer, sourceView, targetView);
- }
-
- private static ICommand getDropLostMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
- final MessageEnd sendEvent = message.getSendEvent();
- if(sendEvent == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getDropLostOrFoundMessage(message, dropTarget, viewer, sendEvent);
- }
-
- private static ICommand getDropFoundMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
- final MessageEnd receiveEvent = message.getReceiveEvent();
- if(receiveEvent == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getDropLostOrFoundMessage(message, dropTarget, viewer, receiveEvent);
- }
-
- private static ICommand getDropLostOrFoundMessage(final Message message, final View dropTarget, final EditPartViewer viewer, final MessageEnd endEvent) {
- final List<View> endViews = DiagramEditPartsUtil.findViews(endEvent, viewer);
- filterMessageSourceOrTargetViews(endViews);
- if(endViews.size() != 1) {
- return UnexecutableCommand.INSTANCE;
- }
- final View endView = endViews.get(0);
- final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
- View lifelineView = ViewUtils.findSuperViewWithId(endView, FullLifelineEditPartCN.VISUAL_ID);
- if(lifelineView == null) {
- lifelineView = ViewUtils.findSuperViewWithId(endView, CompactLifelineEditPartCN.VISUAL_ID);
- }
- if(interactionView == null || lifelineView == null) {
- return UnexecutableCommand.INSTANCE;
- }
- if(!ViewUtils.isContained(endView, interactionView)) {
- return UnexecutableCommand.INSTANCE;
- }
- if(ViewUtils.containsConnectorFor(dropTarget, message)) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // create the connection for the lost message, from the endView to the lifelineView
- if(message.getMessageKind() == MessageKind.LOST_LITERAL) {
- return createMessageConnectionView(message, viewer, endView, lifelineView);
- }
- // create the connection for the found message, from the lifelineView to the endView
- return createMessageConnectionView(message, viewer, lifelineView, endView);
- }
-
- private static ICommand createMessageConnectionView(final Message message, final EditPartViewer viewer, final View sourceView, final View targetView) {
- final IElementType elementType = MessageUtils.getElementType(message);
- final String semanticHint = ((IHintedType)elementType).getSemanticHint();
- final ConnectionViewDescriptor connectionViewDescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(elementType, semanticHint, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- final IAdaptable sourceViewAdapter = new EObjectAdapter(sourceView);
- final IAdaptable targetViewAdapter = new EObjectAdapter(targetView);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(message);
- final CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(editingDomain, semanticHint, sourceViewAdapter, targetViewAdapter, viewer, PreferencesHint.USE_DEFAULTS, connectionViewDescriptor, null);
- createConnectionViewCommand.setElement(message);
- return createConnectionViewCommand;
- }
-
- private static void filterMessageSourceOrTargetViews(final List<View> views) {
- final ListIterator<View> listIterator = views.listIterator();
- while(listIterator.hasNext()) {
- final View view = listIterator.next();
- final int visualID = UMLVisualIDRegistry.getVisualID(view);
- if(!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) && visualID != GateEditPart.VISUAL_ID) {
- listIterator.remove();
- }
- }
- }
-
- private interface IDropLinkedNodeInLifelineAction<T extends EObject> {
-
- void drop(T element, View compartmentView);
- }
-
- public static ICommand getDropLinkedNodeInLifelineCommand(final EObject droppedElement, final Collection<EObject> linkedElements, final View dropTarget, final EditPartViewer viewer, final IDropLinkedNodeInLifelineAction<? extends EObject> dropAction) {
- final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
- // the drop must be targeted inside the interaction
- if(interactionView == null || ViewUtils.containsViewFor(interactionView, droppedElement)) {
- return UnexecutableCommand.INSTANCE;
- }
-
- final Set<View> targetLifelines = new HashSet<View>();
- for(final EObject eObject : linkedElements) {
- if(eObject instanceof InteractionFragment) {
- final InteractionFragment interactionFragment = (InteractionFragment)eObject;
- final EList<Lifeline> covereds = interactionFragment.getCovereds();
- for(final Lifeline lifeline : covereds) {
- final List<View> lifelineViews = DiagramEditPartsUtil.findViews(lifeline, viewer);
- for(final View lifelineView : lifelineViews) {
- if(LifelineUtils.isLifelineView(lifelineView) && ViewUtils.isContained(lifelineView, interactionView)) {
- targetLifelines.add(lifelineView);
- }
- }
- }
- }
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interactionView);
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.DropUtils_DropElement);
-
- compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.DropUtils_DropElement, null) {
-
- @SuppressWarnings("unchecked")
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- for(final View targetLifeline : targetLifelines) {
- final View compartmentView = ViewUtils.findChildTimelineCompartmentView(targetLifeline);
- ((IDropLinkedNodeInLifelineAction<EObject>)dropAction).drop(droppedElement, compartmentView);
- }
- return CommandResult.newOKCommandResult();
- }
- });
-
- // add command to layout the new Node
- for(final View targetLifeline : targetLifelines) {
- final EditPart lifelineEditPart = (EditPart)viewer.getEditPartRegistry().get(targetLifeline);
- final EditPart compartmentEditPart = LifelineUtils.getLifelineCompartment(lifelineEditPart);
- compositeCommand.add(new CommandProxy(compartmentEditPart.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST)));
- }
-
- return compositeCommand;
- }
-
- protected static class DropTimeObservationAction implements IDropLinkedNodeInLifelineAction<TimeObservation> {
-
- public void drop(final TimeObservation timeObservation, final View compartmentView) {
- final Node timeObservationNode = new UMLViewProvider().createTimeObservation_16(timeObservation, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- if(timeObservationNode != null) {
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(0);
- loc.setY(40);
- timeObservationNode.setLayoutConstraint(loc);
- }
- }
- }
-
- public static ICommand getDropTimeObservationCommand(final TimeObservation timeObservation, final View dropTarget, final EditPartViewer viewer) {
- final NamedElement event = timeObservation.getEvent();
- return getDropLinkedNodeInLifelineCommand(timeObservation, Collections.<EObject> singletonList(event), dropTarget, viewer, new DropTimeObservationAction());
- }
-
- protected static class DropTimeConstraintAction implements IDropLinkedNodeInLifelineAction<TimeConstraint> {
-
- public void drop(final TimeConstraint timeConstraint, final View compartmentView) {
- final Node timeConstraintNode = new UMLViewProvider().createTimeConstraint_15(timeConstraint, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- if(timeConstraintNode != null) {
- final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
- bounds.setY(40);
- timeConstraintNode.setLayoutConstraint(bounds);
- }
- }
- }
-
- public static ICommand getDropTimeConstraintCommand(final TimeConstraint timeConstraint, final View dropTarget, final EditPartViewer viewer) {
- final Collection<EObject> linkedElements = new ArrayList<EObject>();
- linkedElements.addAll(timeConstraint.getConstrainedElements());
- return getDropLinkedNodeInLifelineCommand(timeConstraint, linkedElements, dropTarget, viewer, new DropTimeConstraintAction());
- }
-
- protected static class DropDurationObservationAction implements IDropLinkedNodeInLifelineAction<DurationObservation> {
-
- public void drop(final DurationObservation durationObservation, final View compartmentView) {
- final Node durationObservationNode = new UMLViewProvider().createDurationObservation_17(durationObservation, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- if(durationObservationNode != null) {
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- loc.setX(0);
- loc.setY(40);
- durationObservationNode.setLayoutConstraint(loc);
- }
- }
- }
-
- public static ICommand getDropDurationObservationCommand(final DurationObservation durationObservation, final View dropTarget, final EditPartViewer viewer) {
- final Collection<EObject> linkedElements = new ArrayList<EObject>();
- linkedElements.addAll(durationObservation.getEvents());
- return getDropLinkedNodeInLifelineCommand(durationObservation, linkedElements, dropTarget, viewer, new DropDurationObservationAction());
- }
-
- protected static class DropDurationConstraintAction implements IDropLinkedNodeInLifelineAction<DurationConstraint> {
-
- public void drop(final DurationConstraint durationConstraint, final View compartmentView) {
- final Node durationConstraintNode = new UMLViewProvider().createDurationConstraint_18(durationConstraint, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- if(durationConstraintNode != null) {
- final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
- bounds.setY(5);
- durationConstraintNode.setLayoutConstraint(bounds);
- }
- }
- }
-
- public static ICommand getDropDurationConstraintCommand(final DurationConstraint durationConstraint, final View dropTarget, final EditPartViewer viewer) {
- final Collection<EObject> linkedElements = new ArrayList<EObject>();
- linkedElements.addAll(durationConstraint.getConstrainedElements());
- return getDropLinkedNodeInLifelineCommand(durationConstraint, linkedElements, dropTarget, viewer, new DropDurationConstraintAction());
- }
-
- protected static class DropGeneralOrderingAction implements IDropLinkedNodeInLifelineAction<GeneralOrdering> {
-
- public void drop(final GeneralOrdering generalOrdering, final View compartmentView) {
- final Node generalOrderingNode = new UMLViewProvider().createGeneralOrdering_67(generalOrdering, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- if(generalOrderingNode != null) {
- final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
- bounds.setY(30);
- generalOrderingNode.setLayoutConstraint(bounds);
- }
- }
- }
-
- public static ICommand getDropGeneralOrderingCommand(final GeneralOrdering generalOrdering, final View dropTarget, final EditPartViewer viewer) {
- final Collection<EObject> linkedElements = new ArrayList<EObject>();
- linkedElements.add(generalOrdering.getBefore());
- linkedElements.add(generalOrdering.getAfter());
- return getDropLinkedNodeInLifelineCommand(generalOrdering, linkedElements, dropTarget, viewer, new DropGeneralOrderingAction());
- }
-
- public static ICommand getDropGateCommand(final Gate gate, final View dropTarget, final EditPartViewer viewer) {
- final Node interactionView = (Node)ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
- // the drop must be targeted on the interaction
- if(interactionView == null || ViewUtils.containsViewFor(interactionView, gate)) {
- return UnexecutableCommand.INSTANCE;
- }
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interactionView);
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.DropUtils_DropGate);
- compositeCommand.add(new CommandProxy(new RefreshCommandForUndo((GraphicalEditPart)viewer.getRootEditPart())));
- compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.DropUtils_DropGate, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final Node gateNode = new UMLViewProvider().createGate_69(gate, interactionView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
- try {
- final int index = ((Interaction)gate.eContainer()).getFormalGates().indexOf(gate);
- final Location loc = NotationFactory.eINSTANCE.createLocation();
- // space Gates regularly (useful when dropping several Gates)
- loc.setX(-10);
- loc.setY(30 + index * 20);
- gateNode.setLayoutConstraint(loc);
- } catch (final Exception e) {
- Activator.log.error("Couldn't layout dropped Gates", e); //$NON-NLS-1$
- }
- return CommandResult.newOKCommandResult();
- }
- });
- compositeCommand.add(new CommandProxy(new RefreshCommandForDo((GraphicalEditPart)viewer.getRootEditPart())));
-
- return compositeCommand;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
deleted file mode 100644
index 3641c868b28..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-public final class EcoreUtils {
-
- private EcoreUtils() {
- // utility class
- }
-
- /**
- * Replace an EObject instance by another compatible EObject instance (replacement must be either the same type, or
- * a subtype of original).
- *
- * @param original
- * the object to replace
- * @param replacement
- * the replacement object
- */
- public static void replaceEObjectInstance(final EObject original, final EObject replacement) {
- final Collection<Setting> settings = EcoreUtil.UsageCrossReferencer.find(original, original.eResource().getResourceSet());
-
- final Set<EStructuralFeature> referencingFeatures = new HashSet<EStructuralFeature>();
- for(final Setting setting : settings) {
- referencingFeatures.add(setting.getEStructuralFeature());
- }
-
- // copy all the features of the original object to the replacement object
- copyFeatures(original, replacement, referencingFeatures);
-
- // put the replacement object in all the referencing features of the original object
- for(final Setting setting : settings) {
- final EStructuralFeature feature = setting.getEStructuralFeature();
- if(feature.isChangeable() && !feature.isDerived()) {
- // if it is already in the list, remove it and put it at the right index
- EcoreUtil.remove(setting, replacement);
- // replace the original by the replacement
- EcoreUtil.replace(setting, original, replacement);
- }
- }
-
- // change the container
- EcoreUtil.replace(original, replacement);
- }
-
- /**
- * Copies all the features from the source object to the target object, ignoring the referencingFeatures
- *
- * @param source
- * the object that will give its values to the target object
- * @param target
- * the object that will receive its values from the source object
- * @param referencingFeatures
- * features to ignore in the copy
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- private static void copyFeatures(final EObject source, final EObject target, final Set<EStructuralFeature> referencingFeatures) {
- final EList<EStructuralFeature> eAllStructuralFeatures = source.eClass().getEAllStructuralFeatures();
-
- for(final EStructuralFeature feature : eAllStructuralFeatures) {
- if(referencingFeatures.contains(feature)) {
- // the value will be set through the object referencing the "from" object
- continue;
- }
- if(feature instanceof EReference) {
- final EReference reference = (EReference)feature;
- if(reference.isContainer()) {
- // the container will be set at the end
- continue;
- }
- }
- if(feature.isChangeable() && !feature.isDerived()) {
- if(feature.isMany()) {
- final Object result = source.eGet(feature);
- if(result instanceof List<?>) {
- final List list1 = (List)result;
- final List list2 = (List)target.eGet(feature);
- list2.addAll(list1);
- }
- } else {
- final Object value = source.eGet(feature);
- target.eSet(feature, value);
- }
- }
- }
- }
-
- /**
- * Return the first element in the container hierarchy of the given element that is of the given class.
- *
- * @param element
- * the starting point
- * @param clazz
- * the class of the parent that is searched
- * @return the first containing element of the given class, or <code>null</code> if none
- */
- @SuppressWarnings("unchecked")
- public static <T> T getContaining(final EObject element, final Class<T> clazz) {
- EObject container = element;
- while(container != null) {
- if(clazz.isInstance(container)) {
- return (T)container;
- }
- container = container.eContainer();
- }
- return null;
- }
-
- public static EStructuralFeature getEStructuralFeature(final Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- final Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java
deleted file mode 100644
index 08242a8b577..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-
-public class EditPartUtils {
-
- public static EditPart findFirstChildEditPartWithId(final EditPart editPart, final int visualId) {
- final List<? extends EditPart> result = findChildEditPartsWithId(editPart, visualId);
- if(result.isEmpty()) {
- return null;
- }
- return result.get(0);
- }
-
- public static List<? extends EditPart> findChildEditPartsWithId(final EditPart editPart, final int visualId) {
- final List<EditPart> editParts = new ArrayList<EditPart>();
- internalFindChildEditPartsWithId(editPart, visualId, editParts);
- return editParts;
- }
-
- private static void internalFindChildEditPartsWithId(final EditPart editPart, final int visualId, final List<EditPart> result) {
- final Object model = editPart.getModel();
- if(model instanceof View) {
- final View view = (View)model;
- if(UMLVisualIDRegistry.getVisualID(view) == visualId) {
- result.add(editPart);
- }
- }
- @SuppressWarnings("unchecked")
- final List<EditPart> children = editPart.getChildren();
- for(final EditPart child : children) {
- internalFindChildEditPartsWithId(child, visualId, result);
- }
- }
-
- public static EditPart findParentEditPartWithId(final EditPart editPart, final int visualId) {
- EditPart parent = editPart;
- while(parent != null) {
- final Object model = parent.getModel();
- if(model instanceof View) {
- final View parentView = (View)model;
- if(UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
- return parent;
- }
- parent = parent.getParent();
- } else {
- break;
- }
- }
- return null;
- }
-
- /**
- * Find the EditPart whose Figure is closest to the given y-coordinate.
- *
- * @param ordinate
- * the y-coordinate
- * @param editParts
- * the EditParts among which to choose
- * @return the EditPart closest to the given vertical coordinate
- */
- public static GraphicalEditPart findEditPartClosestToOrdinate(final int ordinate, final List<? extends GraphicalEditPart> editParts) {
- if(editParts.isEmpty()) {
- return null;
- }
-
- final TreeMap<Integer, GraphicalEditPart> distanceMap = new TreeMap<Integer, GraphicalEditPart>();
- for(final GraphicalEditPart editPart : editParts) {
- final IFigure figure = editPart.getFigure();
- final Rectangle bounds = new Rectangle(figure.getBounds());
- figure.getParent().translateToAbsolute(bounds);
- final int posY = bounds.y + bounds.height / 2;
- final int distance = Math.abs(posY - ordinate);
- distanceMap.put(Integer.valueOf(distance), editPart);
- }
- final Entry<Integer, GraphicalEditPart> firstEntry = distanceMap.firstEntry();
- return firstEntry.getValue();
- }
-
- public static boolean isEditPartFor(final EditPart editPart, final EClass... eClasses) {
- final Object model = editPart.getModel();
- if(model instanceof View) {
- final View view = (View)model;
- return ViewUtils.isViewFor(view, eClasses);
- }
- return false;
- }
-
- public static CompartmentEditPart findParentTimelineCompartment(final EditPart editPart) {
- CompartmentEditPart compartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findParentEditPartWithId(editPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- if(compartmentEditPart == null) {
- compartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findParentEditPartWithId(editPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- }
- return compartmentEditPart;
- }
-
- /** Reveals the given EditPart in its viewer */
- public static void revealEditPart(final EditPart editPart) {
- if(editPart != null && editPart.getViewer() != null) {
- editPart.getViewer().reveal(editPart);
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
deleted file mode 100644
index 6a8a7a07157..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LayeredPane;
-import org.eclipse.draw2d.ScalableFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
-
-public final class FigureUtils {
-
- private FigureUtils() {
- // utility class
- }
-
- /**
- * Returns a child figure of the given type recursively contained in the given parent figure.
- *
- * @param parent
- * the parent figure
- * @param childFigureClass
- * the type of the child figure that is looked for
- * @return the child figure if found, or <code>null</code> if the parent figure contains no child figure of the
- * given type
- */
- @SuppressWarnings("unchecked")
- public static <T extends IFigure> T findChildFigureInstance(final IFigure parent, final Class<T> childFigureClass) {
- final List<IFigure> children = parent.getChildren();
- for(final IFigure child : children) {
- if(childFigureClass.isAssignableFrom(child.getClass())) {
- return (T)child;
- }
- // look recursively
- final IFigure subresult = findChildFigureInstance(child, childFigureClass);
- if(subresult != null) {
- return (T)subresult;
- }
- }
- // not found
- return null;
- }
-
- public static <T extends IFigure> List<T> findChildFigureInstances(final IFigure parent, final Class<T> childFigureClass) {
- final List<T> result = new ArrayList<T>();
- internalFindChildFigureInstances(parent, result, childFigureClass);
- return result;
- }
-
- @SuppressWarnings("unchecked")
- public static <T extends IFigure> void internalFindChildFigureInstances(final IFigure parent, final List<T> result, final Class<T> childFigureClass) {
- final List<IFigure> children = parent.getChildren();
- for(final IFigure child : children) {
- if(childFigureClass.isAssignableFrom(child.getClass())) {
- result.add((T)child);
- } else {
- internalFindChildFigureInstances(child, result, childFigureClass);
- }
-
- }
- }
-
- /**
- * Returns the first parent figure of the given type recursively containing the given figure.
- *
- * @param figure
- * the figure
- * @param parentFigureClass
- * the type of the parent figure that is looked for
- * @return the parent figure if found, or <code>null</code> if the figure is not contained by any figure of the
- * given type
- */
- @SuppressWarnings("unchecked")
- public static <T extends IFigure> T findParentFigureInstance(final IFigure figure, final Class<T> parentFigureClass) {
- IFigure parent = figure.getParent();
- while(parent != null) {
- if(parentFigureClass.isAssignableFrom(parent.getClass())) {
- return (T)parent;
- }
- parent = parent.getParent();
- }
- return null;
- }
-
- /**
- * Constrain the given bounds (whose presumed purpose is to become the new bounds for the given Figure), so that
- * they don't stick out of the bounds of the {@link ResizableCompartmentFigure} in which the given figure is
- * contained. Returns the original bounds if the given Figure is not contained in a {@link ResizableCompartmentFigure}.
- *
- * @param bounds
- * The bounds to constrain (will not be modified)
- * @param figure
- * the figure in the containing {@link ResizableCompartmentFigure} of which the bound must be constrained
- * @return the bounds, constrained so that they don't stick out of the {@link ResizableCompartmentFigure} in which
- * the Figure is contained
- *
- */
- public static Rectangle constrainBoundsWithinContainingCompartment(final Rectangle bounds, final IFigure figure) {
- final Rectangle result = new Rectangle(bounds);
- final ResizableCompartmentFigure parentCompartment = FigureUtils.findParentFigureInstance(figure, ResizableCompartmentFigure.class);
- if(parentCompartment == null) {
- return result;
- }
- final Rectangle parentBounds = parentCompartment.getBounds();
- result.x = Math.max(result.x, 0);
- result.y = Math.max(result.y, 0);
- result.x = Math.min(result.x, parentBounds.width - result.width);
- result.y = Math.min(result.y, parentBounds.height - result.height);
- return result;
- }
-
- /**
- * @return The origin of the coordinate system applied to the given figure (i.e.: the amount scrolled in the scroll
- * pane)
- */
- public static Point getLayeredPaneOrigin(final IFigure figure) {
- final LayeredPane layeredPane = FigureUtils.findChildFigureInstance(FigureUtilities.getRoot(figure), LayeredPane.class);
- final Point origin = new Point(0, 0);
- layeredPane.translateToRelative(origin);
- return origin;
- }
-
- /**
- * @return The scale applied to the given figure (i.e.: the zoom set by the user)
- */
- public static double getScale(final IFigure figure) {
- final ScalableFigure scalableFigure = FigureUtils.findParentFigureInstance(figure, ScalableFigure.class);
- return scalableFigure.getScale();
- }
-
- public static Point scaleByZoom(final Point delta, final IFigure figure) {
- return new Point(delta).scale(1.0 / getScale(figure));
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java
deleted file mode 100644
index b33808d68c5..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public final class GateUtils {
-
- private GateUtils() {
- // utility class
- }
-
- /**
- * Get all elements to delete when deleting a Gate.
- *
- * @param gate
- * the Gate being deleted
- * @return the elements (EObjects and Views) that should be deleted together with the Gate
- */
- public static Collection<EObject> getElementsToDelete(final Gate gate) {
- final Set<EObject> elementsToDestroy = new HashSet<EObject>();
- final Collection<Setting> settings = EcoreUtil.UsageCrossReferencer.find(gate, gate.eResource().getResourceSet());
- for(final Setting setting : settings) {
- // delete messages originating from or going to that gate
- if(setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_SendEvent() || setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_ReceiveEvent()) {
- elementsToDestroy.add(setting.getEObject());
- }
- }
- return elementsToDestroy;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java
deleted file mode 100644
index 52bdaa62171..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public final class GeneralOrderingUtils {
-
- private GeneralOrderingUtils() {
- // utility class
- }
-
- public static boolean isGeneralOrderingEditPart(final int visualID) {
- return visualID == GeneralOrderingEditPart.VISUAL_ID;
- }
-
- public static boolean isGeneralOrderingEditPart(final EditPart editPart) {
- return editPart instanceof GeneralOrderingEditPart;
- }
-
- /**
- * Find {@link GeneralOrdering}s linked to the given element.
- *
- * @param element
- * the element for which related {@link GeneralOrdering}s must be found
- * @param hideOnly
- * whether to only return Views
- * @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
- * @return the list of linked {@link GeneralOrdering}s to remove
- */
- public static Collection<? extends EObject> getReferencingGeneralOrderingsToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
- final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getGeneralOrdering_Before(), UMLPackage.eINSTANCE.getGeneralOrdering_After() };
- final Class<?>[] expectedClasses = new Class<?>[]{ GeneralOrdering.class };
- return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
deleted file mode 100644
index b86ced34994..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.uml2.uml.Interaction;
-
-/** Utility class for manipulating {@link Interaction}s */
-public final class InteractionUtils {
-
- private InteractionUtils() {
- // utility class
- }
-
- /**
- * Return the {@link Interaction} containing the given model element if any, or <code>null</code> if the element is
- * not recursively contained in any {@link Interaction}.
- *
- * @param eObject
- * the model element for which we want to find the containing {@link Interaction}.
- * @return the parent {@link Interaction} or <code>null</code> if none.
- */
- public static Interaction getContainingInteraction(final EObject eObject) {
- if(eObject != null) {
- if(eObject instanceof Interaction) {
- return (Interaction)eObject;
- }
- final EObject eContainer = eObject.eContainer();
- return getContainingInteraction(eContainer);
- }
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
deleted file mode 100644
index 596aa93f874..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-
-/** Utility class for manipulating {@link Lifeline}s */
-public final class LifelineUtils {
-
- public enum LifelineType {
- full, compact
- }
-
- /** The key for the EAnnotation on a Lifeline that indicates whether the Lifeline is a compact or full lifeline */
- private static final String LIFELINE_ANNOTATION = "org.eclipse.papyrus.uml.diagram.timing.lifeline"; //$NON-NLS-1$
-
- private static final String LIFELINE_TYPE = "type"; //$NON-NLS-1$
-
- private LifelineUtils() {
- // utility class
- }
-
- /**
- * Get the type of the given lifeline
- *
- * @param lifeline
- * the lifeline whose type to get
- * @return the type
- */
- public static LifelineType getLifelineType(final Lifeline lifeline) {
- final EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_ANNOTATION);
- if(eAnnotation != null) {
- final String type = eAnnotation.getDetails().get(LIFELINE_TYPE);
- if(type != null) {
- return LifelineType.valueOf(type);
- }
- }
- // a non-annotated Lifeline is full by default
- return LifelineType.full;
- }
-
- /**
- * Set the type of the given lifeline (between compact and full) using an annotation. This is needed in order to let {@link UMLViewProvider}
- * choose the right view depending on this annotation.
- *
- * @param lifeline
- * the lifeline whose type to set
- * @param lifelineType
- * the type to set
- */
- public static void setLifelineType(final Lifeline lifeline, final LifelineType lifelineType) {
- EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_ANNOTATION);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(LIFELINE_ANNOTATION);
- lifeline.getEAnnotations().add(eAnnotation);
- }
- eAnnotation.getDetails().put(LIFELINE_TYPE, lifelineType.name());
- }
-
- /**
- * Update the names of StateInvariants and OccurrenceSpecifications in the given Lifeline, so that StateInvariants
- * have a number suffix to distinguish multiple occurrences of the same state, and OccurrenceSpecifications that
- * indicate a state change have a name that indicates their incoming and outgoing state.
- *
- * @param lifeline
- * the Lifeline to update
- * @param lifelineView
- * the Lifeline's view, containing the StateDefinitions (ignored for a Compact lifeline)
- */
- @SuppressWarnings("boxing")
- public static void updateFragmentNames(final Lifeline lifeline, final View lifelineView) {
- View fullLifelineView = lifelineView;
- if(lifelineView != null && !Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
- fullLifelineView = null;
- }
- final Map<String, Integer> stateInvariantCounts = new HashMap<String, Integer>();
- final EList<InteractionFragment> fragments = lifeline.getCoveredBys();
- final Map<StateInvariant, String> stateInvariantNames = new HashMap<StateInvariant, String>();
-
- // first, handle StateInvariant names
- for(int i = 0; i < fragments.size(); i++) {
- final InteractionFragment interactionFragment = fragments.get(i);
- if(interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
- final String stateInvariantId = StateInvariantUtils.getStateInvariantId(stateInvariant);
- final String baseStateInvariantName;
- if(stateInvariantId != null && fullLifelineView != null) {
- // in a full lifeline,
- final View stateDefinitionView = StateDefinitionUtils.getStateDefinitionViewWithId(stateInvariantId, fullLifelineView);
- baseStateInvariantName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- // update the StateInvariant name based on the corresponding StateDefinition name
- StateInvariantUtils.setInnerStateInvariantName(stateInvariant, baseStateInvariantName);
- } else {
- baseStateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- }
-
- if(baseStateInvariantName == null) {
- continue;
- }
- Integer count = stateInvariantCounts.get(baseStateInvariantName);
- if(count == null) {
- count = 0;
- }
- count++;
- // set the StateInvariant's name with its ordering number
- final String stateInvariantName = baseStateInvariantName + "_" + count; //$NON-NLS-1$
- stateInvariant.setName(stateInvariantName);
- stateInvariantCounts.put(baseStateInvariantName, count);
- stateInvariantNames.put(stateInvariant, stateInvariantName);
- }
- }
-
- // then, handle OccurrenceSpecification names (since they depend on StateInvariant names)
- // start at 1 and end at (size - 1) since we only care about OccurrenceSpecifications that
- // appear between StateInvariants
- final int nFragments = fragments.size();
- for(int i = 0; i < nFragments; i++) {
- final InteractionFragment interactionFragment = fragments.get(i);
- if(interactionFragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)interactionFragment;
- // don't override user modifications
- if(!OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
- continue;
- }
-
- if(i == 0) {
- // first fragment is an occurrence => creation
- occurrenceSpecification.setName(Messages.LifelineUtils_CreationOccurrence);
- continue;
- }
- if(i == nFragments - 1) {
- // last fragment is an occurrence => destruction
- occurrenceSpecification.setName(Messages.LifelineUtils_DestructionOccurrence);
- continue;
- }
-
- final InteractionFragment previous = fragments.get(i - 1);
- final InteractionFragment next = fragments.get(i + 1);
- if(!(previous instanceof StateInvariant) || !(next instanceof StateInvariant)) {
- continue;
- }
- final StateInvariant precedingStateInvariant = (StateInvariant)previous;
- final StateInvariant followingStateInvariant = (StateInvariant)next;
- String previousName = stateInvariantNames.get(precedingStateInvariant);
- String followingName = stateInvariantNames.get(followingStateInvariant);
- if(previousName == null) {
- previousName = "<unnamed>"; //$NON-NLS-1$
- }
- if(followingName == null) {
- followingName = "<unnamed>"; //$NON-NLS-1$
- }
- occurrenceSpecification.setName(previousName + "_To_" + followingName); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Returns a command that updates fragment names for Lifeline Views contained by Views referencing the given
- * element.
- *
- * @param element
- * an element contained in a Lifeline
- * @return a command to update the names of Lifeline fragments
- */
- public static IUndoableOperation getUpdateFragmentNamesCommand(final EObject element) {
- final Set<View> impactedLifelines = new HashSet<View>();
- final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(element, TimingDiagramEditPart.MODEL_ID);
- for(final View referencingView : crossReferencingViews) {
- View lifeline = ViewUtils.findSuperViewWithId(referencingView, FullLifelineEditPartCN.VISUAL_ID);
- if(lifeline == null) {
- lifeline = ViewUtils.findSuperViewWithId(referencingView, CompactLifelineEditPartCN.VISUAL_ID);
- }
- if(lifeline != null) {
- impactedLifelines.add(lifeline);
- }
- }
- if(impactedLifelines.isEmpty()) {
- return null;
- }
-
- final CompositeCommand compositeCommand = new CompositeCommand(Messages.LifelineUtils_UpdateFragmentNames);
- // update fragment names
- for(final View lifelineView : impactedLifelines) {
- Assert.isLegal(lifelineView.getElement() instanceof Lifeline);
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifelineView);
- compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.LifelineUtils_UpdateLifelineFragmentNames, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final EObject element = lifelineView.getElement();
- // note: the element becomes the Interaction when the Lifeline is deleted
- if(element instanceof Lifeline) {
- final Lifeline lifeline = (Lifeline)element;
- updateFragmentNames(lifeline, lifelineView);
- }
- return CommandResult.newOKCommandResult();
- }
- });
- }
- return compositeCommand;
- }
-
- public static boolean isLifelineEditPart(final int visualID) {
- return visualID == FullLifelineEditPartCN.VISUAL_ID || visualID == CompactLifelineEditPartCN.VISUAL_ID;
- }
-
- public static boolean isLifelineEditPart(final EditPart editPart) {
- return editPart instanceof FullLifelineEditPartCN || editPart instanceof CompactLifelineEditPartCN;
- }
-
- public static boolean isLifelineView(final View view) {
- final int visualID = UMLVisualIDRegistry.getVisualID(view);
- return isLifelineEditPart(visualID);
- }
-
- public static EditPart getLifelineCompartment(final EditPart lifelineEditPart) {
- EditPart compartment;
- if(lifelineEditPart instanceof FullLifelineEditPartCN) {
- compartment = EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- } else {
- compartment = EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- }
- if(compartment == null) {
- throw new IllegalStateException("No compartment in Lifeline"); //$NON-NLS-1$
- }
- return compartment;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
deleted file mode 100644
index 92db529d3ff..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-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.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageKind;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.MessageSort;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public final class MessageUtils {
-
- private static final String MESSAGE_CONNECTOR_LOCATION = "messageConnectorLocation"; //$NON-NLS-1$
-
- private static final String START_LOCATION = "startLocation"; //$NON-NLS-1$
-
- private static final String X = "x"; //$NON-NLS-1$
-
- private static final String Y = "y"; //$NON-NLS-1$
-
- /** Used for feedback when drawing a MessageFound */
- public static Point lastStartLocation = new Point();
-
- private MessageUtils() {
- // utility class
- }
-
- public static boolean isMessage(final IElementType requestElementType) {
- return requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4 || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44 || requestElementType == UMLElementTypes.Message_47 || requestElementType == UMLElementTypes.Message_50 || requestElementType == UMLElementTypes.Message_53;
- }
-
- public static boolean isMessage(final int visualID) {
- return visualID == MessageSyncEditPart.VISUAL_ID || visualID == MessageAsyncEditPart.VISUAL_ID || visualID == MessageReplyEditPart.VISUAL_ID || visualID == MessageCreateEditPart.VISUAL_ID || visualID == MessageDeleteEditPart.VISUAL_ID || visualID == MessageFoundEditPart.VISUAL_ID || visualID == MessageLostEditPart.VISUAL_ID;
- }
-
- public static MessageKind getMessageKind(final IElementType requestElementType) {
- if(requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4 || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44 || requestElementType == UMLElementTypes.Message_47) {
- return MessageKind.UNKNOWN_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_50) {
- return MessageKind.LOST_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_53) {
- return MessageKind.FOUND_LITERAL;
- }
- return null;
- }
-
- public static MessageSort getMessageSort(final IElementType requestElementType) {
- if(requestElementType == UMLElementTypes.Message_3) {
- return MessageSort.SYNCH_CALL_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_4) {
- return MessageSort.ASYNCH_CALL_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_41) {
- return MessageSort.REPLY_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_44) {
- return MessageSort.CREATE_MESSAGE_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_47) {
- return MessageSort.DELETE_MESSAGE_LITERAL;
- }
- if(requestElementType == UMLElementTypes.Message_50 || requestElementType == UMLElementTypes.Message_53) {
- // lost or found message
- return MessageSort.SYNCH_CALL_LITERAL;
- }
- return null;
- }
-
- public static IElementType getElementType(final Message message) {
- switch(message.getMessageKind()) {
- case LOST_LITERAL:
- return UMLElementTypes.Message_50;
- case FOUND_LITERAL:
- return UMLElementTypes.Message_53;
- default:
- }
-
- switch(message.getMessageSort()) {
- case SYNCH_CALL_LITERAL:
- return UMLElementTypes.Message_3;
- case ASYNCH_CALL_LITERAL:
- return UMLElementTypes.Message_4;
- case REPLY_LITERAL:
- return UMLElementTypes.Message_41;
- case CREATE_MESSAGE_LITERAL:
- return UMLElementTypes.Message_44;
- case DELETE_MESSAGE_LITERAL:
- return UMLElementTypes.Message_47;
- default:
- throw new IllegalArgumentException("Unknown message type"); //$NON-NLS-1$
- }
- }
-
- /**
- * Create a command to move a FloatingMessageAnchor, by changing the EAnnotation stored on the Connector.
- *
- * @param request
- * the request that contains the new Location
- * @param connectionEditPart
- * the EditPart for the connector
- * @param referenceFigure
- * the figure to which the anchor is relative
- * @param commandName
- * a name for the command
- * @param editingDomain
- * the editing domain
- * @return the command to move the anchor
- */
- public static Command createMoveMessageAnchorCommand(final LocationRequest request, final ConnectionEditPart connectionEditPart, final IFigure referenceFigure, final String commandName, final TransactionalEditingDomain editingDomain) {
- final Connector connector = (Connector)connectionEditPart.getModel();
- final Point location = request.getLocation();
- final Point figureLocation = new Point(referenceFigure.getBounds().getCenter());
- referenceFigure.getParent().translateToAbsolute(figureLocation);
- final double scale = FigureUtils.getScale(connectionEditPart.getFigure());
- final Point anchorLocation = new Point(location.x - figureLocation.x, location.y - figureLocation.y).scale(1.0 / scale);
-
- final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(new RefreshCommandForUndo(connectionEditPart));
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, commandName, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- setMessageConnectorLocation(connector, anchorLocation);
- return CommandResult.newOKCommandResult();
- }
- }));
- compoundCommand.add(new RefreshCommandForDo(connectionEditPart));
- return compoundCommand;
- }
-
- public static void setMessageConnectorLocation(final Connector connector, final Point location) {
- EAnnotation eAnnotation = connector.getEAnnotation(MESSAGE_CONNECTOR_LOCATION);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(MESSAGE_CONNECTOR_LOCATION);
- connector.getEAnnotations().add(eAnnotation);
- }
- eAnnotation.getDetails().put(X, Integer.toString(location.x));
- eAnnotation.getDetails().put(Y, Integer.toString(location.y));
- }
-
- public static Point getMessageConnectorLocation(final ConnectionEditPart connectionEditPart) {
- final double scale = FigureUtils.getScale(connectionEditPart.getFigure());
- final Connector connector = (Connector)connectionEditPart.getModel();
- final EAnnotation eAnnotation = connector.getEAnnotation(MESSAGE_CONNECTOR_LOCATION);
- if(eAnnotation != null) {
- return new Point(Integer.parseInt(eAnnotation.getDetails().get(X)), Integer.parseInt(eAnnotation.getDetails().get(Y))).scale(scale);
- }
- return null;
- }
-
- public static void saveRequestStartLocation(final CreateRequest request) {
- @SuppressWarnings("unchecked")
- final Map<Object, Object> extendedData = request.getExtendedData();
- final Point location = request.getLocation();
- extendedData.put(START_LOCATION, location);
- lastStartLocation = new Point(location);
- }
-
- public static Point retrieveRequestStartLocation(final CreateRequest request) {
- @SuppressWarnings("unchecked")
- final Map<Object, Object> extendedData = request.getExtendedData();
- return (Point)extendedData.get(START_LOCATION);
- }
-
- public static Point getLastStartLocation() {
- return lastStartLocation;
- }
-
- /**
- * Find {@link Message}s linked to the given element.
- *
- * @param element
- * the element for which related {@link Message}s must be found
- * @param hideOnly
- * whether to only return Views
- * @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
- * @return the list of linked {@link Message}s to remove
- */
- public static Collection<? extends EObject> getReferencingMessagesToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
- final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
- final Class<?>[] expectedClasses = new Class<?>[]{ Message.class };
- return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
- }
-
- /**
- * Convert the given element to a MessageOccurrenceSpecification (or its subtype DestructionOccurrenceSpecification
- * if <code>destruction</code> is <code>true</code>)
- *
- * @return the converted element, or <code>null</code> if the element is not an {@link OccurrenceSpecification}
- */
- public static MessageEnd convertToMessageOccurrenceSpecification(final EObject element, final boolean destruction) {
- // destruction => DestructionOccurrenceSpecification
- if(element instanceof MessageEnd && !destruction || element instanceof DestructionOccurrenceSpecification) {
- return (MessageEnd)element;
- }
-
- if(element instanceof OccurrenceSpecification) {
- // convert OccurrenceSpecification to MessageOccurrenceSpecification (or its subtype
- // DestructionOccurrenceSpecification if destruction is true)
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)element;
- final boolean autogeneratedName = OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification);
- final Set<View> views = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
-
- final MessageOccurrenceSpecification messageOccurrenceSpecification = destruction ? UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification() : UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
- // "autogenerated" EAnnotation is transferred on "do", but is lost on "redo" unless we set it explicitly
- OccurrenceSpecificationUtils.setAutogeneratedName(messageOccurrenceSpecification, autogeneratedName);
- EcoreUtils.replaceEObjectInstance(occurrenceSpecification, messageOccurrenceSpecification);
-
- // update the type of each View (the element has already been updated at this point)
- for(final View view : views) {
- final int type = UMLVisualIDRegistry.getVisualID(view);
- if(!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(type)) {
- continue;
- }
-
- view.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID : MessageOccurrenceSpecificationEditPartCN.VISUAL_ID));
- /*
- * The element must be updated manually here, because since BasicDecorationNodeImpl#getElement changes
- * the element without changing the "set" flag, the UsageCrossReferencer used above doesn't consider the
- * element reference (see Bug 394270 - BasicDecorationNodeImpl#getElement updates the element without
- * marking it as set), and so doesn't find the child View
- */
- @SuppressWarnings("unchecked")
- final List<View> children = new ArrayList<View>(view.getChildren());
- for(final View childView : children) {
- final int childType = UMLVisualIDRegistry.getVisualID(childView);
- if(OccurrenceSpecificationLabelEditPart.VISUAL_ID == childType || MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID == childType) {
- childView.setElement(messageOccurrenceSpecification);
- childView.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID : MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
- }
- }
- }
- return messageOccurrenceSpecification;
- }
- return null;
- }
-
- /**
- * Whether the given element is a {@link MessageEnd} ({@link MessageOccurrenceSpecification}, {@link DestructionOccurrenceSpecification} or
- * {@link Gate}), or can be converted to one ( {@link OccurrenceSpecification}).
- */
- public static boolean isPotentialMessageEnd(final EObject element) {
- return element instanceof MessageEnd || element instanceof OccurrenceSpecification;
- }
-
- public static Collection<EClass> getAllowedMessageTargets() {
- return Arrays.asList(UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getGate());
- }
-
- public static boolean isValidMessage(final MessageSort messageSort, final MessageKind messageKind, final EObject source, final EObject target) {
- // found message <=> source == null
- if(source == null != (messageKind == MessageKind.FOUND_LITERAL)) {
- return false;
- }
- // lost message <=> target == null
- if(target == null != (messageKind == MessageKind.LOST_LITERAL)) {
- return false;
- }
-
- if((messageSort == MessageSort.DELETE_MESSAGE_LITERAL || messageSort == MessageSort.CREATE_MESSAGE_LITERAL) && target instanceof Gate) {
- return false;
- }
- if(messageSort == MessageSort.CREATE_MESSAGE_LITERAL && target instanceof DestructionOccurrenceSpecification) {
- return false;
- }
- return true;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
deleted file mode 100644
index abe9e328992..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusAsyncNotificationPopup;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/** Validates a timing model in the context of a Papyrus timing diagram */
-public final class ModelValidationUtils {
-
- private ModelValidationUtils() {
- // utility class
- }
-
- /**
- * Validates the given {@link Interaction}. Note that this only validates rules specific to the timing diagram. The
- * model may be valid according to the UML specification, but we want it to follow some additional constraints in
- * the context of a Papyrus timing diagram:
- * <ul>
- * <li>A Lifeline's coveredBys must follow the same order as the containing Interaction's fragments
- * <li>There must be no fragment in a {@link Lifeline} after a {@link DestructionOccurrenceSpecification}
- * <li>There must always be an {@link OccurrenceSpecification} between two {@link StateInvariant}s in a Lifeline.
- * </ul>
- *
- * @param interaction
- * the Interaction to validate
- * @param autoCorrection
- * whether to fix the model if it is not considered valid for us
- * @param interactive
- * whether to display notifications to the user, and ask for confirmation using dialog boxes
- * @return whether the Interaction is valid for the Papyrus timing diagram, after potential fixes were applied (if <code>autoCorrection</code> is
- * <code>true</code>)
- */
- public static boolean validate(final Interaction interaction, final boolean autoCorrection, final boolean interactive) {
- final StringBuilder messageBuilder = new StringBuilder();
-
- // In order to ease the process, "coveredBy" features are reordered according to Interaction.fragments order.
- // autoCorrection is overridden as Lifeline.coveredBy is not ordered in UML
- reorderLifelineCoveredBy(interaction, messageBuilder);
-
- boolean isDestructionOccurrenceOK = false;
- boolean isOSbetweenSIOK = false;
- for(final Lifeline lifeline : interaction.getLifelines()) {
- // There must be no fragment after a DestructionOccurrence
- isDestructionOccurrenceOK = validateDestructionOccurrence(lifeline, autoCorrection, messageBuilder);
- // There must be an OccurrenceSpecification in between 2 StateInvariants
- isOSbetweenSIOK = validateOSbetweenSI(lifeline, autoCorrection, messageBuilder);
- }
-
- final Display display = Display.getCurrent();
- if(display != null) {
- final String popupMessage = messageBuilder.toString().trim();
- if(popupMessage.length() > 0) {
- // open a popup to notify the user about validation errors, and fixes that were applied
- final PapyrusAsyncNotificationPopup popup = new PapyrusAsyncNotificationPopup(display, new FormToolkit(display));
- popup.setTitle(Messages.ModelValidationUtils_ModelValidation);
- popup.setText(popupMessage);
- popup.open();
- }
- } else if(interactive) {
- throw new IllegalStateException("This method must be called on the UI thread when executed interactively"); //$NON-NLS-1$
- }
-
- return isDestructionOccurrenceOK && isOSbetweenSIOK;
- }
-
- private static void appendMessage(final StringBuilder message, final String string) {
- if(message.length() > 0) {
- // start adding dashes if there is more than one message
- if(message.charAt(0) != '-') {
- final String msg = message.toString();
- message.setLength(0);
- message.append("- ").append(msg); //$NON-NLS-1$
- }
- message.append("\n- "); //$NON-NLS-1$
- }
- message.append(string);
- }
-
- /**
- * Reorders the InteractionFragments in the coveredBys of all Lifelines in the given Interaction, so that they are
- * in the same order as the fragments of the Interaction.
- *
- * @param interaction
- * the Interaction whose Lifelines to reorder
- * @param messageBuilder
- * to build a validation message
- */
- private static void reorderLifelineCoveredBy(final Interaction interaction, final StringBuilder messageBuilder) {
- int reorderCount = 0;
- for(final Lifeline lifeline : interaction.getLifelines()) {
- final EList<InteractionFragment> coveredBy = lifeline.getCoveredBys();
- if(!coveredBy.isEmpty()) {
- final List<InteractionFragment> fragments = filterFragments(interaction.getFragments(), lifeline);
- int indexInFragments = 0;
- for(final InteractionFragment interactionFragment : fragments) {
- final int indexInLifeline = coveredBy.indexOf(interactionFragment);
- if(indexInFragments != indexInLifeline) {
- coveredBy.move(indexInFragments, indexInLifeline);
- reorderCount++;
- }
- indexInFragments++;
- }
- }
- }
- if(reorderCount > 0) {
- appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_CoveredByFragmentsWereReOrdered, Integer.toString(reorderCount)));
- }
- }
-
- /**
- * Return the sublist of the given fragments covered by the given Lifeline.
- *
- * @param fragments
- * the fragments list to filter
- * @param lifeline
- * the Lifeline which must be covered by the returned fragments
- * @return the filtered list of fragments that cover the Lifeline
- */
- private static List<InteractionFragment> filterFragments(final EList<InteractionFragment> fragments, final Lifeline lifeline) {
- final List<InteractionFragment> result = new ArrayList<InteractionFragment>();
- for(final InteractionFragment interactionFragment : fragments) {
- if(interactionFragment.getCovereds().contains(lifeline)) {
- result.add(interactionFragment);
- }
- }
- return result;
- }
-
- private static boolean validateDestructionOccurrence(final Lifeline lifeline, final boolean autoCorrection, final StringBuilder messageBuilder) {
- int wrongFragmentsFound = 0;
- int wrongFragmentsRemoved = 0;
-
- final ListIterator<InteractionFragment> listIterator = lifeline.getCoveredBys().listIterator();
- boolean afterDestructionOccurrenceSpecification = false;
- while(listIterator.hasNext()) {
- final InteractionFragment fragment = listIterator.next();
- if(afterDestructionOccurrenceSpecification) {
- if(autoCorrection) {
- listIterator.remove();
- wrongFragmentsRemoved++;
- } else {
- wrongFragmentsFound++;
- }
- }
- if(fragment instanceof DestructionOccurrenceSpecification) {
- afterDestructionOccurrenceSpecification = true;
- }
- }
-
- if(wrongFragmentsFound > 0) {
- appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsFound)));
- }
- if(wrongFragmentsRemoved > 0) {
- appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsRemoved)));
- }
-
- return wrongFragmentsFound == 0;
- }
-
- private static boolean validateOSbetweenSI(final Lifeline lifeline, final boolean autoCorrection, final StringBuilder messageBuilder) {
-
- final List<InteractionFragment> coveredBys = lifeline.getCoveredBys();
- int missingOccurrences = 0;
- final Map<OccurrenceSpecification, Integer> occurencesToBeAdded = new LinkedHashMap<OccurrenceSpecification, Integer>();
- InteractionFragment previousElement = null;
- int offset = 0;
- for(final InteractionFragment interactionFragment : coveredBys) {
- if(interactionFragment instanceof StateInvariant && previousElement instanceof StateInvariant) {
- if(autoCorrection) {
- final OccurrenceSpecification occurrence = UMLFactory.eINSTANCE.createOccurrenceSpecification();
- OccurrenceSpecificationUtils.setAutogeneratedName(occurrence, true);
- occurencesToBeAdded.put(occurrence, Integer.valueOf(coveredBys.indexOf(interactionFragment) + offset++));
- } else {
- missingOccurrences++;
- }
- }
- previousElement = interactionFragment;
- }
- if(!occurencesToBeAdded.isEmpty()) {
- for(final Entry<OccurrenceSpecification, Integer> entry : occurencesToBeAdded.entrySet()) {
- final OccurrenceSpecification occurrence = entry.getKey();
- final int indexInCoveredBys = entry.getValue().intValue();
- // Element must be a StateInvariant
- final StateInvariant stateInvariant = (StateInvariant)lifeline.getCoveredBys().get(indexInCoveredBys);
-
- // insert the OccurrenceSpecification before the StateInvariant in the Lifeline's coveredBys
- lifeline.getCoveredBys().add(indexInCoveredBys, occurrence);
-
- final EList<InteractionFragment> fragments = lifeline.getInteraction().getFragments();
- final int indexInFragments = fragments.indexOf(stateInvariant);
-
- // insert the OccurrenceSpecification before the StateInvariant in the Interaction's fragments
- fragments.add(indexInFragments, occurrence);
-
- String previousName = null;
- if(indexInCoveredBys > 0) {
- final InteractionFragment previousFragment = lifeline.getCoveredBys().get(indexInCoveredBys - 1);
- if(previousFragment instanceof StateInvariant) {
- final StateInvariant previousStateInvariant = (StateInvariant)previousFragment;
- previousName = previousStateInvariant.getName();
- }
- }
-
- String followingName = stateInvariant.getName();
- if(previousName == null) {
- previousName = "<unnamed>"; //$NON-NLS-1$
- }
- if(followingName == null) {
- followingName = "<unnamed>"; //$NON-NLS-1$
- }
- occurrence.setName(previousName + "_To_" + followingName); //$NON-NLS-1$
- }
- appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationAdded, Integer.valueOf(occurencesToBeAdded.size())));
- }
-
- if(missingOccurrences > 0) {
- appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationFound, Integer.valueOf(missingOccurrences)));
- }
- return missingOccurrences == 0;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
deleted file mode 100644
index 1dfb9931013..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-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.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
-
-/** Utility class for manipulating {@link OccurrenceSpecification}s */
-public final class OccurrenceSpecificationUtils {
-
- /** The key for the EAnnotation on an OccurrenceSpecification that indicates that its name is autogenerated */
- private static final String AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME = "org.eclipse.papyrus.uml.diagram.timing.autogeneratedOccurrenceSpecificationName"; //$NON-NLS-1$
-
- private OccurrenceSpecificationUtils() {
- // utility class
- }
-
- public static boolean isOccurrenceSpecificationEditPart(final int visualID) {
- return visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID || visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID || visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID;
- }
-
- public static boolean isOccurrenceSpecificationEditPart(final EditPart editPart) {
- return editPart instanceof OccurrenceSpecificationEditPartCN || editPart instanceof MessageOccurrenceSpecificationEditPartCN || editPart instanceof DestructionOccurrenceSpecificationEditPartCN;
- }
-
- public static boolean isOccurrenceSpecificationView(final View view) {
- final int visualID = UMLVisualIDRegistry.getVisualID(view);
- return isOccurrenceSpecificationEditPart(visualID);
- }
-
- private static EAnnotation getAutogeneratedAnnotation(final OccurrenceSpecification occurrenceSpecification) {
- return occurrenceSpecification.getEAnnotation(AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME);
- }
-
- /**
- * Marks with an EAnnotation whether the given OccurrenceSpecification has an auto-generated name.
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification for which to specify whether it has an auto-generated name
- * @param autogenerated
- * whether the name is auto-generated
- */
- public static void setAutogeneratedName(final OccurrenceSpecification occurrenceSpecification, final boolean autogenerated) {
- EAnnotation eAnnotation = getAutogeneratedAnnotation(occurrenceSpecification);
- if(autogenerated && eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME);
- occurrenceSpecification.getEAnnotations().add(eAnnotation);
- } else if(!autogenerated && eAnnotation != null) {
- occurrenceSpecification.getEAnnotations().remove(eAnnotation);
- }
- }
-
- /**
- * Returns whether the given OccurrenceSpecification has an auto-generated name.
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification for which to determine whether it has an auto-generated name
- * @return whether the name of the given OccurrenceSpecification is auto-generated
- */
- public static boolean isAutogeneratedName(final OccurrenceSpecification occurrenceSpecification) {
- final EAnnotation eAnnotation = getAutogeneratedAnnotation(occurrenceSpecification);
- return eAnnotation != null;
- }
-
- /**
- * Get all elements to delete when deleting an OccurrenceSpecification.
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification being deleted
- * @return the elements (EObjects and Views) that should be deleted together with the OccurrenceSpecification
- */
- public static Collection<EObject> getElementsToDelete(final OccurrenceSpecification occurrenceSpecification) {
- final Set<EObject> elementsToDestroy = new HashSet<EObject>();
- final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
- for(final View view : crossReferencingViews) {
- elementsToDestroy.addAll(getElementsToRemove(view, false));
- }
- return elementsToDestroy;
- }
-
- /**
- * Get all Views to remove when hiding an OccurrenceSpecification (i.e., deleting an OccurrenceSpecification's
- * View).
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification being hidden
- * @return the Views that should be hidden together with the given OccurrenceSpecification View
- */
- public static Collection<View> getViewsToHide(final View occurrenceSpecificationView) {
- final Set<View> viewsToHide = new HashSet<View>();
- final Collection<EObject> elementsToRemove = getElementsToRemove(occurrenceSpecificationView, true);
- for(final EObject eObject : elementsToRemove) {
- if(eObject instanceof View) {
- viewsToHide.add((View)eObject);
- } else {
- throw new IllegalStateException("Only views should be returned"); //$NON-NLS-1$
- }
- }
- return viewsToHide;
- }
-
- /**
- * Get all elements to remove when removing an OccurrenceSpecification.
- *
- * @param occurrenceSpecificationView
- * the OccurrenceSpecification View being removed
- * @param hideOnly
- * if <code>true</code>, only return the Views, not the semantic elements
- * @return the elements (Views and EObjects if <code>hideOnly</code> is <code>false</code>) that should be removed
- * together with the OccurrenceSpecification
- */
- public static Collection<EObject> getElementsToRemove(final View occurrenceSpecificationView, final boolean hideOnly) {
- final Set<EObject> elementsToRemove = new HashSet<EObject>();
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(occurrenceSpecificationView)) {
- // remove associated ticks
- final List<Node> associatedTickViews = TickUtils.getAssociatedTickViews(occurrenceSpecificationView);
- elementsToRemove.addAll(associatedTickViews);
-
- // only remove Views under the same Interaction
- final View interactionView = ViewUtils.findSuperViewWithId(occurrenceSpecificationView, InteractionEditPartTN.VISUAL_ID);
- final EObject eContainer = occurrenceSpecificationView.eContainer();
- if(eContainer instanceof Node) {
- final Node node = (Node)eContainer;
- @SuppressWarnings("unchecked")
- final EList<View> children = node.getChildren();
-
- final int childrenSize = children.size();
- final int index = children.indexOf(occurrenceSpecificationView);
-
- boolean done = false;
- // the Lifeline starts by an OccurrenceSpecification (created with a Create Message)
- if(index == 0) {
- if(index + 1 < childrenSize) {
- final View following = children.get(index + 1);
- if(following.getType().equals(Constants.verticalLineId)) {
- elementsToRemove.add(following);
- }
- }
- // let the Lifeline start from a StateInvariant again
- done = true;
- }
-
- // state change in a full lifeline
- if(!done && index + 2 < childrenSize) {
- final View following1 = children.get(index + 1);
- final View following2 = children.get(index + 2);
- if(following1.getType().equals(Constants.verticalLineId) && following2.getType().equals(Constants.fullStateInvariantId)) {
- elementsToRemove.add(following1);
- elementsToRemove.add(following2);
- if(!hideOnly) {
- elementsToRemove.add(following2.getElement());
- }
- elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(following2.getElement(), hideOnly, interactionView));
- done = true;
- }
- }
-
- // state change in a compact lifeline, or non-state-change OccurrenceSpecification in any Lifeline
- if(!done && index + 1 < childrenSize) {
- final View following = children.get(index + 1);
- if(following.getType().equals(Constants.fullStateInvariantId) || following.getType().equals(Constants.compactStateInvariantId)) {
- elementsToRemove.add(following);
- if(!hideOnly) {
- elementsToRemove.add(following.getElement());
- }
- elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(following.getElement(), hideOnly, interactionView));
- }
- }
- }
-
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)occurrenceSpecificationView.getElement();
- elementsToRemove.addAll(getRelatedElementsToRemove(occurrenceSpecification, hideOnly, interactionView));
-
- }
- return elementsToRemove;
- }
-
- public static Collection<? extends EObject> getRelatedElementsToRemove(final EObject occurrenceSpecification, final boolean hideOnly, final View interactionView) {
- Assert.isLegal(occurrenceSpecification instanceof OccurrenceSpecification);
- final Set<EObject> elementsToRemove = new HashSet<EObject>();
- elementsToRemove.addAll(TimeElementUtils.getTimeElementsToRemove(occurrenceSpecification, hideOnly, interactionView));
- elementsToRemove.addAll(MessageUtils.getReferencingMessagesToRemove(occurrenceSpecification, hideOnly, interactionView));
- elementsToRemove.addAll(GeneralOrderingUtils.getReferencingGeneralOrderingsToRemove(occurrenceSpecification, hideOnly, interactionView));
- return elementsToRemove;
- }
-
- /**
- * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s after the given
- * DestructionOccurrenceSpecification (which signifies the end of a Lifeline). Doesn't delete time elements.
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification after which everything must be deleted
- * @param occurrenceSpecificationView
- * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
- * the views will be searched)
- */
- private static void deleteEverythingAfterOrBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView, final boolean before) {
- // remove fragments from UML model
- final EList<Lifeline> coveredLifelines = occurrenceSpecification.getCovereds();
- for(final Lifeline lifeline : coveredLifelines) {
- final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
- int index = coveredBys.indexOf(occurrenceSpecification);
- if(index != -1) {
- // if we are removing everything before an OccurrenceSpecification in the middle of a StateInvariant,
- // then we need to move the StateInvariant after the OccurrenceSpecification
- if(before && index + 1 < coveredBys.size() && !(coveredBys.get(index + 1) instanceof StateInvariant)) {
- if(movePreviousStateInvariantAfter(coveredBys, occurrenceSpecification)) {
- // the OccurrenceSpecification moved since we removed an element before it
- index--;
- }
- }
- final List<InteractionFragment> fragmentsToRemove = new ArrayList<InteractionFragment>();
- for(int i = before ? index - 1 : index + 1; before ? i >= 0 : i < coveredBys.size(); i = (before ? i - 1 : i + 1)) {
- fragmentsToRemove.add(coveredBys.get(i));
- }
- for(final InteractionFragment fragmentToRemove : fragmentsToRemove) {
- // remove the related elements
- Collection<? extends EObject> relatedElementsToRemove = Collections.emptyList();
- if(fragmentToRemove instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrence = (OccurrenceSpecification)fragmentToRemove;
- relatedElementsToRemove = OccurrenceSpecificationUtils.getRelatedElementsToRemove(occurrence, false, null);
- } else if(fragmentToRemove instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)fragmentToRemove;
- relatedElementsToRemove = StateInvariantUtils.getRelatedElementsToRemove(stateInvariant, false, null);
- }
- for(final EObject eObject : relatedElementsToRemove) {
- DestroyElementCommand.destroy(eObject);
- }
- // remove the fragment
- DestroyElementCommand.destroy(fragmentToRemove);
- }
- }
- }
- // remove Views from notation model
- final Collection<View> views;
- if(occurrenceSpecificationView == null) {
- views = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
- } else {
- views = Collections.singletonList(occurrenceSpecificationView);
- }
- for(final View view : views) {
- final View parentView = (View)view.eContainer();
- @SuppressWarnings("unchecked")
- final EList<View> children = parentView.getChildren();
- final int index = children.indexOf(view);
- if(index != -1) {
- final List<View> viewsToRemove = new ArrayList<View>();
- for(int i = before ? index - 1 : index + 1; before ? i >= 0 : i < children.size(); i = (before ? i - 1 : i + 1)) {
- final View childView = children.get(i);
- final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- if(isOccurrenceSpecificationEditPart(visualID) || StateInvariantUtils.isStateInvariantEditPart(visualID) || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
- viewsToRemove.add(childView);
- }
- }
- // remove the vertical line (a state change is not possible anymore
- // since we deleted the preceding state invariant)
- if(before && index + 1 < children.size()) {
- final View childView = children.get(index + 1);
- final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- if(visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
- viewsToRemove.add(childView);
- }
- }
- for(final View viewToRemove : viewsToRemove) {
- ViewUtil.destroy(viewToRemove);
- }
- }
- }
- }
-
- private static boolean movePreviousStateInvariantAfter(final EList<InteractionFragment> fragments, final OccurrenceSpecification occurrenceSpecification) {
- final int umlIndex = fragments.indexOf(occurrenceSpecification);
- // move the StateInvariant in the UML model
- final int previousStateInvariantIndex = findPreviousStateInvariantIndex(umlIndex, fragments);
- if(previousStateInvariantIndex == -1) {
- Activator.log.error(new IllegalStateException("No StateInvariant after or before the OccurrenceSpecification")); //$NON-NLS-1$
- return false;
- }
- final StateInvariant stateInvariant = (StateInvariant)fragments.get(previousStateInvariantIndex);
- fragments.move(umlIndex, previousStateInvariantIndex);
-
- // move the StateInvariant View in the notation model
- final Collection<View> stateInvariantViews = CrossReferencerUtil.getCrossReferencingViews(stateInvariant, TimingDiagramEditPart.MODEL_ID);
- for(final View stateInvariantView : stateInvariantViews) {
- final View parentView = (View)stateInvariantView.eContainer();
- @SuppressWarnings("unchecked")
- final EList<View> children = parentView.getPersistedChildren();
- // find the OccurrenceSpecification View index
- int viewIndex = -1;
- for(int i = 0; i < children.size(); i++) {
- final View view = children.get(i);
- if(view.getElement() == occurrenceSpecification) {
- viewIndex = i;
- break;
- }
- }
- children.move(viewIndex, stateInvariantView);
- }
- return true;
- }
-
- private static int findPreviousStateInvariantIndex(final int index, final EList<InteractionFragment> fragments) {
- for(int i = index - 1; i >= 0; i--) {
- final InteractionFragment fragment = fragments.get(i);
- if(fragment instanceof StateInvariant) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s after the given
- * DestructionOccurrenceSpecification (which signifies the end of a Lifeline). Doesn't delete time elements.
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification after which everything must be deleted
- * @param occurrenceSpecificationView
- * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
- * the views will be searched)
- */
- public static void deleteEverythingAfter(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView) {
- deleteEverythingAfterOrBefore(occurrenceSpecification, occurrenceSpecificationView, false);
- }
-
- /**
- * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s before the given {@link OccurrenceSpecification} (which signifies the
- * creation of a Lifeline). Doesn't delete time elements.
- *
- * @param occurrenceSpecification
- * the OccurrenceSpecification before which everything must be deleted
- * @param occurrenceSpecificationView
- * the OccurrenceSpecification View before which other views must be deleted (if <code>null</code>, then
- * the views will be searched)
- */
- public static void deleteEverythingBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView) {
- deleteEverythingAfterOrBefore(occurrenceSpecification, occurrenceSpecificationView, true);
- }
-
- /**
- * Find at which index to insert an OccurrenceSpecification in a compartment, based on a location.
- *
- * @param pt
- * the location
- * @param compartmentView
- * the compartment view in which the OccurrenceSpecification will be inserted
- * @param viewer
- * the viewer in which the EditParts corresponding to the Views are registered
- * @return the index in the compartment where the OccurrenceSpecification should be inserted
- */
- public static int findInsertionIndexFor(final Point pt, final View compartmentView, final EditPartViewer viewer) {
- @SuppressWarnings("unchecked")
- final EList<View> children = compartmentView.getChildren();
- int index = 0;
- for(final View view : children) {
- if(view instanceof Node) {
- final Node node = (Node)view;
- final Object editPart = viewer.getEditPartRegistry().get(node);
- if(editPart instanceof GraphicalEditPart) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
- final Rectangle bounds = graphicalEditPart.getFigure().getBounds();
- if(pt.x < bounds.x()) {
- break;
- }
- } else {
- Activator.log.error(new Exception("No EditPart found for the Node")); //$NON-NLS-1$
- }
- }
- index++;
- }
- return index;
- }
-
- /**
- * Wrap the given <code>baseCommand</code> (that hides an OccurrenceSpecification View) into a {@link CompoundCommand}, and add a deletion of
- * other Views associated to the OccurrenceSpecification.
- */
- public static CompoundCommand getHideOccurrenceSpecificationCommand(final EditPart occurrenceSpecificationEditPart, final Command baseCommand) {
- final View view = (View)occurrenceSpecificationEditPart.getModel();
- if(!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(UMLVisualIDRegistry.getVisualID(view))) {
- return null;
- }
- final Collection<View> viewsToHide = OccurrenceSpecificationUtils.getViewsToHide(view);
- final CompoundCommand compoundCommand = new CompoundCommand(Messages.OccurrenceSpecificationUtils_HideOccurrenceSpecification);
- if(baseCommand != null) {
- compoundCommand.add(baseCommand);
- }
- for(final View viewToHide : viewsToHide) {
- compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToHide)));
- }
- if(compoundCommand.isEmpty()) {
- return null;
- }
- return compoundCommand;
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
deleted file mode 100644
index 570b0717035..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.notation.View;
-
-public final class RequestUtils {
-
- private RequestUtils() {
- // utility class
- }
-
- /** Whether the given request is a ChangeBoundsRequest concerning instances of the given EClass only. */
- public static boolean isChangeBoundsRequestFor(final Request request, final EClass eClass) {
- if(request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- return isGroupRequestFor(changeBoundsRequest, eClass);
- }
- return false;
- }
-
- /** Whether the given request is a ChangeBoundsRequest concerning instances of the given EditPart only. */
- public static boolean isChangeBoundsRequestFor(final Request request, final Class<? extends EditPart> editPartClass) {
- if(request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- return isGroupRequestFor(changeBoundsRequest, editPartClass);
- }
- return false;
- }
-
- /** Whether the given request is a GroupRequest concerning instances of the given EClass only. */
- public static boolean isGroupRequestFor(final GroupRequest groupRequest, final EClass eClass) {
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = groupRequest.getEditParts();
- if(editParts == null) {
- return false;
- }
- for(final EditPart editPart : editParts) {
- final Object model = editPart.getModel();
- if(model instanceof View) {
- final View view = (View)model;
- final EObject element = view.getElement();
- if(!eClass.isInstance(element)) {
- return false;
- }
- } else {
- return false;
- }
- }
- return true;
- }
-
- /** Whether the given request is a GroupRequest concerning instances of the given EditPart only. */
- public static boolean isGroupRequestFor(final GroupRequest groupRequest, final Class<? extends EditPart> editPartClass) {
- @SuppressWarnings("unchecked")
- final List<EditPart> editParts = groupRequest.getEditParts();
- for(final EditPart editPart : editParts) {
- if(!editPartClass.isInstance(editPart)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
deleted file mode 100644
index 1fc4e8a3ba1..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.EMap;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.StateInvariant;
-
-/**
- * Utility class for the creation and retrieval of StateDefinition names through EAnnotations on Lifeline and
- * StateDefinition View
- */
-public final class StateDefinitionUtils {
-
- /** The key for the EAnnotation on a Lifeline in which the StateDefinition (id,name) detail map is contained */
- private static final String LIFELINE_STATE_DEFINITIONS_KEY = "org.eclipse.papyrus.uml.diagram.timing.LifelineStateDefinitions"; //$NON-NLS-1$
-
- /**
- * The key for the EAnnotation on a StateDefinition View in which the id (STATE_DEFINITION_VIEW_ID_KEY) and name
- * (STATE_DEFINITION_VIEW_NAME_KEY) are defined
- */
- private static final String STATE_DEFINITION_VIEW_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionView"; //$NON-NLS-1$
-
- /** The key for the name of a StateDefinition in the details map of a StateDefinition View's annotations */
- private static final String STATE_DEFINITION_VIEW_ID_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionViewID"; //$NON-NLS-1$
-
- /** The key for the id of a StateDefinition in the details map of a StateDefinition View's annotations */
- private static final String STATE_DEFINITION_VIEW_NAME_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionViewName"; //$NON-NLS-1$
-
- private StateDefinitionUtils() {
- // utility class
- }
-
- public static boolean hasStateDefinitionEAnnotation(final Lifeline lifeline) {
- final EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
- if(eAnnotation == null) {
- return false;
- }
- return !eAnnotation.getDetails().isEmpty();
- }
-
- /** Get or create an EAnnotation in the given Lifeline, to hold the map of state definition IDs and names */
- public static EAnnotation getOrCreateStateDefinitionsEAnnotation(final Lifeline lifeline) {
- EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(LIFELINE_STATE_DEFINITIONS_KEY);
- lifeline.getEAnnotations().add(eAnnotation);
- }
- return eAnnotation;
- }
-
- /**
- * Get the EAnnotation that contains a Details map (stateDefinitionId,stateDefinitionName) on the given Lifeline, or <code>null</code> if none was
- * created
- */
- public static EAnnotation getStateDefinitionsEAnnotation(final Lifeline lifeline) {
- return lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
- }
-
- public static String getStateDefinitionViewID(final View stateDefinitionView) {
- final EAnnotation eAnnotation = stateDefinitionView.getEAnnotation(STATE_DEFINITION_VIEW_KEY);
- if(eAnnotation != null) {
- return eAnnotation.getDetails().get(STATE_DEFINITION_VIEW_ID_KEY);
- }
- return null;
- }
-
- private static EAnnotation getOrCreateStateDefinitionViewAnnotation(final View stateDefinitionView) {
- EAnnotation eAnnotation = stateDefinitionView.getEAnnotation(STATE_DEFINITION_VIEW_KEY);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(STATE_DEFINITION_VIEW_KEY);
- stateDefinitionView.getEAnnotations().add(eAnnotation);
- }
- return eAnnotation;
- }
-
- public static void setStateDefinitionViewID(final View stateDefinitionView, final String id) {
- final EAnnotation eAnnotation = getOrCreateStateDefinitionViewAnnotation(stateDefinitionView);
- eAnnotation.getDetails().put(STATE_DEFINITION_VIEW_ID_KEY, id);
- }
-
- private static void setStateDefinitionViewName(final View stateDefinitionView, final String name) {
- final EAnnotation eAnnotation = getOrCreateStateDefinitionViewAnnotation(stateDefinitionView);
- eAnnotation.getDetails().put(STATE_DEFINITION_VIEW_NAME_KEY, name);
- }
-
- public static void setStateDefinitionName(final View stateDefinitionView, final String newName) {
- checkStateDefinitionView(stateDefinitionView);
- String stateDefinitionViewID = getStateDefinitionViewID(stateDefinitionView);
- if(stateDefinitionViewID == null) {
- // generate a unique ID that we will use to link the StateDefinition Figure to its name in the
- // EAnnotation: we have a map (ID,name) in the Lifeline's EAnnotation and an entry (View,ID) in the
- // StateDefinition Figure's EAnnotation
- stateDefinitionViewID = EcoreUtil.generateUUID();
- setStateDefinitionViewID(stateDefinitionView, stateDefinitionViewID);
- }
- final Lifeline lifeline = StateDefinitionUtils.getParentLifeline(stateDefinitionView);
- final EAnnotation lifelineEAnnotation = getOrCreateStateDefinitionsEAnnotation(lifeline);
- lifelineEAnnotation.getDetails().put(stateDefinitionViewID, newName);
- // setting the name on the View too lets the Label refresh, since the refresh is only listening on the DI model
- setStateDefinitionViewName(stateDefinitionView, newName);
- }
-
- public static void removeStateDefinitionEAnnotationFromLifeline(final String id, final Lifeline lifeline) {
- final EAnnotation lifelineEAnnotation = getStateDefinitionsEAnnotation(lifeline);
- if(lifelineEAnnotation != null) {
- lifelineEAnnotation.getDetails().removeKey(id);
- }
- }
-
- public static String getStateDefinitionName(final View stateDefinitionView) {
- checkStateDefinitionView(stateDefinitionView);
- final String stateDefinitionViewID = getStateDefinitionViewID(stateDefinitionView);
- if(stateDefinitionViewID == null) {
- return null;
- }
- final Lifeline lifeline = StateDefinitionUtils.getParentLifeline(stateDefinitionView);
- return getStateDefinitionName(stateDefinitionViewID, lifeline);
- }
-
- public static String getStateDefinitionName(final String stateDefinitionViewID, final Lifeline lifeline) {
- if(stateDefinitionViewID == null || lifeline == null) {
- return null;
- }
- final EAnnotation lifelineEAnnotation = getStateDefinitionsEAnnotation(lifeline);
- if(lifelineEAnnotation == null) {
- return null;
- }
- return lifelineEAnnotation.getDetails().get(stateDefinitionViewID);
- }
-
- public static View getParentLifelineView(final View view) {
- final String id = Integer.toString(FullLifelineEditPartCN.VISUAL_ID);
- View parent = view;
- while(parent != null) {
- if(id.equals(parent.getType())) {
- return parent;
- }
- parent = (View)parent.eContainer();
- }
- throw new IllegalStateException("Parent Lifeline not found"); //$NON-NLS-1$
- }
-
- public static Lifeline getParentLifeline(final View view) {
- final View parentLifelineView = getParentLifelineView(view);
- if(parentLifelineView != null) {
- return (Lifeline)parentLifelineView.getElement();
- }
- return null;
- }
-
- /** Set a new name on the given StateDefinition view */
- public static void initNewStateDefinitionName(final View stateDefinitionView) {
- checkStateDefinitionView(stateDefinitionView);
- final View stateDefinitionsCompartment = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID);
- final List<View> allStateDefinitionViews = ViewUtils.findSubViewsWithId(stateDefinitionsCompartment, StateDefinitionEditPart.VISUAL_ID);
- final Set<String> existingNames = new HashSet<String>();
- for(final View aStateDefinitionView : allStateDefinitionViews) {
- existingNames.add(getStateDefinitionName(aStateDefinitionView));
- }
- setStateDefinitionName(stateDefinitionView, findNewStateName(existingNames));
- }
-
- private static String findNewStateName(final Set<String> existingNames) {
- String newName = ""; //$NON-NLS-1$
- final String prefix = Messages.StateDefinitionUtils_State;
- int suffix = 1;
- while(true) {
- newName = prefix + suffix;
- if(!existingNames.contains(newName)) {
- break;
- }
- suffix++;
- }
- return newName;
- }
-
- public static View getStateDefinitionViewWithId(final String id, final View lifelineView) {
- checkLifelineView(lifelineView);
- final List<View> stateDefinitionViews = ViewUtils.findSubViewsWithId(lifelineView, StateDefinitionEditPart.VISUAL_ID);
- for(final View stateDefinitionView : stateDefinitionViews) {
- if(id.equals(getStateDefinitionViewID(stateDefinitionView))) {
- return stateDefinitionView;
- }
- }
- return null;
- }
-
- public static View getStateDefinitionViewWithName(final String name, final View lifelineView) {
- checkLifelineView(lifelineView);
- final List<View> stateDefinitionViews = ViewUtils.findSubViewsWithId(lifelineView, StateDefinitionEditPart.VISUAL_ID);
- for(final View stateDefinitionView : stateDefinitionViews) {
- if(name.equals(getStateDefinitionName(stateDefinitionView))) {
- return stateDefinitionView;
- }
- }
- return null;
- }
-
- public static List<String> getStateDefinitionIds(final Lifeline lifeline) {
- final EAnnotation eAnnotation = getStateDefinitionsEAnnotation(lifeline);
- if(eAnnotation != null) {
- final EMap<String, String> details = eAnnotation.getDetails();
- final List<String> result = new ArrayList<String>();
- // note: using the iterator preserves the order
- final Iterator<Entry<String, String>> iterator = details.iterator();
- while(iterator.hasNext()) {
- final Entry<String, String> entry = iterator.next();
- result.add(entry.getKey());
- }
- return result;
- }
- return Collections.emptyList();
- }
-
- private static void checkStateDefinitionView(final View stateDefinitionView) {
- if(!Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(stateDefinitionView.getType())) {
- throw new IllegalArgumentException("The parameter must be a StateDefinition View (id = " + StateDefinitionEditPart.VISUAL_ID + "). The id was " + stateDefinitionView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private static void checkLifelineView(final View lifelineView) {
- if(!Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
- throw new IllegalArgumentException("The parameter must be a Lifeline View (id = " + FullLifelineEditPartCN.VISUAL_ID + "). The id was " + lifelineView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /** Find the StateDefinition closest to the given y-coordinate and return it. */
- public static StateDefinitionEditPart findStateDefinitionClosestToOrdinate(final FullLifelineEditPartCN lifelineEditPart, final int ordinate) {
- @SuppressWarnings("unchecked")
- final List<GraphicalEditPart> editParts = (List<GraphicalEditPart>)EditPartUtils.findChildEditPartsWithId(lifelineEditPart, StateDefinitionEditPart.VISUAL_ID);
- return (StateDefinitionEditPart)EditPartUtils.findEditPartClosestToOrdinate(ordinate, editParts);
- }
-
- /**
- * Updates the StateDefinitions of the given Lifeline so that they match the names of the fragments covered by this
- * Lifeline. This should only be called on a compact lifeline. The purpose of this operation is to make sure that
- * the UML model is the same for a compact lifeline as a full lifeline, so that the two types of lifelines can be
- * switched easily at any time.
- *
- * @param lifeline
- * the lifeline to update
- */
- public static void updateStateDefinitionNamesForCompactLifeline(final Lifeline lifeline) {
- final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
- final Map<String, String> nameIdMap = new LinkedHashMap<String, String>();
- // first, get all the unique state invariant names and generate the associated ids
- for(final InteractionFragment interactionFragment : coveredBys) {
- if(interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
- final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- nameIdMap.put(name, EcoreUtil.generateUUID());
- }
- }
- // then, (re-)create the StateDefinitions
- final EAnnotation stateDefinitionsEAnnotation = getOrCreateStateDefinitionsEAnnotation(lifeline);
- stateDefinitionsEAnnotation.getDetails().clear();
- for(final Entry<String, String> entry : nameIdMap.entrySet()) {
- final String name = entry.getKey();
- final String id = entry.getValue();
- stateDefinitionsEAnnotation.getDetails().put(id, name);
- }
- // then, set the IDs on the state invariants
- for(final InteractionFragment interactionFragment : coveredBys) {
- if(interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
- final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- final String id = nameIdMap.get(name);
- StateInvariantUtils.setStateInvariantId(stateInvariant, id);
- }
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
deleted file mode 100644
index 3022d87e5ee..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-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.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.OperationForbiddenException;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.OpaqueExpression;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-public final class StateInvariantUtils {
-
- private StateInvariantUtils() {
- // utility class
- }
-
- /** The key for the EAnnotation on a {@link StateInvariant} */
- private static final String STATE_INVARIANT_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateInvariant"; //$NON-NLS-1$
-
- /** The key for the corresponding StateDefinition, defined in the details map in the EAnnotation on a StateInvariant */
- private static final String STATE_INVARIANT_STATE_DEFINITION_ID_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateInvariantStateDefinitionId"; //$NON-NLS-1$
-
- /**
- * Create a StateInvariant and its View.
- *
- * @param stateDefinitionId
- * the id of the state definition that the state invariant will be set to
- * @param lifelineEditPart
- * the Lifeline in which the StateInvariant must be added
- * @param indexInFragments
- * index to insert the state invariant in the Interaction's fragments list (-1 to insert at the end)
- * @param indexInCoveredBys
- * index to insert the state invariant in the Lifeline's coveredBys list (-1 to insert at the end)
- * @param indexInCompartment
- * index to insert the state invariant in the Compartment's children list (-1 to insert at the end)
- * @return the Node that represents the StateInvariant in the GMF model
- */
- public static Node createStateInvariant(final String stateDefinitionId, final FullLifelineEditPartCN lifelineEditPart, final int indexInFragments, final int indexInCoveredBys, final int indexInCompartment) {
- final View timelineCompartmentView = (View)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID).getModel();
- final View lifelineView = (View)lifelineEditPart.getModel();
- final Lifeline lifeline = (Lifeline)lifelineView.getElement();
-
- // create the StateInvariant
- final StateInvariant newStateInvariant = UMLFactory.eINSTANCE.createStateInvariant();
- final Constraint newConstraint = UMLFactory.eINSTANCE.createConstraint();
- newStateInvariant.setInvariant(newConstraint);
- final OpaqueExpression newOpaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
- final View stateDefinitionView = StateDefinitionUtils.getStateDefinitionViewWithId(stateDefinitionId, lifelineView);
- final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- newConstraint.setSpecification(newOpaqueExpression);
-
- if(indexInFragments == -1) {
- lifeline.getInteraction().getFragments().add(newStateInvariant);
- } else {
- lifeline.getInteraction().getFragments().add(indexInFragments, newStateInvariant);
- }
- if(indexInCoveredBys == -1) {
- lifeline.getCoveredBys().add(newStateInvariant);
- } else {
- lifeline.getCoveredBys().add(indexInCoveredBys, newStateInvariant);
- }
-
- // associate the StateInvariant with the StateDefinition through the same id
- setStateInvariantId(newStateInvariant, stateDefinitionId);
- setInnerStateInvariantName(newStateInvariant, stateDefinitionName);
-
- // create the View for the new state invariant
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateInvariantNode = umlViewProvider.createStateInvariant_11(newStateInvariant, timelineCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- return stateInvariantNode;
- }
-
- public static Node createCompactStateInvariant(final View lifelineCompartmentView, final int indexInFragments, final int indexInCoveredBys, final int indexInCompartment) {
-
- final Lifeline lifeline = (Lifeline)lifelineCompartmentView.getElement();
-
- // create the StateInvariant
- final StateInvariant newStateInvariant = UMLFactory.eINSTANCE.createStateInvariant();
- final Constraint newConstraint = UMLFactory.eINSTANCE.createConstraint();
- newStateInvariant.setInvariant(newConstraint);
- final OpaqueExpression newOpaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
-
- newConstraint.setSpecification(newOpaqueExpression);
-
- if(indexInFragments == -1) {
- lifeline.getInteraction().getFragments().add(newStateInvariant);
- } else {
- lifeline.getInteraction().getFragments().add(indexInFragments, newStateInvariant);
- }
- if(indexInCoveredBys == -1) {
- lifeline.getCoveredBys().add(newStateInvariant);
- } else {
- lifeline.getCoveredBys().add(indexInCoveredBys, newStateInvariant);
- }
-
- // create the View for the new state invariant
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateInvariantNode = umlViewProvider.createStateInvariant_28(newStateInvariant, lifelineCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
- return stateInvariantNode;
- }
-
- /**
- * Set the value of the body in the ValueSpecification (which must be an OpaqueExpression) of the Constraint of this
- * StateInvariant and the name of the Constraint.
- *
- * @param stateInvariant
- * the StateInvariant whose name to update
- * @param newName
- * the new name for the StateInvariant (which is the name of the corresponding StateDefinition in a full
- * Lifeline)
- */
- public static void setInnerStateInvariantName(final StateInvariant stateInvariant, final String newName) {
- final Constraint constraint = stateInvariant.getInvariant();
- Assert.isNotNull(constraint, "The StateInvariant must have a Constraint"); //$NON-NLS-1$
- // set the constraint's name
- constraint.setName("InState_" + newName); //$NON-NLS-1$
- final ValueSpecification specification = constraint.getSpecification();
- Assert.isNotNull(specification, "The Constraint must have a ValueSpecification"); //$NON-NLS-1$
- Assert.isLegal(specification instanceof OpaqueExpression, "The ValueSpecification must be an OpaqueExpression"); //$NON-NLS-1$
- final OpaqueExpression opaqueExpression = (OpaqueExpression)specification;
- // (re-)set the body
- opaqueExpression.getBodies().clear();
- opaqueExpression.getBodies().add(newName);
- }
-
- /**
- * Return the value of the body in the ValueSpecification (which must be an OpaqueExpression) of the Constraint of
- * this StateInvariant.
- * <p>
- * In a compact Lifeline, the name is duplicated:
- * <ul>
- * <li>the StateInvariant's name
- * <li>the body in the OpaqueExpression of the Constraint of the StateInvariant
- * </ul>
- * In addition to this, in a full Lifeline, the name appears in a third place:
- * <ul>
- * <li>the name of the corresponding StateDefinition (defined in the EAnnotation on the Lifeline) which has an id matching the id stored in the
- * StateInvariant's EAnnotation: this is the canonical name when in a full Lifeline (see {@link StateDefinitionUtils})
- * </ul>
- *
- * */
- public static String getInnerStateInvariantName(final StateInvariant stateInvariant) {
- final Constraint constraint = stateInvariant.getInvariant();
- if(constraint == null) {
- return null;
- }
- final ValueSpecification specification = constraint.getSpecification();
- if(specification == null || !(specification instanceof OpaqueExpression)) {
- return null;
- }
- final OpaqueExpression opaqueExpression = (OpaqueExpression)specification;
- final EList<String> bodies = opaqueExpression.getBodies();
- if(bodies == null || bodies.size() < 1) {
- return null;
- }
- return bodies.get(0);
- }
-
- public static void setStateInvariantId(final StateInvariant stateInvariant, final String id) {
- final EAnnotation eAnnotation = getOrCreateStateInvariantEAnnotation(stateInvariant);
- eAnnotation.getDetails().put(STATE_INVARIANT_STATE_DEFINITION_ID_KEY, id);
- }
-
- public static String getStateInvariantId(final StateInvariant stateInvariant) {
- final EAnnotation eAnnotation = stateInvariant.getEAnnotation(STATE_INVARIANT_KEY);
- if(eAnnotation != null) {
- return eAnnotation.getDetails().get(STATE_INVARIANT_STATE_DEFINITION_ID_KEY);
- }
- return null;
- }
-
- private static EAnnotation getOrCreateStateInvariantEAnnotation(final StateInvariant stateInvariant) {
- EAnnotation eAnnotation = stateInvariant.getEAnnotation(STATE_INVARIANT_KEY);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(STATE_INVARIANT_KEY);
- stateInvariant.getEAnnotations().add(eAnnotation);
- }
- return eAnnotation;
- }
-
- /** Find and return all the StateInvariants defined in the given Interaction that have the given id. */
- public static List<StateInvariant> findStateInvariantsWithId(final String id, final Interaction interaction) {
- final List<StateInvariant> stateInvariants = new ArrayList<StateInvariant>();
- final EList<InteractionFragment> fragments = interaction.getFragments();
- for(final InteractionFragment interactionFragment : fragments) {
- if(interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
- final String stateInvariantId = getStateInvariantId(stateInvariant);
- if(id.equals(stateInvariantId)) {
- stateInvariants.add(stateInvariant);
- }
- }
- }
- return stateInvariants;
- }
-
- /**
- * Get all elements to delete when deleting a StateInvariant.
- *
- * @param stateInvariant
- * the StateInvariant being deleted
- * @return the elements (EObjects and Views) that should be deleted together with the StateInvariant
- * @throws OperationForbiddenException
- * if the StateInvariant should not be deleted
- */
- public static Collection<EObject> getElementsToDelete(final StateInvariant stateInvariant) throws OperationForbiddenException {
- final Set<EObject> elementsToDestroy = new HashSet<EObject>();
- final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(stateInvariant, TimingDiagramEditPart.MODEL_ID);
- for(final View view : crossReferencingViews) {
- elementsToDestroy.addAll(getElementsToRemove(view, false));
- }
- return elementsToDestroy;
- }
-
- /**
- * Get all Views to remove when hiding a StateInvariant (i.e., deleting a StateInvariant's View).
- *
- * @param stateInvariant
- * the StateInvariant being hidden
- * @return the Views that should be hidden together with the given StateInvariant View
- * @throws OperationForbiddenException
- * if the StateInvariant should not be hidden
- */
- public static Collection<View> getViewsToHide(final View stateInvariantView) throws OperationForbiddenException {
-
- final Set<View> viewsToHide = new HashSet<View>();
- final Collection<EObject> elementsToRemove = getElementsToRemove(stateInvariantView, true);
- for(final EObject eObject : elementsToRemove) {
- if(eObject instanceof View) {
- viewsToHide.add((View)eObject);
- } else {
- throw new IllegalStateException("Only views should be returned"); //$NON-NLS-1$
- }
- }
- return viewsToHide;
- }
-
- /**
- * Get all elements to remove when removing a StateInvariant.
- *
- * @param view
- * the StateInvariant View being removed
- * @param hideOnly
- * if <code>true</code>, only return the Views, not the semantic elements
- * @return the elements (Views and EObjects if <code>hideOnly</code> is <code>false</code>) that should be removed
- * together with the StateInvariant
- * @throws OperationForbiddenException
- * if the StateInvariant should not be removed
- */
- public static Collection<EObject> getElementsToRemove(final View view, final boolean hideOnly) throws OperationForbiddenException {
- final Set<EObject> elementsToRemove = new HashSet<EObject>();
- final boolean fullStateInvariant = view.getType().equals(Constants.fullStateInvariantId);
- final boolean compactStateInvariant = view.getType().equals(Constants.compactStateInvariantId);
-
- if(fullStateInvariant || compactStateInvariant) {
- // only remove Views under the same Interaction
- final View interactionView = ViewUtils.findSuperViewWithId(view, InteractionEditPartTN.VISUAL_ID);
-
- final StateInvariant stateInvariant = (StateInvariant)view.getElement();
- elementsToRemove.addAll(getRelatedElementsToRemove(stateInvariant, hideOnly, interactionView));
-
- final EObject eContainer = view.eContainer();
- if(eContainer instanceof Node) {
- final Node node = (Node)eContainer;
- @SuppressWarnings("unchecked")
- final EList<View> children = node.getChildren();
- int nStateInvariants = 0;
- for(final View childView : children) {
- if(childView.getType().equals(Constants.fullStateInvariantId) || childView.getType().equals(Constants.compactStateInvariantId)) {
- nStateInvariants++;
- }
- }
- if(nStateInvariants <= 1) {
- // don't allow deleting the only StateInvariant (since this renders the diagram unusable)
- throw new OperationForbiddenException();
- }
- if(fullStateInvariant) {
- elementsToRemove.addAll(getElementsToRemoveForFullStateInvariant(view, children, hideOnly, interactionView));
- } else if(compactStateInvariant) {
- elementsToRemove.addAll(getElementsToRemoveForCompactStateInvariant(view, children, hideOnly, interactionView));
- }
- }
- }
- return elementsToRemove;
- }
-
- public static Collection<? extends EObject> getRelatedElementsToRemove(final EObject stateInvariant, final boolean hideOnly, final View interactionView) {
- Assert.isLegal(stateInvariant instanceof StateInvariant);
- final Set<EObject> elementsToRemove = new HashSet<EObject>();
- elementsToRemove.addAll(TimeElementUtils.getTimeElementsToRemove(stateInvariant, hideOnly, interactionView));
- elementsToRemove.addAll(GeneralOrderingUtils.getReferencingGeneralOrderingsToRemove(stateInvariant, hideOnly, interactionView));
- return elementsToRemove;
- }
-
- private static Collection<EObject> getElementsToRemoveForFullStateInvariant(final View stateInvariantView, final EList<View> children, final boolean hideOnly, final View interactionView) {
- final Set<EObject> elementsToRemove = new HashSet<EObject>();
- final int childrenSize = children.size();
- final int index = children.indexOf(stateInvariantView);
- if(index == 0) {
- // first StateInvariant: remove the OccurrenceSpecification and VerticalLine AFTER it
- if(index + 1 < childrenSize) {
- final View following = children.get(index + 1);
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(following)) {
- addElementToRemove(following, hideOnly, interactionView, elementsToRemove);
- }
- }
- if(index + 2 < childrenSize) {
- final View following = children.get(index + 2);
- if(following.getType().equals(Constants.verticalLineId)) {
- elementsToRemove.add(following);
- }
- }
- } else {
- // other StateInvariant: remove the VerticalLine and OccurrenceSpecification BEFORE it
- if(index >= 1) {
- final View preceding = children.get(index - 1);
- if(preceding.getType().equals(Constants.verticalLineId)) {
- elementsToRemove.add(preceding);
- }
- // in the case of a creation Message
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
- addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
- }
- }
- if(index >= 2) {
- final View preceding = children.get(index - 2);
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
- addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
- }
- }
- }
- return elementsToRemove;
- }
-
- private static Collection<EObject> getElementsToRemoveForCompactStateInvariant(final View stateInvariantView, final EList<View> children, final boolean hideOnly, final View interactionView) {
- final Set<EObject> elementsToRemove = new HashSet<EObject>();
- final int index = children.indexOf(stateInvariantView);
- if(index == 0) {
- // first StateInvariant: remove the OccurrenceSpecification AFTER it
- // (and all the OccurrenceSpecifications on top of it)
- for(int i = index + 1; i < children.size(); i++) {
- final View view = children.get(i);
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view)) {
- addElementToRemove(view, hideOnly, interactionView, elementsToRemove);
- } else {
- break;
- }
- }
- } else {
- // other StateInvariant: remove the OccurrenceSpecification BEFORE it
- if(index >= 1) {
- final View preceding = children.get(index - 1);
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
- addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
- }
- }
- // and all the OccurrenceSpecifications on top of it (until a state change occurrence)
- for(int i = index + 1; i < children.size(); i++) {
- View following = null;
- if(i + 1 < children.size()) {
- following = children.get(i + 1);
- }
- final View view = children.get(i);
- // if this is not a state change occurrence then delete it
- if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view) && (following == null || !StateInvariantUtils.isStateInvariantView(following))) {
- addElementToRemove(view, hideOnly, interactionView, elementsToRemove);
- } else {
- break;
- }
-
- }
- }
- return elementsToRemove;
- }
-
- private static void addElementToRemove(final View viewToRemove, final boolean hideOnly, final View interactionView, final Set<EObject> elementsToRemove) {
- final EObject element = viewToRemove.getElement();
- elementsToRemove.add(viewToRemove);
- if(!hideOnly) {
- elementsToRemove.add(element);
- }
- if(element instanceof StateInvariant) {
- elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(element, hideOnly, interactionView));
- } else if(element instanceof OccurrenceSpecification) {
- elementsToRemove.addAll(OccurrenceSpecificationUtils.getRelatedElementsToRemove(element, hideOnly, interactionView));
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- public static boolean isStateInvariantView(final View view) {
- final int visualID = UMLVisualIDRegistry.getVisualID(view);
- return isStateInvariantEditPart(visualID);
- }
-
- public static boolean isStateInvariantEditPart(final int visualID) {
- return visualID == FullStateInvariantEditPartCN.VISUAL_ID || visualID == CompactStateInvariantEditPartCN.VISUAL_ID;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
deleted file mode 100644
index 1d96419a7cb..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-
-public final class TickUtils {
-
- private static final String OCCURRENCE_TO_TICK_ANNOTATION = "occurrenceToTick"; //$NON-NLS-1$
-
- private static final String TICK_TO_OCCURRENCE_ANNOTATION = "tickToOccurrence"; //$NON-NLS-1$
-
- private TickUtils() {
- // utility class
- }
-
- public static void associateTickNodeToOccurrenceNode(final Node tickNode, final Node occurrenceNode, final boolean overwrite) {
- // preconditions
- checkTickView(tickNode);
- checkOccurrenceSpecificationView(occurrenceNode);
- // associate tick to occurrence
- final EAnnotation tickEAnnotation = TickUtils.getOrCreateTickEAnnotation(tickNode);
- if(overwrite) {
- clearTickAssociation(tickNode, tickEAnnotation);
- }
- Assert.isLegal(tickEAnnotation.getReferences().isEmpty(), "A tick can only be associated to one occurrence"); //$NON-NLS-1$
- tickEAnnotation.getReferences().add(occurrenceNode);
- // associate occurrence to tick
- final EAnnotation occurrenceEAnnotation = TickUtils.getOrCreateOccurrenceEAnnotation(occurrenceNode);
- occurrenceEAnnotation.getReferences().add(tickNode);
- }
-
- /** Remove associations for this tick to any occurrences, and from associated occurrences to this tick. */
- private static void clearTickAssociation(final Node tickNode, final EAnnotation tickEAnnotation) {
- final EList<EObject> references = tickEAnnotation.getReferences();
- for(final EObject eObject : references) {
- final EAnnotation occurrenceAnnotation = ((EModelElement)eObject).getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
- if(occurrenceAnnotation != null) {
- occurrenceAnnotation.getReferences().remove(tickNode);
- }
- }
- tickEAnnotation.getReferences().clear();
- }
-
- public static Node getAssociatedOccurrenceView(final View tickView) {
- checkTickView(tickView);
- final EAnnotation eAnnotation = tickView.getEAnnotation(TICK_TO_OCCURRENCE_ANNOTATION);
- if(eAnnotation != null) {
- final EList<EObject> references = eAnnotation.getReferences();
- if(references.isEmpty()) {
- throw new IllegalStateException("A tick must be associated to one occurrence"); //$NON-NLS-1$
- }
- if(references.size() > 1) {
- throw new IllegalStateException("A tick can be associated to only one occurrence"); //$NON-NLS-1$
- }
- final EObject eObject = references.get(0);
- if(eObject instanceof Node) {
- final Node node = (Node)eObject;
- checkOccurrenceSpecificationView(node);
- return node;
- }
- throw new IllegalStateException("A tick must be associated to an occurrence View"); //$NON-NLS-1$
- }
- return null;
- }
-
- public static List<Node> getAssociatedTickViews(final View occurrenceView) {
- final List<Node> result = new ArrayList<Node>();
- checkOccurrenceSpecificationView(occurrenceView);
- final EAnnotation eAnnotation = occurrenceView.getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
- if(eAnnotation != null) {
- final EList<EObject> references = eAnnotation.getReferences();
- for(final EObject eObject : references) {
- if(eObject instanceof Node) {
- final Node node = (Node)eObject;
- checkTickView(node);
- result.add(node);
- } else {
- throw new IllegalStateException("Expecting only tick Nodes"); //$NON-NLS-1$
- }
- }
- }
- return result;
- }
-
- public static IGraphicalEditPart findOccurrenceSpecificationEditPartFromTickEditPart(final TickEditPart tickEditPart, final EditPartViewer viewer) {
- if(tickEditPart != null) {
- final Node tickNode = (Node)tickEditPart.getModel();
- final Node occurrenceView = TickUtils.getAssociatedOccurrenceView(tickNode);
- if(occurrenceView != null) {
- final IGraphicalEditPart occurrenceSpecificationEditPart = (IGraphicalEditPart)viewer.getEditPartRegistry().get(occurrenceView);
- if(occurrenceSpecificationEditPart != null) {
- return occurrenceSpecificationEditPart;
- }
- }
- }
- return null;
- }
-
- public static boolean containsTickFor(final View parentView, final OccurrenceSpecification occurrenceSpecification) {
- @SuppressWarnings("unchecked")
- final EList<View> children = parentView.getChildren();
- for(final View child : children) {
- checkTickView(child);
- final Node occurrenceView = TickUtils.getAssociatedOccurrenceView(child);
- if(occurrenceView != null) {
- final EObject element = occurrenceView.getElement();
- if(element == occurrenceSpecification) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static EAnnotation getOrCreateTickEAnnotation(final View tickView) {
- checkTickView(tickView);
- EAnnotation eAnnotation = tickView.getEAnnotation(TICK_TO_OCCURRENCE_ANNOTATION);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(TICK_TO_OCCURRENCE_ANNOTATION);
- tickView.getEAnnotations().add(eAnnotation);
- }
- return eAnnotation;
- }
-
- private static EAnnotation getOrCreateOccurrenceEAnnotation(final View occurrenceView) {
- checkOccurrenceSpecificationView(occurrenceView);
- EAnnotation eAnnotation = occurrenceView.getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
- if(eAnnotation == null) {
- eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- eAnnotation.setSource(OCCURRENCE_TO_TICK_ANNOTATION);
- occurrenceView.getEAnnotations().add(eAnnotation);
- }
- return eAnnotation;
- }
-
- private static void checkTickView(final View tickView) {
- if(!Integer.toString(TickEditPart.VISUAL_ID).equals(tickView.getType())) {
- throw new IllegalArgumentException("The parameter must be a tick View (id = " + TickEditPart.VISUAL_ID + "). The id was " + tickView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private static void checkOccurrenceSpecificationView(final View occurrenceSpecificationView) {
- if(!Integer.toString(OccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType()) && !Integer.toString(MessageOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType()) && !Integer.toString(DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())) {
- throw new IllegalArgumentException("The parameter must be an Occurrencespecification View. The id was " + occurrenceSpecificationView.getType()); //$NON-NLS-1$
- }
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
deleted file mode 100644
index ccb77ddc9bb..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public final class TimeElementUtils {
-
- private TimeElementUtils() {
- // utility class
- }
-
- public static boolean isTimeElementEditPart(final int visualID) {
- return visualID == TimeObservationEditPart.VISUAL_ID || visualID == TimeConstraintEditPart.VISUAL_ID || visualID == DurationObservationEditPartCN.VISUAL_ID || visualID == DurationConstraintEditPartCN.VISUAL_ID;
- }
-
- public static boolean isTimeElementEditPart(final EditPart editPart) {
- return editPart instanceof TimeObservationEditPart || editPart instanceof TimeConstraintEditPart || editPart instanceof DurationObservationEditPartCN || editPart instanceof DurationConstraintEditPartCN;
- }
-
- /**
- * Find time elements ({@link TimeObservation}s, {@link DurationObservation}s, {@link TimeConstraint}s and {@link DurationConstraint}s) linked to
- * the given element.
- *
- * @param element
- * the {@link OccurrenceSpecification} or {@link StateInvariant} for which related time elements must be
- * found
- * @param hideOnly
- * whether to only return Views
- * @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
- * @return the list of linked time elements to remove
- */
- public static Set<EObject> getTimeElementsToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
- final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getDurationObservation_Event(), UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
- final Class<?>[] expectedClasses = new Class<?>[]{ TimeObservation.class, DurationObservation.class, TimeConstraint.class, DurationConstraint.class };
- return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
deleted file mode 100644
index 6612755c2ec..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-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.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.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimeRulerCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
-
-public final class TimeRulerUtils {
-
- private TimeRulerUtils() {
- // utility class
- }
-
- /**
- * @param createViewCommand
- *
- * @param editPart
- * @param visible
- * @return
- */
- /**
- * @param createViewCommand
- * the command that creates a Lifeline or Interaction View
- * @param editingDomain
- * an editing domain
- * @param visible
- * whether the time ruler should be visible initially
- * @return the time ruler creation command
- */
- public static ICommand getCreateFreeTimeRulerCommand(final Command createViewCommand, final TransactionalEditingDomain editingDomain, final boolean visible) {
- final CommandResult superCommandResult = ((ICommandProxy)createViewCommand).getICommand().getCommandResult();
- // final Interaction interaction = (Interaction) superCommandResult.getElement();
- if(editingDomain == null) {
- throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
- }
-
- final AbstractTransactionalCommand createFreeTimeRulerCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- // the result from the super command that creates the view
- final ViewDescriptor viewDescriptor = (ViewDescriptor)superCommandResult.getReturnValue();
- final View view = (View)viewDescriptor.getAdapter(View.class);
- final Node freeTimeRulerNode = createFreeTimeRuler(view);
- final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(view);
- timeRulerCompartmentView.setVisible(visible);
- return CommandResult.newOKCommandResult(freeTimeRulerNode);
- }
- };
- return createFreeTimeRulerCommand;
- }
-
- public static Node createFreeTimeRuler(final View view) {
- final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(view);
- final UMLViewProvider umlViewProvider = new UMLViewProvider();
- return umlViewProvider.createNode_24(null, timeRulerCompartmentView, 0, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- }
-
- /**
- * Find and return the FreeTimeRulerCompartmentEditPart in the Lifeline or Interaction that contains the given
- * editPart. If the containing Lifeline has a time ruler, then return it. Otherwise, return the containing
- * Interaction's time ruler.
- */
- public static IGraphicalEditPart findClosestTimeRuler(final IGraphicalEditPart editPart) {
- IGraphicalEditPart lifelineEditPart = (IGraphicalEditPart)EditPartUtils.findParentEditPartWithId(editPart, CompactLifelineEditPartCN.VISUAL_ID);
- if(lifelineEditPart == null) {
- lifelineEditPart = (IGraphicalEditPart)EditPartUtils.findParentEditPartWithId(editPart, FullLifelineEditPartCN.VISUAL_ID);
- }
- if(lifelineEditPart != null) {
- IGraphicalEditPart tickContainerEditPart = (IGraphicalEditPart)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
- if(tickContainerEditPart == null) {
- // then tickContainer is in the Interaction
- final IGraphicalEditPart interactionEditPart = (IGraphicalEditPart)EditPartUtils.findParentEditPartWithId(lifelineEditPart, InteractionEditPartTN.VISUAL_ID);
- if(interactionEditPart != null) {
- final IGraphicalEditPart interactionTimeRulerCompartmentEditPart = (IGraphicalEditPart)EditPartUtils.findFirstChildEditPartWithId(interactionEditPart, TimeRulerCompartmentEditPartCN.VISUAL_ID);
- if(interactionTimeRulerCompartmentEditPart != null) {
- tickContainerEditPart = (IGraphicalEditPart)EditPartUtils.findFirstChildEditPartWithId(interactionTimeRulerCompartmentEditPart, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
- }
- }
- }
- return tickContainerEditPart;
- }
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
deleted file mode 100644
index 28444dd7fa2..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-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.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.swt.widgets.Display;
-
-public final class Utils {
-
- private Utils() {
- // utility class
- }
-
- public static boolean safeEquals(final Object a, final Object b) {
- if(a == null) {
- return b == null;
- }
- return a.equals(b);
- }
-
- /**
- * Find elements linked to the given element (only Views if viewsOnly=true, otherwise both Views and semantic
- * elements are returned)
- *
- * @param element
- * the element for which related elements must be found
- * @param references
- * the references through which the referencing elements must be found
- * @param viewsOnly
- * whether to only return Views (otherwise both Views and semantic elements are returned).
- * @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
- * @param expectedClasses
- * the classes of referencing elements to remove
- * @return the list of linked elements to remove
- */
- public static Set<EObject> getReferencingElementsToRemove(final EObject element, final EReference[] references, final boolean viewsOnly, final View expectedParentView, final Class<?>[] expectedClasses) {
- final Set<EObject> referencingElements = new HashSet<EObject>();
- final Collection<?> referencers = EMFCoreUtil.getReferencers(element, references);
- for(final Object object : referencers) {
- if(object instanceof EObject && isExpectedClass(object, expectedClasses)) {
- final EObject eObject = (EObject)object;
- if(!viewsOnly) {
- referencingElements.add(eObject);
- }
- final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(eObject, TimingDiagramEditPart.MODEL_ID);
- for(final View view : crossReferencingViews) {
- if(expectedParentView == null || ViewUtils.isContained(view, expectedParentView)) {
- referencingElements.add(view);
- }
- }
- }
- }
- return referencingElements;
- }
-
- private static boolean isExpectedClass(final Object object, final Class<?>[] expectedClasses) {
- for(final Class<?> expectedClass : expectedClasses) {
- if(expectedClass.isInstance(object)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Executes the given command in an "unprotected" transaction, without recording it on the undo/redo stack. The
- * command is scheduled to be executed later, in order to be run outside any currently running transaction.
- *
- * @param command
- * the command to execute
- * @param domain
- * the editing domain
- */
- public static void executeLaterUnprotected(final Command command, final TransactionalEditingDomain domain) {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- try {
- final Map<String, Boolean> options = Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- final AbstractEMFOperation operation = new AbstractEMFOperation(domain, StringStatics.BLANK, options) {
-
- @Override
- protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- command.execute();
- return Status.OK_STATUS;
- }
- };
- operation.execute(new NullProgressMonitor(), null);
- } catch (final Exception e) {
- Activator.log.error(e);
- }
- }
- });
- }
-
- /**
- * Find model elements linked to the given element
- *
- * @param element
- * the element for which related elements must be found
- * @param references
- * the references through which the referencing elements must be found
- * @param expectedClasses
- * the classes of referencing elements to look for
- * @return the list of linked elements
- */
- public static Set<EObject> findReferencingElements(final EObject element, final EReference[] references, final Class<?>[] expectedClasses) {
- final Set<EObject> referencingElements = new HashSet<EObject>();
- final Collection<?> referencers = EMFCoreUtil.getReferencers(element, references);
- for(final Object object : referencers) {
- if(object instanceof EObject && isExpectedClass(object, expectedClasses)) {
- final EObject eObject = (EObject)object;
- referencingElements.add(eObject);
- }
- }
- return referencingElements;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
deleted file mode 100644
index 2c876920d14..00000000000
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-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.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-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.util.ViewUtil;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
-import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineTimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.swt.widgets.Display;
-
-public class ViewUtils {
-
- public static View findFullLifelineCompartmentView(final View lifelineView) {
- final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- if(timelineCompartmentViews.size() < 1) {
- throw new IllegalStateException("No timeline compartment found in the lifeline View"); //$NON-NLS-1$
- }
- return timelineCompartmentViews.get(0);
- }
-
- public static View findCompactTimelineCompartmentView(final View lifelineView) {
- final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- if(timelineCompartmentViews.size() < 1) {
- throw new IllegalStateException("No timeline compartment found in the lifeline View"); //$NON-NLS-1$
- }
- return timelineCompartmentViews.get(0);
- }
-
- public static View findChildTimelineCompartmentView(final View view) {
- List<View> timelineCompartmentViews = findSubViewsWithId(view, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- if(!timelineCompartmentViews.isEmpty()) {
- return timelineCompartmentViews.get(0);
- }
- timelineCompartmentViews = findSubViewsWithId(view, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- if(!timelineCompartmentViews.isEmpty()) {
- return timelineCompartmentViews.get(0);
- }
- throw new IllegalStateException("No timeline compartment found in the given View"); //$NON-NLS-1$
- }
-
- public static View findTimeRulerCompartmentView(final View view) {
- List<View> timeRulerCompartmentViews = findSubViewsWithId(view, TimeRulerCompartmentEditPartCN.VISUAL_ID);
- if(!timeRulerCompartmentViews.isEmpty()) {
- return timeRulerCompartmentViews.get(0);
- }
- timeRulerCompartmentViews = findSubViewsWithId(view, FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID);
- if(!timeRulerCompartmentViews.isEmpty()) {
- return timeRulerCompartmentViews.get(0);
- }
- timeRulerCompartmentViews = findSubViewsWithId(view, CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID);
- if(!timeRulerCompartmentViews.isEmpty()) {
- return timeRulerCompartmentViews.get(0);
- }
- throw new IllegalStateException("No timeruler compartment found in the View"); //$NON-NLS-1$
- }
-
- public static View findInteractionCompartmentView(final View interactionView) {
- final List<View> timelineCompartmentViews = findSubViewsWithId(interactionView, InteractionCompartmentEditPartTN.VISUAL_ID);
- if(timelineCompartmentViews.isEmpty()) {
- throw new IllegalStateException("No interaction compartment found in the interaction View"); //$NON-NLS-1$
- }
- return timelineCompartmentViews.get(0);
- }
-
- public static View findStateDefinitionCompartmentView(final View lifelineView) {
- final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID);
- if(timelineCompartmentViews.isEmpty()) {
- throw new IllegalStateException("No state definition compartment found in the lifeline View"); //$NON-NLS-1$
- }
- return timelineCompartmentViews.get(0);
- }
-
- public static View findFirstChildViewWithId(final View view, final int visualId) {
- final List<View> result = findSubViewsWithId(view, visualId);
- if(result.isEmpty()) {
- return null;
- }
- return result.get(0);
- }
-
- public static List<View> findSubViewsWithId(final View view, final int visualId) {
- final List<View> views = new ArrayList<View>();
- internalFindSubViewsWithId(view, visualId, views);
- return views;
- }
-
- private static List<View> internalFindSubViewsWithId(final View view, final int visualId, final List<View> result) {
- // the javadoc says it's a list of Views
- @SuppressWarnings("unchecked")
- final EList<View> children = view.getChildren();
- for(final View child : children) {
- if(UMLVisualIDRegistry.getVisualID(child) == visualId) {
- result.add(child);
- }
- internalFindSubViewsWithId(child, visualId, result);
- }
- return null;
- }
-
- public static View findSuperViewWithId(final View view, final int visualId) {
- EObject parent = view;
- while(parent != null) {
- if(parent instanceof View) {
- final View parentView = (View)parent;
- if(UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
- return parentView;
- }
- }
- parent = parent.eContainer();
- }
- return null;
- }
-
- public static String getContainingDiagramType(final View view) {
- if(view instanceof Diagram) {
- final Diagram diagram = (Diagram)view;
- return diagram.getType();
- }
- final EObject eContainer = view.eContainer();
- if(eContainer instanceof View) {
- final View parentView = (View)eContainer;
- return getContainingDiagramType(parentView);
- }
- return null;
- }
-
- public static ICommand getMoveViewCommand(final View parentView, final View viewToMove, final int targetIndex) {
- final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(parentView);
- return new AbstractTransactionalCommand(editingDomain, Messages.ViewUtils_MoveView, null, null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- int newIndex = targetIndex;
- final EList<?> children = parentView.getChildren();
- final int size = children.size();
- final int index = children.indexOf(viewToMove);
- if(index < targetIndex) {
- // account for the removed child
- newIndex--;
- }
- if(newIndex < 0) {
- newIndex = 0;
- }
- if(newIndex > size - 1) {
- newIndex = size - 1;
- }
- ViewUtil.repositionChildAt(parentView, viewToMove, newIndex);
- return CommandResult.newOKCommandResult();
- }
- };
- }
-
- public static boolean isContained(final View child, final View parent) {
- View view = child;
- while(view != null) {
- if(view == parent) {
- return true;
- }
- final EObject eContainer = view.eContainer();
- if(eContainer instanceof View) {
- view = (View)eContainer;
- } else {
- break;
- }
- }
- return false;
- }
-
- public static boolean isViewFor(final View view, final EClass... eClasses) {
- final EObject element = view.getElement();
- for(final EClass eClass : eClasses) {
- if(eClass.isInstance(element)) {
- return true;
- }
- }
- return false;
- }
-
- /** Returns whether the given View contains a child View for the given {@link EObject} */
- public static boolean containsViewFor(final View parentView, final EObject eObject) {
- if(parentView.getElement() == eObject) {
- return true;
- }
- @SuppressWarnings("unchecked")
- final EList<View> children = parentView.getChildren();
- for(final View child : children) {
- if(containsViewFor(child, eObject)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns whether the diagram that contains the given referenceView contains a {@link Connector} for the given
- * EObject.
- */
- public static boolean containsConnectorFor(final View referenceView, final EObject eObject) {
- final View parentDiagramView1 = ViewUtils.findSuperViewWithId(referenceView, TimingDiagramEditPart.VISUAL_ID);
- final Set<View> existingViews = CrossReferencerUtil.getCrossReferencingViews(eObject, TimingDiagramEditPart.MODEL_ID);
- for(final View existingView : existingViews) {
- if(existingView instanceof Connector) {
- final View parentDiagramView2 = ViewUtils.findSuperViewWithId(existingView, TimingDiagramEditPart.VISUAL_ID);
- if(parentDiagramView1 == parentDiagramView2) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static void selectInViewer(final View view, final EditPartViewer viewer) {
- final EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(view);
- if(editPart != null) {
- viewer.setSelection(new StructuredSelection(editPart));
- }
- }
-
- public static void performEditRequest(final View view, final EditPartViewer viewer) {
- final EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(view);
- if(editPart != null) {
- // viewer.setSelection(new StructuredSelection(editPart));
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- if(editPart.isActive()) {
- editPart.performRequest(new Request(RequestConstants.REQ_DIRECT_EDIT));
- EditPartUtils.revealEditPart(editPart);
- }
- }
- });
- }
- }
-}

Back to the top