Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrschnekenbu2013-01-03 16:09:41 +0000
committerrschnekenbu2013-01-03 16:09:41 +0000
commit51ebc89744f7c74fa97302874f3c03cfcb835118 (patch)
tree4a8531f7498712957c0c326e12b73c11db47d874 /incoming
parentf23987d80eddfc83bdc4b58c5a425f64eb88008f (diff)
downloadorg.eclipse.papyrus-51ebc89744f7c74fa97302874f3c03cfcb835118.tar.gz
org.eclipse.papyrus-51ebc89744f7c74fa97302874f3c03cfcb835118.tar.xz
org.eclipse.papyrus-51ebc89744f7c74fa97302874f3c03cfcb835118.zip
Share project "org.eclipse.papyrus.uml.diagram.timing" into "svn+ssh://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyrus"
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.classpath8
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.gitignore1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.options7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.project28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/net.sf.jautodoc.prefs9
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.core.prefs375
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.ui.prefs109
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/FIXME.txt8
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF76
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/README.txt18
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/TODO.txt9
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/about.html28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/build.properties22
-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.java109
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java22
-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.java50
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java120
-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.java132
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java122
-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.java134
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCompactLifelineCommand.java164
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java50
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForDo.java36
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java31
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java591
-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.java55
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java259
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java133
-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.java82
-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.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java42
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java42
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java152
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java72
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java136
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java129
-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.java344
-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.java42
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java37
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java42
-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.java150
-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.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java30
-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.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java44
-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.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java136
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java493
-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.java232
-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.java54
-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.java108
-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.java53
-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.java50
-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.java94
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java94
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java50
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java70
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java59
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java348
-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.java79
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java115
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java223
-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.java36
-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.java373
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java93
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java92
-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.java70
-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.java129
-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.java139
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java77
-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.java40
-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.java39
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java51
-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.java22
-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.java165
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java47
-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.java39
-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.java223
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java100
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java88
-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.java247
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java309
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java65
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java58
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java46
-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.java73
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java80
-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/providers/StereotypePropertiesEditPartProvider.java94
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java33
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java380
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java137
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java129
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java149
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java46
-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.java268
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java339
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java249
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java448
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java77
-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.java444
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java173
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java63
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java113
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java146
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java270
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/Diagram_Timing.gifbin0 -> 91 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/UMLDiagramFile.gifbin0 -> 339 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.pngbin0 -> 188 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.pngbin0 -> 389 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.pngbin0 -> 451 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/tick.pngbin0 -> 171 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/icons/wizban/NewUMLWizard.gifbin0 -> 2466 bytes
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/messages.properties116
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen2164
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.properties71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.xml1516
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java126
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java166
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java166
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java166
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java160
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java160
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java126
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java166
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java166
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactLifelineEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactStateInvariantEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DestructionOccurrenceSpecificationEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationConstraintEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationObservationEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullLifelineEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullStateInvariantEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GateEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GeneralOrderingEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/InteractionEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/LifelineEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageAsyncEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageCreateEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageDeleteEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageFoundEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageLostEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageOccurrenceSpecificationEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageReplyEditHelper.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageSyncEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/OccurrenceSpecificationEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/PackageEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeConstraintEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeObservationEditHelper.java17
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/UMLBaseEditHelper.java20
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java135
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java459
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java808
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.java136
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java450
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java805
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java791
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java542
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java794
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java357
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java794
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java357
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java793
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java128
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java313
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java477
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java807
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java141
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.java136
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java135
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java790
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java389
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java246
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java536
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java791
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java357
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java793
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java143
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java484
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java804
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java326
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java125
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java313
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java766
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java766
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java766
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java766
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java791
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java569
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java794
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java766
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java123
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java765
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java790
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java395
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java793
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java327
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java804
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java790
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java290
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java791
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java790
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java367
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java793
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java790
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java367
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java793
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.java136
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java119
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java333
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java120
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java247
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java120
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java247
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java189
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java247
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java156
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java100
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java489
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java241
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java224
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java194
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java68
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java223
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java119
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java105
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java182
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java335
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.java109
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java97
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java178
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java112
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java38
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java429
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java203
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DeleteElementAction.java3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.java61
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/Messages.java529
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java151
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java170
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java95
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java60
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java436
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java536
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java331
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java374
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java88
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java1676
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java1020
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java96
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.java35
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.java44
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java181
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java27
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java381
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.java32
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java900
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java268
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java127
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactStateInvariantPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DestructionOccurrenceSpecificationPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramAppearancePreferencePage.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramConnectionsPreferencePage.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramGeneralPreferencePage.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPreferenceInitializer.java91
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPrintingPreferencePage.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramRulersAndGridPreferencePage.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationConstraintPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationObservationPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.java126
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java128
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullStateInvariantPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GatePreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GeneralOrderingPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java127
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LifelinePreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.java126
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageAsyncPreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageCreatePreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageDeletePreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageFoundPreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageLostPreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageOccurrenceSpecificationPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageReplyPreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageSyncPreferencePage.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/OccurrenceSpecificationPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/StateDefinitionPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TickPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeConstraintPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeObservationPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/VerticalLineStateInvariantPreferencePage.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.java34
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java153
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java463
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java41
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java92
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java469
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java800
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java71
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.java75
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java1453
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.java122
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java88
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/timing_diagram_theme.css31
438 files changed, 86186 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.classpath b/incoming/org.eclipse.papyrus.uml.diagram.timing/.classpath
new file mode 100644
index 00000000000..744fb582747
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="custom-src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.gitignore b/incoming/org.eclipse.papyrus.uml.diagram.timing/.gitignore
new file mode 100644
index 00000000000..e660fd93d31
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.gitignore
@@ -0,0 +1 @@
+bin/
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.options b/incoming/org.eclipse.papyrus.uml.diagram.timing/.options
new file mode 100644
index 00000000000..4ff17c4606e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.options
@@ -0,0 +1,7 @@
+# Tracing options for the org.eclipse.papyrus.uml.diagram.timing plug-in
+
+# Common issues
+org.eclipse.papyrus.uml.diagram.timing/debug=false
+
+# Visual IDs
+org.eclipse.papyrus.uml.diagram.timing/debug/visualID=false
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.project b/incoming/org.eclipse.papyrus.uml.diagram.timing/.project
new file mode 100644
index 00000000000..4306e573035
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.diagram.timing</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/net.sf.jautodoc.prefs b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/net.sf.jautodoc.prefs
new file mode 100644
index 00000000000..65bd3258203
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/net.sf.jautodoc.prefs
@@ -0,0 +1,9 @@
+add_header=true
+add_todo=false
+create_dummy_doc=false
+eclipse.preferences.version=1
+header_text=/*****************************************************************************\r\n * Copyright (c) 2012 CEA LIST.\r\n *\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n *****************************************************************************/
+project_specific_settings=true
+replace_header=true
+replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
+single_line_comment=false
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.core.resources.prefs b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..8afa69c6c6e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties=ISO-8859-1
+encoding/<project>=UTF-8
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.core.prefs b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..3cb834beee5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,375 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=160
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=true
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.ui.prefs b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..db93a959d67
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,109 @@
+cleanup.add_default_serial_version_id=false
+cleanup.add_generated_serial_version_id=true
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=false
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=true
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=false
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=false
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Timing profile 'Cleanup'
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Formatter
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=true
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/FIXME.txt b/incoming/org.eclipse.papyrus.uml.diagram.timing/FIXME.txt
new file mode 100644
index 00000000000..e10702e0ef5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/FIXME.txt
@@ -0,0 +1,8 @@
+- after renaming a message, we need to undo twice to undo the renaming (there are two "Message Update" commands to undo)
+ => Bug 395439 - XText MessagePopupEditor creates two identical commands
+- Bug 395485 - XText validation error when clicking while XText editor is opening
+- Bug 395490 - SelectByTypeHandler fails when Views with no semantic element are present
+- Bug 395800 - NPE in UnloadHandler with notational-only Views
+- when resizing an interaction or adding a lifeline or more state definitions, existing lifelines get smaller and some of their contents (time elements, general orderings and labels) may get hidden
+ => automatically move contents back inside the Lifelines?
+ or automatically enlarge the Interaction to make all contents fit?
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..a180809b99e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF
@@ -0,0 +1,76 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.timing; singleton:=true
+Bundle-Vendor: %providerName
+Bundle-Version: 0.10.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin
+Bundle-ActivationPolicy: lazy
+Require-Bundle: org.eclipse.emf.ecore,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.expressions,
+ org.eclipse.jface,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.uml.diagram.common,
+ org.eclipse.papyrus.infra.gmfdiag.common,
+ org.eclipse.papyrus.uml.service.types,
+ org.eclipse.papyrus.infra.widgets,
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
+ org.eclipse.uml2.uml;visibility:=reexport,
+ org.eclipse.uml2.uml.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.ocl.ecore;visibility:=reexport,
+ org.eclipse.emf.validation;visibility:=reexport,
+ org.eclipse.gef,
+ org.eclipse.papyrus.infra.gmfdiag.preferences,
+ org.eclipse.papyrus.extensionpoints.editors,
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
+ org.eclipse.draw2d;visibility:=reexport,
+ org.eclipse.papyrus.infra.services.edit,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.0"
+Export-Package: org.eclipse.papyrus.uml.diagram.timing.custom;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.figures;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.layouts;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.parsers;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.parts;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.providers;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.custom.utils;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.edit.commands;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.edit.helpers;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.edit.parts;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.edit.policies;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.navigator;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.parsers;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.part;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.preferences;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.providers;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests,
+ org.eclipse.papyrus.uml.diagram.timing.sheet;x-friends:=org.eclipse.papyrus.uml.diagram.timing.tests
+Eclipse-LazyStart: true
+Bundle-Localization: plugin
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/README.txt b/incoming/org.eclipse.papyrus.uml.diagram.timing/README.txt
new file mode 100644
index 00000000000..75b6e030ea2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/README.txt
@@ -0,0 +1,18 @@
+How to regenerate:
+- launch a runtime instance of Eclipse
+- open timingdiagram.gmfgen
+- right-click the root element (the ResourceSet), and choose "Generate Papyrus Diagram"
+- select the "src" folder, and do a regex replace of:
+ @generated\R \*/\R(public (?:abstract )?class)
+ to:
+ @generated\R */\R@SuppressWarnings("all")\R// disable warnings on generated code\R\1
+- select the "org.eclipse.papyrus.uml.diagram.timing" project in the development Eclipse, and do "Source > Clean Up..." in the main menu (with Eclipse >= 4.3M4 or patch from Bug 394296 applied)
+- with EGit, select the project and do "Team > Add to Index" so that the files don't appear as new
+
+
+pay attention to these modifications in generated code:
+- UMLEditPartFactory#getTextCellEditorLocator : modified in the super class instead of overridden because it is static
+- CustomPaletteFactory in plugin.xml
+
+to reset the generated src folder from git:
+git checkout HEAD -- src && git clean -f src \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/TODO.txt b/incoming/org.eclipse.papyrus.uml.diagram.timing/TODO.txt
new file mode 100644
index 00000000000..f77ea85d8b9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/TODO.txt
@@ -0,0 +1,9 @@
+- make the location of time elements relative to the center line of a compact timeline (instead of the top left corner)
+ so that they stay put when the lifeline height changes
+- reconnect a DurationObservation or DurationConstraint to the new StateInvariant when a StateInvariant is cut in two (inserting an occurrence)
+- more unit tests (see /org.eclipse.papyrus.uml.diagram.timing.tests/TODO.txt)
+
+
+dropped features:
+- zooming on Lifelines
+- message labels : will be handled generically on all links in Papyrus sometime in the future
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/about.html b/incoming/org.eclipse.papyrus.uml.diagram.timing/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/build.properties b/incoming/org.eclipse.papyrus.uml.diagram.timing/build.properties
new file mode 100644
index 00000000000..d25a8c073a5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# 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
+###############################################################################
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ messages.properties,\
+ plugin.properties,\
+ .options,\
+ about.html
+jars.compile.order = .
+source.. = src/,\
+ custom-src/
+output.. = bin/
+src.includes = about.html
+
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
new file mode 100644
index 00000000000..10bc699759d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramCommand.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..8855b26a55b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java
@@ -0,0 +1,21 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..fc2ae319a2a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..b434f971936
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java
@@ -0,0 +1,109 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..40c36fd4a13
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..9e7341ad8b7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/SwitchLifelineAction.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..ccb59f22bb9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..4631d65f045
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramEditorFactory.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..d70fee9babf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/UmlTimingDiagramForMultiEditor.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..0279a88cf7e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..0ed79e8ef46
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractRefreshCommand.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * 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.draw2d.IFigure;
+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;
+
+/**
+ * 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() {
+ if (this.editPartToRefresh.isActive()) {
+ DiagramHelper.refresh(this.editPartToRefresh, true);
+ // this is needed in order to update the bounds of the Figures from their layout manager constraints
+ this.editPartToRefresh.getFigure().invalidateTree();
+ } else if (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(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
new file mode 100644
index 00000000000..2db0f492767
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..5c3ca61760d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromCompactToFull.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..e01c4e87be2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ChangeLifelineFromFullToCompact.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..074020c0e99
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..cc0d371d2ba
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..71812171bd3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..5c34f5e06ac
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..af6a8cd7782
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..3bcb15cdac6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..c9a2785295e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..7940b48ed69
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..d9d17b01fa7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCommand.java
@@ -0,0 +1,134 @@
+/*****************************************************************************
+ * 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.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());
+
+ timelineCompartmentEditPart.refresh();
+ ViewUtils.selectInViewer(occurrenceSpecificationView, 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
new file mode 100644
index 00000000000..cfcebe0a3d1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CutAndInsertOccurrenceSpecificationCompactLifelineCommand.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * 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.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);
+
+ timelineCompartmentEditPart.refresh();
+ ViewUtils.selectInViewer(occurrenceSpecificationView, 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
new file mode 100644
index 00000000000..1753111e906
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..fb0a9ae2b59
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForDo.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * 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.draw2d.IFigure;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.CompoundCommand;
+
+/**
+ * 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
new file mode 100644
index 00000000000..2c2ac1bf28b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * 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.draw2d.IFigure;
+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
new file mode 100644
index 00000000000..8ab9fcef2ee
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
@@ -0,0 +1,591 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..7f4897fa944
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..1200f2ce82d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..905b81b0061
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..6d831269f28
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..6ef12842d17
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..4ca303dd6be
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..9edb610edbe
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..64286448caa
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..314cd61c7ed
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..9f58d380209
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..e3cb178b516
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..a745b262e6a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..ad4dcb47152
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..63d04ecbc9c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java
@@ -0,0 +1,136 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..b278672e246
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java
@@ -0,0 +1,129 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..3fb45a6ec98
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..c89f1b8236f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java
@@ -0,0 +1,344 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..2a81902c086
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java
@@ -0,0 +1,131 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..d7715a6ce12
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..3fda430acb2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..def16e6a153
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..07ce203cb41
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java
@@ -0,0 +1,126 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..850f6da8645
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java
@@ -0,0 +1,150 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..1de626403bb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..04bb402ea0f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..06acf51507a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..9c3750bc5e7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..11881936a4d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..e6ca71b47ec
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..f0d33eb0b2d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java
@@ -0,0 +1,114 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..6b6905a82fb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..b04f6ac382c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..f5d9e9b3f6f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..a2a2ff2ad3a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.ExternalLabelPrimaryDragRoleEditPolicy;
+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
new file mode 100644
index 00000000000..2b761123e10
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..53a5cea8884
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..a64aab50a8a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java
@@ -0,0 +1,136 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..28d29ec4373
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java
@@ -0,0 +1,493 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..e56bfacf83b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..a25d7f0dad6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java
@@ -0,0 +1,232 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..b5fd8dca216
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..858b50f2ab9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..efe69587c29
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+
+/** 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
new file mode 100644
index 00000000000..4b54d628712
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..9d1b9c91490
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..43788a09868
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..07e5e529f40
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..4a7372b3dde
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..ce3ca08f900
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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;
+import org.eclipse.uml2.uml.Gate;
+
+/** 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
new file mode 100644
index 00000000000..d4305cef77c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..481c9975fe2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..62ca97effcb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentLayoutEditPolicy.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..8814dc01c26
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..1f0fcd27e5f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.edit.parts.CustomFullLifelineEditPartCN;
+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
new file mode 100644
index 00000000000..21a01072f10
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..e9dc44db16d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+
+/** 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
new file mode 100644
index 00000000000..df94b4ecfad
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..1386d6bfc31
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java
@@ -0,0 +1,348 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..2e6bdd2aba2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..40673b4380e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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
new file mode 100644
index 00000000000..d540944d813
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000000..c30501b2acb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.