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.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
+
+/**
+ * Handles re-ordering Views inside their compartment through drag&drop. This policy is meant to be installed on a list
+ * compartment.
+ */
+// meant to be overridden
+@SuppressWarnings("static-method")
+public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLayoutEditPolicy {
+
+ private static final int LAYOUT_FEEDBACK_HEIGHT = 4;
+ private static final int MARGIN_BEFORE_FIRST = 4;
+ private static final int MARGIN_AFTER_LAST = 4;
+
+ protected IFigure layoutFeedbackFigure = null;
+
+ protected GraphicalEditPart getEditPartToRefresh() {
+ return (GraphicalEditPart) getHost();
+ }
+
+ protected int getLayoutFeedbackHeight() {
+ return LAYOUT_FEEDBACK_HEIGHT;
+ }
+
+ @Override
+ protected EditPolicy createChildEditPolicy(final EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ // add an edit policy so that children can be moved
+ result = new NonResizableEditPolicyEx();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ if (request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+
+ final InsertionPoint insertionPoint = computeClosestInsertionPoint(changeBoundsRequest.getLocation().y);
+ if (insertionPoint == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ final GraphicalEditPart hostEditPart = (GraphicalEditPart) getHost();
+ final View compartmentView = (View) hostEditPart.getModel();
+ @SuppressWarnings("unchecked")
+ final List<EditPart> editParts = changeBoundsRequest.getEditParts();
+ for (final EditPart editPart : editParts) {
+ if (editPart instanceof GraphicalEditPart) {
+ final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) editPart;
+ final View view = (View) graphicalEditPart.getModel();
+
+ final GraphicalEditPart editPartToRefresh = getEditPartToRefresh();
+ final CompoundCommand compoundCommand = new CompoundCommand();
+ compoundCommand.add(new RefreshCommandForUndo(editPartToRefresh));
+ compoundCommand.add(new ICommandProxy(ViewUtils.getMoveViewCommand(compartmentView, view, insertionPoint.getIndex())));
+ compoundCommand.add(new RefreshCommandForDo(editPartToRefresh));
+ return compoundCommand;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void showLayoutTargetFeedback(final Request request) {
+ if (request instanceof ChangeBoundsRequest) {
+ eraseLayoutTargetFeedback();
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+
+ final InsertionPoint insertionPoint = computeClosestInsertionPoint(changeBoundsRequest.getLocation().y);
+ if (insertionPoint == null) {
+ return;
+ }
+
+ final Rectangle containerBounds = new Rectangle(getHostFigure().getBounds());
+ getHostFigure().translateToAbsolute(containerBounds);
+ final int layoutFeedbackHeight = getLayoutFeedbackHeight();
+ final Rectangle feedbackBounds = new Rectangle(containerBounds.x, insertionPoint.getLocation() - layoutFeedbackHeight / 2, containerBounds.width,
+ layoutFeedbackHeight);
+
+ final Point origin = FigureUtils.getLayeredPaneOrigin(getHostFigure());
+ feedbackBounds.translate(origin);
+ final double scale = FigureUtils.getScale(getHostFigure());
+ feedbackBounds.width *= scale;
+ feedbackBounds.height *= scale;
+ this.layoutFeedbackFigure = createLayoutTargetFeedbackFigure(feedbackBounds);
+ }
+ }
+
+ protected class InsertionPoint {
+ int index;
+ int location;
+
+ public InsertionPoint(final int index, final int location) {
+ this.index = index;
+ this.location = location;
+ }
+
+ public int getIndex() {
+ return this.index;
+ }
+
+ public int getLocation() {
+ return this.location;
+ }
+ }
+
+ protected InsertionPoint computeClosestInsertionPoint(final int offset) {
+ @SuppressWarnings("unchecked")
+ final List<GraphicalEditPart> children = getHost().getChildren();
+ if (children.isEmpty()) {
+ return null;
+ }
+ final List<InsertionPoint> insertionPoints = computeInsertionPoints(children);
+
+ final TreeMap<Integer, InsertionPoint> distanceMap = new TreeMap<Integer, InsertionPoint>();
+ for (final InsertionPoint insertionPoint : insertionPoints) {
+ final int distance = Math.abs(offset - insertionPoint.getLocation());
+ distanceMap.put(Integer.valueOf(distance), insertionPoint);
+ }
+ final Entry<Integer, InsertionPoint> firstEntry = distanceMap.firstEntry();
+ return firstEntry.getValue();
+ }
+
+ protected int getMarginBeforeFirst() {
+ return MARGIN_BEFORE_FIRST;
+ }
+
+ protected int getMarginAfterLast() {
+ return MARGIN_AFTER_LAST;
+ }
+
+ protected List<InsertionPoint> computeInsertionPoints(final List<GraphicalEditPart> children) {
+ final int size = children.size();
+ final List<InsertionPoint> insertionPoints = new ArrayList<GenericListCompartmentLayoutEditPolicy.InsertionPoint>();
+ Rectangle previousBounds = null;
+ for (int i = 0; i < size; i++) {
+ final GraphicalEditPart childEditPart = children.get(i);
+ final Rectangle bounds = new Rectangle(childEditPart.getFigure().getBounds());
+ getHostFigure().translateToAbsolute(bounds);
+
+ if (previousBounds != null) {
+ // an insertion point between two figures
+ insertionPoints.add(new InsertionPoint(i, (previousBounds.y + previousBounds.height + bounds.y) / 2));
+ } else {
+ // an insertion point before the first figure
+ insertionPoints.add(new InsertionPoint(i, bounds.y - getMarginBeforeFirst()));
+ }
+ if (i == size - 1) {
+ // last insertion point: after the last figure
+ insertionPoints.add(new InsertionPoint(i + 1, bounds.y + bounds.height + getMarginAfterLast()));
+ }
+ previousBounds = bounds;
+ }
+ return insertionPoints;
+ }
+
+ protected IFigure createLayoutTargetFeedbackFigure(final Rectangle bounds) {
+ final RectangleFigure r = new RectangleFigure();
+ r.setForegroundColor(ColorConstants.darkBlue);
+ r.setBackgroundColor(ColorConstants.lightBlue);
+ r.setBounds(bounds);
+ r.validate();
+ addFeedback(r);
+ return r;
+ }
+
+ @Override
+ protected void eraseLayoutTargetFeedback(final Request request) {
+ eraseLayoutTargetFeedback();
+ }
+
+ protected void eraseLayoutTargetFeedback() {
+ if (this.layoutFeedbackFigure != null) {
+ removeFeedback(this.layoutFeedbackFigure);
+ this.layoutFeedbackFigure = null;
+ }
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
new file mode 100644
index 00000000000..c1b5d9228e7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+
+/**
+ * Returns {@link ExternalLabelPrimaryDragRoleEditPolicy} for the associated label in order to display a link between
+ * the label and associated edit part while dragging the label.
+ */
+public class LayoutEditPolicyForLabel extends LayoutEditPolicy {
+
+ private final int labelVisualId;
+
+ public LayoutEditPolicyForLabel(final int labelVisualId) {
+ this.labelVisualId = labelVisualId;
+ }
+
+ @Override
+ protected EditPolicy createChildEditPolicy(final EditPart child) {
+ final View childView = (View) child.getModel();
+ if (UMLVisualIDRegistry.getVisualID(childView) == this.labelVisualId) {
+ return new ExternalLabelPrimaryDragRoleEditPolicy();
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java
new file mode 100644
index 00000000000..260fd49b1a6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.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.policies;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
+
+public class SelectionOnlyLayoutEditPolicy extends LayoutEditPolicy {
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+
+ @Override
+ protected EditPolicy createChildEditPolicy(final EditPart child) {
+ final NonResizableEditPolicy nonResizableEditPolicy = new NonResizableEditPolicy();
+ nonResizableEditPolicy.setDragAllowed(false);
+ return nonResizableEditPolicy;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java
new file mode 100644
index 00000000000..7bc3a167fb8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.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.edit.policies;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
+
+/**
+ * This EditPolicy adds a notification listener on the time ruler View that listens for its visibility and updates the
+ * {@link LifelineFigure#setDisplayTimeRuler(boolean) LifelineFigure's time ruler visibility}
+ */
+public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy implements NotificationListener, IPapyrusListener {
+
+ public static final String ROLE = "TimeRulerVisibilityRefreshRole"; //$NON-NLS-1$
+
+ private View timeRulerCompartmentView;
+
+ public TimeRulerVisibilityRefreshEditPolicy() {
+ super();
+ }
+
+ @Override
+ public void activate() {
+
+ this.timeRulerCompartmentView = getListenedView();
+ if (this.timeRulerCompartmentView == null) {
+ return;
+ }
+ // adds a listener on the View
+ getDiagramEventBroker().addNotificationListener(this.timeRulerCompartmentView, this);
+ // initial refresh (so that the figure has the right visibility when the diagram is first opened)
+ refreshFigure();
+ }
+
+ @Override
+ public void deactivate() {
+ if (this.timeRulerCompartmentView == null) {
+ return;
+ }
+ // remove the listener from the View
+ getDiagramEventBroker().removeNotificationListener(this.timeRulerCompartmentView, this);
+ }
+
+ /**
+ * Gets the diagram event broker from the editing domain.
+ *
+ * @return the diagram event broker
+ */
+ protected DiagramEventBroker getDiagramEventBroker() {
+ final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ if (editingDomain != null) {
+ return DiagramEventBroker.getInstance(editingDomain);
+ }
+ return null;
+ }
+
+ protected View getListenedView() {
+ final View view = getView();
+ if (view != null) {
+ return ViewUtils.findTimeRulerCompartmentView(view);
+ }
+ return null;
+ }
+
+ protected View getView() {
+ return (View) getHost().getModel();
+ }
+
+ public void notifyChanged(final Notification notification) {
+ if (notification.getEventType() == Notification.SET) {
+ final Object feature = notification.getFeature();
+ if (feature == NotationPackage.eINSTANCE.getView_Visible()) {
+ refreshFigure();
+ }
+ }
+ }
+
+ /**
+ * Refreshes the "displayTimeRuler" attribute of the LifelineFigure so that it matches the visibility of the
+ * TimeRulerCompartment View.
+ */
+ public void refreshFigure() {
+ final boolean visible = getListenedView().isVisible();
+ final IFigure figure = ((IGraphicalEditPart) getHost()).getFigure();
+ final LifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(figure, LifelineFigure.class);
+ lifelineFigure.setDisplayTimeRuler(visible);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
new file mode 100644
index 00000000000..c8e9124ccba
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
@@ -0,0 +1,373 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.ValidateInteractionCommand;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomCompactLifelineCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.custom.helper.TimingDiagramLinkMappingHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.DropUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.InteractionUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Utils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Gate;
+import org.eclipse.uml2.uml.GeneralOrdering;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.TimeConstraint;
+import org.eclipse.uml2.uml.TimeObservation;
+
+public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPolicy {
+
+ /** Elements for which we want to specialize the drop */
+ @SuppressWarnings("boxing")
+ private static final Integer[] SPECIFIC_DROP_ELEMENT_IDS = { InteractionEditPartTN.VISUAL_ID, FullLifelineEditPartCN.VISUAL_ID,
+ CompactLifelineEditPartCN.VISUAL_ID, MessageSyncEditPart.VISUAL_ID, MessageAsyncEditPart.VISUAL_ID, MessageReplyEditPart.VISUAL_ID,
+ MessageCreateEditPart.VISUAL_ID, MessageDeleteEditPart.VISUAL_ID, MessageFoundEditPart.VISUAL_ID, MessageLostEditPart.VISUAL_ID,
+ TimeObservationEditPart.VISUAL_ID, TimeConstraintEditPart.VISUAL_ID, DurationObservationEditPartCN.VISUAL_ID,
+ DurationConstraintEditPartCN.VISUAL_ID, GeneralOrderingEditPart.VISUAL_ID, GateEditPart.VISUAL_ID };
+
+ public TimingDiagramDragDropEditPolicy() {
+ super(TimingDiagramLinkMappingHelper.getInstance());
+ }
+
+ /** override the drop command */
+ @Override
+ protected Command getSpecificDropCommand(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID, final int linkVISUALID) {
+ switch (nodeVISUALID) {
+ case InteractionEditPartTN.VISUAL_ID:
+ return new ICommandProxy(dropMainElement(dropRequest, semanticElement, nodeVISUALID));
+ case FullLifelineEditPartCN.VISUAL_ID:
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return new ICommandProxy(dropLifeline(dropRequest, semanticElement, nodeVISUALID));
+ default:
+ }
+
+ if (getHost().getModel() instanceof View) {
+ final View hostView = (View) getHost().getModel();
+ if (MessageUtils.isMessage(linkVISUALID)) {
+ if (semanticElement instanceof Message) {
+ return new ICommandProxy(DropUtils.getDropMessageCommand((Message) semanticElement, hostView, getViewer()));
+ }
+ }
+ if (nodeVISUALID == TimeObservationEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropTimeObservationCommand((TimeObservation) semanticElement, hostView, getViewer()));
+ }
+ if (nodeVISUALID == TimeConstraintEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropTimeConstraintCommand((TimeConstraint) semanticElement, hostView, getViewer()));
+ }
+ if (nodeVISUALID == DurationObservationEditPartCN.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropDurationObservationCommand((DurationObservation) semanticElement, hostView, getViewer()));
+ }
+ if (nodeVISUALID == DurationConstraintEditPartCN.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropDurationConstraintCommand((DurationConstraint) semanticElement, hostView, getViewer()));
+ }
+ if (nodeVISUALID == GeneralOrderingEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropGeneralOrderingCommand((GeneralOrdering) semanticElement, hostView, getViewer()));
+ }
+ if (nodeVISUALID == GateEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropGateCommand((Gate) semanticElement, hostView, getViewer()));
+ }
+ }
+
+ return super.getSpecificDropCommand(dropRequest, semanticElement, nodeVISUALID, linkVISUALID);
+
+ }
+
+ private ICommand dropLifeline(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID) {
+ if (!(semanticElement instanceof Lifeline)) {
+ throw new IllegalArgumentException();
+ }
+ final Lifeline lifeline = (Lifeline) semanticElement;
+
+ final CompositeCommand cc = new CompositeCommand(Messages.TimingDiagramDragDropEditPolicy_DropLifeline);
+ final ICommand dropMainElementCommand = dropMainElement(dropRequest, semanticElement, nodeVISUALID);
+ cc.add(dropMainElementCommand);
+ final LifelineType lifelineType = LifelineUtils.getLifelineType(lifeline);
+ if (lifelineType == LifelineType.full) {
+ cc.add(dropStateDefinitions(lifeline, dropMainElementCommand.getCommandResult()));
+ }
+ cc.add(dropLifelineFragments(lifeline, dropMainElementCommand.getCommandResult(), lifelineType));
+ return cc;
+ }
+
+ private static ICommand dropStateDefinitions(final Lifeline lifeline, final CommandResult lifelineCreateViewCommandResult) {
+ if (lifelineCreateViewCommandResult == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
+ final Object returnValue = lifelineCreateViewCommandResult.getReturnValue();
+ return new AbstractTransactionalCommand(editingDomain, Messages.TimingDiagramDragDropEditPolicy_DropStateDefinitions, null, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ if (returnValue instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable) returnValue;
+ final View lifelineView = (View) adaptable.getAdapter(View.class);
+ if (lifelineView == null) {
+ return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
+ }
+ final View stateDefinitionCompartmentView = ViewUtils.findStateDefinitionCompartmentView(lifelineView);
+ final List<String> stateDefinitionIds = StateDefinitionUtils.getStateDefinitionIds(lifeline);
+ for (final String stateDefinitionId : stateDefinitionIds) {
+ final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionId, lifeline);
+
+ // create the View for the state definition
+ final UMLViewProvider umlViewProvider = new UMLViewProvider();
+ final Node stateDefinitionView = umlViewProvider.createNode_9(null, stateDefinitionCompartmentView, -1, true,
+ PreferencesHint.USE_DEFAULTS);
+ // restore the same id
+ StateDefinitionUtils.setStateDefinitionViewID(stateDefinitionView, stateDefinitionId);
+ // set the name on the View
+ StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, stateDefinitionName);
+ }
+
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ private static ICommand dropLifelineFragments(final Lifeline lifeline, final CommandResult lifelineCreateViewCommandResult, final LifelineType lifelineType) {
+ if (lifelineCreateViewCommandResult == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
+ final Object returnValue = lifelineCreateViewCommandResult.getReturnValue();
+ return new AbstractTransactionalCommand(editingDomain, Messages.TimingDiagramDragDropEditPolicy_DropLifelineFragments, null, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ if (returnValue instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable) returnValue;
+ final View lifelineView = (View) adaptable.getAdapter(View.class);
+ if (lifelineView == null) {
+ return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
+ }
+
+ final View compartmentView = (lifelineType == LifelineType.full ? ViewUtils.findFullLifelineCompartmentView(lifelineView) : ViewUtils
+ .findCompactTimelineCompartmentView(lifelineView));
+
+ final EList<InteractionFragment> fragments = lifeline.getCoveredBys();
+ final UMLViewProvider umlViewProvider = new UMLViewProvider();
+ int x = lifelineType == LifelineType.full ? 20 : CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET;
+ boolean firstStateInvariant = true;
+ String previousStateInvariantName = ""; //$NON-NLS-1$
+ for (final InteractionFragment fragment : fragments) {
+ if (fragment instanceof StateInvariant) {
+ if (!firstStateInvariant && lifelineType == LifelineType.full) {
+ // add a vertical line
+ umlViewProvider.createNode_39(null, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ }
+ final StateInvariant stateInvariant = (StateInvariant) fragment;
+ final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
+
+ if (lifelineType == LifelineType.full) {
+ if (Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
+ x += 10;
+ } else {
+ x += 25;
+ }
+ } else {
+ x += 60;
+ }
+
+ // create the View for the state invariant
+ if (lifelineType == LifelineType.full) {
+ umlViewProvider.createStateInvariant_11(stateInvariant, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ } else if (lifelineType == LifelineType.compact) {
+ umlViewProvider.createStateInvariant_28(stateInvariant, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ }
+ firstStateInvariant = false;
+ previousStateInvariantName = stateInvariantName;
+ } else if (fragment instanceof DestructionOccurrenceSpecification) {
+ final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification) fragment;
+ // create the View for the occurrence specification
+ final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(
+ destructionOccurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+
+ final Location loc = NotationFactory.eINSTANCE.createLocation();
+ loc.setX(x);
+ loc.setY(0);
+ occurrenceSpecificationView.setLayoutConstraint(loc);
+ x += 10;
+ } else if (fragment instanceof MessageOccurrenceSpecification) {
+ final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification) fragment;
+ // create the View for the occurrence specification
+ final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification,
+ compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+
+ final Location loc = NotationFactory.eINSTANCE.createLocation();
+ loc.setX(x);
+ loc.setY(0);
+ occurrenceSpecificationView.setLayoutConstraint(loc);
+ x += 10;
+ } else if (fragment instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) fragment;
+ // create the View for the occurrence specification
+ final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification, compartmentView,
+ -1, true, PreferencesHint.USE_DEFAULTS);
+
+ final Location loc = NotationFactory.eINSTANCE.createLocation();
+ loc.setX(x);
+ loc.setY(0);
+ occurrenceSpecificationView.setLayoutConstraint(loc);
+ x += 10;
+ }
+
+ }
+ }
+
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ private ICommand dropMainElement(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID) {
+ if (canBeDropped(semanticElement)) {
+ final IHintedType type = ((IHintedType) getUMLElementType(nodeVISUALID));
+ String semanticHint = null;
+ if (type != null) {
+ semanticHint = type.getSemanticHint();
+ }
+ return getDefaultDropNodeCommand(getHost(), semanticHint, dropRequest.getLocation(), semanticElement, dropRequest);
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ private boolean canBeDropped(final Element semanticElement) {
+ final GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart) getHost();
+ final EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
+ return (graphicalParentObject instanceof org.eclipse.uml2.uml.Package && semanticElement instanceof Interaction)
+ || (graphicalParentObject instanceof Interaction && semanticElement instanceof Lifeline);
+ }
+
+ /** @return the set of element ids for which we want to specialize the drop */
+ @Override
+ protected Set<Integer> getDroppableElementVisualId() {
+ return new HashSet<Integer>(Arrays.asList(SPECIFIC_DROP_ELEMENT_IDS));
+ }
+
+ @Override
+ public IElementType getUMLElementType(final int elementID) {
+ return UMLElementTypes.getElementType(elementID);
+ }
+
+ @Override
+ public int getNodeVisualID(final View containerView, final EObject domainElement) {
+ if (domainElement instanceof Gate
+ && (String.valueOf(InteractionEditPartTN.VISUAL_ID).equals(containerView.getType()) || String.valueOf(
+ InteractionCompartmentEditPartTN.VISUAL_ID).equals(containerView.getType()))) {
+ // allow dropping a Gate directly on an Interaction or Interaction compartment
+ return GateEditPart.VISUAL_ID;
+ }
+ return UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ }
+
+ @Override
+ public int getLinkWithClassVisualID(final EObject domainElement) {
+ return UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement);
+ }
+
+ @Override
+ protected Command getDropCommand(final ChangeBoundsRequest request) {
+ return getDropObjectsCommand(castToDropObjectsRequest(request));
+ }
+
+ /** Overridden to add validation */
+ @Override
+ public Command getDropObjectsCommand(final DropObjectsRequest dropRequest) {
+
+ final CompoundCommand cc = new CompoundCommand(Messages.TimingDiagramDragDropEditPolicy_Drop);
+
+ final List<Interaction> updatedInteractionsCache = new ArrayList<Interaction>();
+ final List<?> droppedObjects = dropRequest.getObjects();
+
+ for (final Object droppedObject : droppedObjects) {
+ if (droppedObject instanceof EObject) {
+ final EObject droppedEObject = (EObject) droppedObject;
+ final Interaction interaction = InteractionUtils.getContainingInteraction(droppedEObject);
+ if (interaction != null) {
+ if (!updatedInteractionsCache.contains(interaction)) {
+ final ValidateInteractionCommand validateCommand = new ValidateInteractionCommand(getEditingDomain(), interaction, true);
+ cc.add(new ICommandProxy(validateCommand));
+ updatedInteractionsCache.add(interaction);
+ }
+ }
+ }
+ }
+
+ cc.add(super.getDropObjectsCommand(dropRequest));
+ return cc;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
new file mode 100644
index 00000000000..361da72be49
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+public abstract class AbstractMessageFigure extends UMLEdgeFigure {
+
+ protected static final Font LABEL_FONT = new Font(Display.getCurrent(), "SANS", 9, SWT.NORMAL); //$NON-NLS-1$
+ private WrappingLabel messageLabel;
+
+ @Override
+ public void paint(final Graphics graphics) {
+ graphics.setAntialias(SWT.ON);
+ super.paint(graphics);
+ }
+
+ public AbstractMessageFigure() {
+ // setForegroundColor(ColorConstants.black);
+ setForegroundColor(getForegroundColor());
+ setSourceDecoration(createSourceDecoration());
+ setTargetDecoration(createTargetDecoration());
+ }
+
+ // meant to be overridden
+ @SuppressWarnings("static-method")
+ protected RotatableDecoration createSourceDecoration() {
+ return null;
+ }
+
+ // meant to be overridden
+ @SuppressWarnings("static-method")
+ protected RotatableDecoration createTargetDecoration() {
+ return null;
+ }
+
+ @Override
+ protected void createContents() {
+ super.createContents();
+ this.messageLabel = new WrappingLabel();
+ this.messageLabel.setText(""); //$NON-NLS-1$
+ this.messageLabel.setFont(LABEL_FONT);
+ add(this.messageLabel);
+ }
+
+ public WrappingLabel getMessageLabel() {
+ return this.messageLabel;
+ }
+
+ @Override
+ public void setLineWidth(final int w) {
+ super.setLineWidth(w);
+ if (getSourceDecoration() instanceof Shape) {
+ ((Shape) getSourceDecoration()).setLineWidth(w);
+ }
+ if (getTargetDecoration() instanceof Shape) {
+ ((Shape) getTargetDecoration()).setLineWidth(w);
+ }
+ }
+
+ @Override
+ public void setForegroundColor(final Color c) {
+ super.setForegroundColor(c);
+ if (getSourceDecoration() instanceof Shape) {
+ ((Shape) getSourceDecoration()).setForegroundColor(c);
+ ((Shape) getSourceDecoration()).setBackgroundColor(c);
+ }
+ if (getTargetDecoration() instanceof Shape) {
+ ((Shape) getTargetDecoration()).setForegroundColor(c);
+ ((Shape) getTargetDecoration()).setBackgroundColor(c);
+ }
+ }
+
+ protected static IMapMode getMapMode() {
+ return MapModeTypes.IDENTITY_MM;
+ }
+} \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
new file mode 100644
index 00000000000..05cd6777166
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
@@ -0,0 +1,92 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
+
+/**
+ * @author vgillet
+ *
+ */
+public class CompactLifelineFigure extends LifelineFigure {
+
+ /**
+ * Get the rectangle which contains all labels
+ *
+ * @see org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure#getDefaultLabelsContainer()
+ * @return lifeline labels rectangle
+ */
+ protected IFigure getDefaultLabelsContainer() {
+ return getNameLabelContainerFigure();
+ }
+
+ @Override
+ protected void createContents() {
+ this.nameLabelContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "CompactLifelineFigure_nameLabelContainerFigure"; //$NON-NLS-1$
+ };
+ this.add(this.nameLabelContainerFigure);
+
+ this.nameLabel = new LifelineVerticalLabel();
+ this.nameLabelContainerFigure.add(this.nameLabel);
+ this.nameLabelContainerFigure.setLayoutManager(new CenterLayout());
+
+ this.lifelineDataContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "CompactLifelineFigure_lifelineDataContainerFigure"; //$NON-NLS-1$
+ };
+ this.lifelineDataContainerFigure.setLayoutManager(new AbstractLayout() {
+ public void layout(final IFigure container) {
+ final Rectangle clientArea = container.getClientArea();
+ final List<?> children = container.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure) children.get(i);
+ if (child == getTimelineContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height - Constants.TIME_RULER_HEIGHT));
+ } else if (child == getTimeRulerContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width,
+ Constants.TIME_RULER_HEIGHT));
+ }
+ }
+ }
+
+ @Override
+ protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
+ return new Dimension(-1, -1);
+ }
+ });
+ add(this.lifelineDataContainerFigure);
+
+ createDataContainerContents();
+ }
+
+ private void createDataContainerContents() {
+ this.timelineContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "CompactLifelineFigure_compactTimelineContainerFigure"; //$NON-NLS-1$
+ };
+ this.lifelineDataContainerFigure.add(this.timelineContainerFigure);
+
+ this.timeRulerContainerFigure = new TimeRulerFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "CompactLifelineFigure_timeRulerContainerFigure"; //$NON-NLS-1$
+ };
+ this.lifelineDataContainerFigure.add(this.timeRulerContainerFigure);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
new file mode 100644
index 00000000000..69e4a9ee317
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.GradientStyle;
+import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Pattern;
+import org.eclipse.swt.widgets.Display;
+
+public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
+
+ public static final int PREFERRED_HEIGHT = 32;
+ private final WrappingLabel label;
+ private boolean infinite;
+
+ /**
+ * @param infinite
+ * Whether the state has an end cap (the last state doesn't end)
+ */
+ public void setInfinite(final boolean infinite) {
+ this.infinite = infinite;
+ }
+
+ public boolean isInfinite() {
+ return this.infinite;
+ }
+
+ public CompactStateFigure() {
+ super();
+ setLayoutManager(new CenterLayout());
+ this.label = new WrappingLabel();
+ this.label.setAlignment(PositionConstants.CENTER);
+ add(this.label);
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ // super.paintFigure(g);
+
+ g.pushState();
+ final int height = Math.min(PREFERRED_HEIGHT, this.bounds.height);
+ final int middleY = this.bounds.y + this.bounds.height / 2;
+ final int x = this.bounds.x;
+ final int w = this.bounds.width - 1;
+ final int y = middleY - height / 2;
+ final int h = height - 1;
+
+ g.setLineWidth(1);
+
+ final int cornerSize = Math.min(h / 3, w / 3);
+
+ final int[] polygon;
+ if (this.infinite) {
+ polygon = new int[] { x, middleY, x + cornerSize, y, x + w + 1, y, x + w + 1, y + h, x + cornerSize, y + h };
+ } else {
+ polygon = new int[] { x, middleY, x + cornerSize, y, x + w - cornerSize, y, x + w, middleY, x + w - cornerSize, y + h, x + cornerSize, y + h };
+ }
+ g.setAntialias(SWT.ON);
+ if (isUsingGradient()) {
+ applyTransparency(g);
+ final Pattern pattern;
+ // apparently, patterns are not scaled automatically, so we need to scale the pattern so that it fits the
+ // current zoom level
+ final double scale = g.getAbsoluteScale();
+ final int xScaled = (int) (this.bounds.x * scale);
+ final int yScaled = (int) (this.bounds.y * scale);
+ final int widthScaled = (int) (this.bounds.width * scale);
+ final int heightScaled = (int) (height * scale);
+ if (getGradientStyle() == GradientStyle.VERTICAL) {
+ pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled, yScaled + heightScaled, FigureUtilities.integerToColor(Integer
+ .valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
+ } else {
+ pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled + widthScaled, this.bounds.y, FigureUtilities.integerToColor(Integer
+ .valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
+ }
+ g.setBackgroundPattern(pattern);
+ g.fillPolygon(polygon);
+ g.drawPolygon(polygon);
+ pattern.dispose();
+ } else {
+ g.setBackgroundColor(getBackgroundColor());
+ g.setForegroundColor(getForegroundColor());
+ // FIXME: the figure is not filled because the default fill color is black
+ // g.fillPolygon(polygon);
+ g.drawPolygon(polygon);
+ }
+ g.popState();
+ // displayDebugFigure(g);
+ }
+
+ // private void displayDebugFigure(final Graphics g) {
+ // g.pushState();
+ // g.setForegroundColor(ColorConstants.red);
+ // for (int x = 0; x < this.bounds.width - 1; x++) {
+ // final int y = computeHalfHeightAtAbscissa(x, this.bounds.width, this.bounds.height, this.infinite);
+ // g.drawRectangle(this.bounds.x + x, this.bounds.y + this.bounds.height / 2 - y, 1, 1);
+ // g.drawRectangle(this.bounds.x + x, this.bounds.y + this.bounds.height / 2 + y - 1, 1, 1);
+ // }
+ // g.popState();
+ // }
+
+ /**
+ * Compute the half height of a CompactStateFigure with the given width and height, at the given abscissa.
+ * <p>
+ * This function is useful in order to place an OccurrenceSpecification along the border of a StateInvariant.
+ *
+ * @param x
+ * the x coordinate at which to compute the height
+ * @param figureWidth
+ * the width of the CompactStateFigure
+ * @param figureHeight
+ * the height of the CompactStateFigure
+ * @param infinite
+ * whether the figure ends with a cap (not infinite) or not (infinite)
+ * @return the half height at the given position
+ */
+ public static int computeHalfHeightAtAbscissa(final int x, final int figureWidth, final int figureHeight, final boolean infinite) {
+ final int height = Math.min(PREFERRED_HEIGHT, figureHeight);
+ final int width = figureWidth;
+ final int halfHeight = figureHeight / 2;
+ final int cornerSize = Math.min(height / 3, width / 3);
+
+ final int resultY;
+ if (x < cornerSize) {
+ // on the left corner
+ final double slope = (height / 2.0) / cornerSize;
+ resultY = (int) (x * slope);
+ } else if (infinite) {
+ // on the straight border
+ resultY = halfHeight;
+ } else if (x < width - cornerSize) {
+ // on the straight border
+ resultY = halfHeight;
+ } else {
+ // on the right corner
+ final double slope = (double) halfHeight / cornerSize;
+ resultY = (int) (halfHeight - ((x - width + cornerSize) * slope));
+ }
+ return resultY;
+ }
+
+ public WrappingLabel getCompactStateInvariantLabel() {
+ return this.label;
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(-1, PREFERRED_HEIGHT);
+ }
+
+ @Override
+ protected void paintBorder(final Graphics graphics) {
+ // no border
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java
new file mode 100644
index 00000000000..6ba498d597f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CrossFigure.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+
+public class CrossFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
+
+ public static final int CROSS_SIZE = 8;
+
+ public CrossFigure() {
+ super();
+ setShadow(false);
+ setBorder(null);
+ }
+
+ @Override
+ public void paintFigure(final Graphics graphics) {
+ super.paintFigure(graphics);
+ graphics.pushState();
+ graphics.setAntialias(SWT.ON);
+ final Rectangle clipRect = graphics.getClip(new Rectangle());
+ final int additionalSizeForCross = 10;
+ // draw the cross outside its bounds so that the StateInvariant lines touch the base of the cross
+ // instead of its invisible border
+ graphics.setClip(new Rectangle(getBounds()).expand(additionalSizeForCross, additionalSizeForCross));
+
+ final int x = this.bounds.x - additionalSizeForCross + 1;
+ final int y = this.bounds.y - additionalSizeForCross + 1;
+ final int w = this.bounds.width + additionalSizeForCross * 2;
+ final int h = this.bounds.height + additionalSizeForCross * 2;
+ final int z = Math.max(w / 8, 1);
+
+ graphics.setLineWidth(z);
+ graphics.setLineCap(SWT.CAP_ROUND);
+ graphics.drawLine(x + z, y + z, x + w - z * 2, y + h - z * 2);
+ graphics.drawLine(x + w - z * 2, y + z, x + z, y + h - z * 2);
+ graphics.setClip(clipRect);
+ graphics.popState();
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(CROSS_SIZE, CROSS_SIZE);
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java
new file mode 100644
index 00000000000..f0c7b2e7798
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.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.figures;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.draw2d.InteractionFigure;
+import org.eclipse.papyrus.uml.diagram.common.draw2d.LeftToolbarLayout;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.InteractionRectangleFigure;
+
+public class CustomInteractionRectangleFigure extends InteractionRectangleFigure {
+
+ private RectangleFigure timeRulerCompartment;
+
+ public CustomInteractionRectangleFigure() {
+ setLayoutManager(new ToolbarLayout());
+ createContents();
+ }
+
+ @Override
+ protected void createContents() {
+ add(createInteractionFigureHeader());
+ add(createContentPane());
+ final int childrenSize = getChildren().size();
+ add(createTimeRulerCompartment(), childrenSize);
+ }
+
+ protected IFigure createTimeRulerCompartment() {
+ return this.timeRulerCompartment = new TimeRulerFigure();
+ }
+
+ protected InteractionFigure createInteractionFigureHeader() {
+ this.interactionLabel = new WrappingLabel() {
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ final Dimension preferredSize = super.getPreferredSize(wHint, hHint);
+ if (preferredSize.width == 0) {
+ return preferredSize;
+ }
+ return new Dimension(preferredSize.width + 2, preferredSize.height + 2);
+ }
+ };
+
+ this.interactionLabelContainer = new InteractionFigure();
+ this.interactionLabelContainer.setBorder(new MarginBorder(3, 3, 0, 0));
+ this.interactionLabelContainer.setLayoutManager(new LeftToolbarLayout());
+
+ this.interactionLabelContainer.add(this.interactionLabel);
+ return this.interactionLabelContainer;
+ }
+
+ public InteractionFigure getHeaderLabelContainer() {
+ return this.interactionLabelContainer;
+ }
+
+ public RectangleFigure getTimeRulerContainerFigure() {
+ return this.timeRulerCompartment;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.java
new file mode 100644
index 00000000000..e27e495f6e0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/DimensioningArrowFigure.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.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.SWT;
+
+public class DimensioningArrowFigure extends PapyrusNodeFigure {
+
+ private static final int PREFERRED_HEIGHT = 11;
+
+ public DimensioningArrowFigure() {
+ super();
+ setShadow(false);
+ setBorder(null);
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ g.pushState();
+
+ final int middleX = this.bounds.x + this.bounds.width / 2;
+ final int middleY = this.bounds.y + this.bounds.height / 2;
+ final int x = this.bounds.x;
+ final int w = this.bounds.width - 1;
+ final int horizontalGap = w / 3;
+ final int arrowSize = Math.max(Math.min(w / 5, 7), 3);
+ final int verticalLineSize = arrowSize * 3;
+
+ g.setLineWidth(1);
+
+ // horizontal line (left part)
+ g.drawLine(x, middleY, middleX - horizontalGap / 2, middleY);
+ // horizontal line (right part)
+ g.drawLine(middleX + horizontalGap / 2, middleY, x + w, middleY);
+ // left vertical line
+ g.drawLine(x, middleY - verticalLineSize / 2, x, middleY + verticalLineSize / 2);
+ // right vertical line
+ g.drawLine(x + w, middleY - verticalLineSize / 2, x + w, middleY + verticalLineSize / 2);
+
+ g.setAntialias(SWT.ON);
+ // left arrow
+ g.drawLine(x, middleY, x + arrowSize, middleY - arrowSize);
+ g.drawLine(x, middleY, x + arrowSize, middleY + arrowSize);
+ // right arrow
+ g.drawLine(x + w, middleY, x + w - arrowSize, middleY - arrowSize);
+ g.drawLine(x + w, middleY, x + w - arrowSize, middleY + arrowSize);
+
+ g.popState();
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(-1, PREFERRED_HEIGHT);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
new file mode 100644
index 00000000000..f1e865d4cab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Ellipse;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+
+public class EllipseDecoration extends Ellipse implements RotatableDecoration {
+
+ public EllipseDecoration() {
+ setPreferredSize(new Dimension(5, 5));
+ }
+
+ @Override
+ public void setLocation(final Point p) {
+ final Dimension delta = getPreferredSize().getScaled(0.5).getNegated();
+ super.setLocation(p.getTranslated(delta));
+ }
+
+ public void setReferencePoint(final Point p) {
+ // nothing
+ }
+
+ @Override
+ protected void fillShape(final Graphics graphics) {
+ final Color oldBack = graphics.getBackgroundColor();
+ graphics.setBackgroundColor(graphics.getForegroundColor());
+ graphics.fillOval(getOptimizedBounds());
+ graphics.setBackgroundColor(oldBack);
+ }
+
+ private Rectangle getOptimizedBounds() {
+ final float lineInset = Math.max(1.0f, getLineWidthFloat()) / 2.0f;
+ final int inset = (int) Math.floor(lineInset);
+ final Rectangle r = Rectangle.SINGLETON.setBounds(getBounds());
+ r.x += inset;
+ r.y += inset;
+ return r;
+ }
+
+ @Override
+ protected void outlineShape(final Graphics graphics) {
+ // no outline
+ }
+} \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java
new file mode 100644
index 00000000000..3a13e0ecc32
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.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.figures;
+
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.Constants;
+
+public class FullLifelineFigure extends LifelineFigure {
+
+ private RectangleFigure stateDefinitionContainerFigure;
+
+ // Chronogram contains statedefinition and timeline
+ private RectangleFigure chronogramContainerFigure;
+
+ @Override
+ protected void createContents() {
+ this.nameLabelContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "FullLifelineFigure_nameLabelContainerFigure"; //$NON-NLS-1$
+ };
+ add(this.nameLabelContainerFigure);
+
+ this.nameLabel = new LifelineVerticalLabel();
+ this.nameLabelContainerFigure.add(this.nameLabel);
+ this.nameLabelContainerFigure.setLayoutManager(new CenterLayout());
+
+ this.lifelineDataContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "FullLifelineFigure_lifelineDataContainerFigure"; //$NON-NLS-1$
+ };
+ this.lifelineDataContainerFigure.setLayoutManager(new AbstractLayout() {
+ public void layout(final IFigure container) {
+ final Rectangle clientArea = container.getClientArea();
+ final List<?> children = container.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure) children.get(i);
+ if (child == getChronogramContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height - Constants.TIME_RULER_HEIGHT));
+ } else if (child == getTimeRulerContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width,
+ Constants.TIME_RULER_HEIGHT));
+ }
+ }
+ }
+
+ @Override
+ protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
+ return new Dimension(-1, -1);
+ }
+ });
+
+ add(this.lifelineDataContainerFigure);
+ createDataContainerContents();
+
+ }
+
+ private void createDataContainerContents() {
+ this.chronogramContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "FullLifelineFigure_chronogramContainerFigure"; //$NON-NLS-1$
+ };
+ this.lifelineDataContainerFigure.add(this.chronogramContainerFigure);
+ this.chronogramContainerFigure.setLayoutManager(new AbstractLayout() {
+ public void layout(final IFigure container) {
+ final Rectangle clientArea = container.getClientArea();
+ final List<?> children = container.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure) children.get(i);
+ if (child == getStateDefinitionContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y, Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
+ } else if (child == getTimelineContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x + Constants.STATE_DEFINITIONS_WIDTH, clientArea.y, clientArea.width
+ - Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
+ }
+ }
+ }
+
+ @Override
+ protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
+ return new Dimension(-1, -1);
+ }
+ });
+ createChronogramContainerContents();
+
+ this.timeRulerContainerFigure = new TimeRulerFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "FullLifelineFigure_timeRulerContainerFigure"; //$NON-NLS-1$
+ };
+ this.lifelineDataContainerFigure.add(this.timeRulerContainerFigure);
+ }
+
+ private void createChronogramContainerContents() {
+
+ this.stateDefinitionContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "FullLifelineFigure_stateDefinitionContainerFigure"; //$NON-NLS-1$
+ };
+ this.chronogramContainerFigure.add(this.stateDefinitionContainerFigure);
+
+ this.timelineContainerFigure = new InvisibleRectangleFigure() {
+ @SuppressWarnings("unused")
+ String DEBUG_ID = "FullLifelineFigure_timelineContainerFigure"; //$NON-NLS-1$
+ };
+ this.chronogramContainerFigure.add(this.timelineContainerFigure);
+ }
+
+ public RectangleFigure getStateDefinitionContainerFigure() {
+ return this.stateDefinitionContainerFigure;
+ }
+
+ public RectangleFigure getChronogramContainerFigure() {
+ return this.chronogramContainerFigure;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java
new file mode 100644
index 00000000000..8e2b5e59883
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateFigure.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.graphics.Image;
+
+public class FullStateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
+
+ private int posY;
+
+ public FullStateFigure() {
+ super();
+ setBorder(null);
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ // super.paintFigure(g);
+ g.pushState();
+
+ // DEBUG
+ // g.setLineDash(new int[] { 1, 5 });
+ // g.drawRectangle(this.bounds.x, this.bounds.y, this.bounds.width - 1, this.bounds.height - 1);
+ // g.setLineDash(new int[] {});
+ // END DEBUG
+
+ // final int y = this.bounds.y;
+ final int x = this.bounds.x;
+ final int w = this.bounds.width;
+ final int y = this.posY;
+
+ g.setLineWidth(1);
+ g.drawLine(x, y, x + w, y);
+
+ g.popState();
+ }
+
+ public void setPosY(final int endY) {
+ this.posY = endY;
+ }
+
+ @Override
+ protected void paintBorder(final Graphics graphics) {
+ // no border
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.java
new file mode 100644
index 00000000000..9b1b047efed
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullStateInvariantVerticalLineFigure.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.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+
+public class FullStateInvariantVerticalLineFigure extends PapyrusNodeFigure {
+
+ public FullStateInvariantVerticalLineFigure() {
+ super();
+ setBorder(null);
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ // super.paintFigure(g);
+ g.setLineWidth(1);
+ final int middleX = this.bounds.x + this.bounds.width / 2;
+ g.drawLine(middleX, this.bounds.y, middleX, this.bounds.y + this.bounds.height);
+ }
+
+ @Override
+ protected void paintBorder(final Graphics graphics) {
+ // no border
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.java
new file mode 100644
index 00000000000..f397f2a31ae
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GateFigure.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.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.graphics.Image;
+
+public class GateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
+
+ public static final int SQUARE_SIZE = 5;
+
+ public GateFigure() {
+ super();
+ setShadow(false);
+ setBorder(null);
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ g.pushState();
+
+ final int middleX = this.bounds.x + this.bounds.width / 2;
+ final int middleY = this.bounds.y + this.bounds.height / 2;
+
+ g.setLineWidth(1);
+
+ g.fillRectangle(middleX - SQUARE_SIZE / 2, middleY - SQUARE_SIZE / 2, SQUARE_SIZE, SQUARE_SIZE);
+ g.popState();
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(SQUARE_SIZE, SQUARE_SIZE);
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // nothing
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java
new file mode 100644
index 00000000000..7434b54a42f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.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.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.SWT;
+
+public class GeneralOrderingHorizontalFigure extends PapyrusNodeFigure {
+
+ private static final int PREFERRED_HEIGHT = 11;
+
+ public GeneralOrderingHorizontalFigure() {
+ super();
+ setShadow(false);
+ setBorder(null);
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ g.pushState();
+
+ final int middleX = this.bounds.x + this.bounds.width / 2;
+ final int middleY = this.bounds.y + this.bounds.height / 2;
+ final int x = this.bounds.x;
+ final int w = this.bounds.width - 1;
+ final int arrowSize = Math.max(Math.min(w / 3, 12), 6);
+ final int a = arrowSize / 2;
+
+ g.setLineWidth(1);
+
+ // horizontal line
+ g.setLineDash(new int[] { 4, 4 });
+ g.drawLine(x, middleY, x + w, middleY);
+ g.setLineDash(new int[] {});
+
+ // arrow
+ g.setAntialias(SWT.ON);
+ g.setBackgroundColor(getForegroundColor());
+ g.fillPolygon(new int[] { middleX - a, this.bounds.y, middleX + a, middleY, middleX - a, this.bounds.y + this.bounds.height });
+
+ g.popState();
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(-1, PREFERRED_HEIGHT);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
new file mode 100644
index 00000000000..4948f1c2e26
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.Shape;
+
+/** A rectangle that is not painted: useful for simplifying layouts */
+public class InvisibleRectangleFigure extends RectangleFigure {
+ /**
+ * Creates a RectangleFigure.
+ */
+ public InvisibleRectangleFigure() {
+ }
+
+ /**
+ * @see Shape#fillShape(Graphics)
+ */
+ @Override
+ protected void fillShape(final Graphics graphics) {
+ // don't fill
+ }
+
+ /**
+ * @see Shape#outlineShape(Graphics)
+ */
+ @Override
+ protected void outlineShape(final Graphics graphics) {
+ // don't draw an outline
+ }
+} \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
new file mode 100644
index 00000000000..458ae8c0207
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.graphics.Image;
+
+public class LifelineFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
+
+ protected final int LABEL_WIDTH = 30;
+ protected RectangleFigure nameLabelContainerFigure;
+ protected LifelineVerticalLabel nameLabel;
+ protected RectangleFigure timeRulerContainerFigure;
+ protected RectangleFigure lifelineDataContainerFigure;
+ protected RectangleFigure timelineContainerFigure;
+
+ private boolean selected;
+ private boolean displayTimeRuler;
+
+ public LifelineFigure() {
+ setShadow(false);
+ createContents();
+ setLayoutManager(new AbstractLayout() {
+ public void layout(final IFigure container) {
+ final Rectangle clientArea = container.getClientArea();
+ final List<?> children = container.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure) children.get(i);
+ if (child == getNameLabelContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y, LifelineFigure.this.LABEL_WIDTH, clientArea.height));
+ } else if (child == getLifelineDataContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x + LifelineFigure.this.LABEL_WIDTH, clientArea.y, clientArea.width
+ - LifelineFigure.this.LABEL_WIDTH, clientArea.height));
+ }
+ }
+ }
+
+ @Override
+ protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
+ return new Dimension(-1, -1);
+ }
+ });
+ }
+
+ protected void createContents() {
+ // meant to be overridden
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Figure#setPreferredSize(org.eclipse.draw2d.geometry.Dimension)
+ */
+ @Override
+ public void setPreferredSize(final Dimension size) {
+ final IFigure container = getParent();
+ final int childrenSize = container.getChildren().size();
+ final Rectangle containerRectangle = container.getBounds();
+ final Rectangle resultBounds = new Rectangle(0, 0, containerRectangle.width(), containerRectangle.height() / childrenSize);
+ this.prefSize = resultBounds.getSize();
+ }
+
+ public void setSelected(final boolean selected) {
+ this.selected = selected;
+ }
+
+ @Override
+ public void paintFigure(final Graphics graphics) {
+ super.paintFigure(graphics);
+ if (this.selected) {
+ graphics.pushState();
+ graphics.setForegroundColor(ColorConstants.black);
+ graphics.setLineWidth(1);
+ graphics.drawRectangle(getBounds().getShrinked(1, 1).resize(-1, -1));
+ graphics.popState();
+ }
+ }
+
+ public boolean isDisplayTimeRuler() {
+ return this.displayTimeRuler;
+ }
+
+ public void setDisplayTimeRuler(final boolean visible) {
+ this.displayTimeRuler = visible;
+ }
+
+ public LifelineVerticalLabel getLifelineLabelFigure() {
+ return this.nameLabel;
+ }
+
+ public RectangleFigure getNameLabelContainerFigure() {
+ return this.nameLabelContainerFigure;
+ }
+
+ public RectangleFigure getTimelineContainerFigure() {
+ return this.timelineContainerFigure;
+ }
+
+ public RectangleFigure getTimeRulerContainerFigure() {
+ return this.timeRulerContainerFigure;
+ }
+
+ public RectangleFigure getLifelineDataContainerFigure() {
+ return this.lifelineDataContainerFigure;
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // TODO implement LifelineFigure#setStereotypeDisplay
+ }
+
+ public void setStereotypePropertiesInBrace(final String stereotypeProperties) {
+ // TODO implement LifelineFigure#setStereotypePropertiesInBrace
+ }
+
+ public void setStereotypePropertiesInCompartment(final String stereotypeProperties) {
+ // TODO implement LifelineFigure#setStereotypePropertiesInCompartment
+ }
+
+ public Label getStereotypesLabel() {
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
new file mode 100644
index 00000000000..521a82c6a2b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+public class LifelineVerticalLabel extends VerticalLabel implements ILabelFigure {
+
+ private boolean selected;
+ private boolean focus;
+
+ @Override
+ public Color getBackgroundColor() {
+ if (this.selected) {
+ return Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION);
+ }
+ // the transparency color for the label
+ return ColorConstants.white;
+ }
+
+ @Override
+ public Color getForegroundColor() {
+ if (this.selected) {
+ return Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
+ }
+ return super.getForegroundColor();
+ }
+
+ @Override
+ public String getText() {
+ final String text = super.getText();
+ // vertical label triggers IllegalArgumentException if text is empty
+ return text == null || "".equals(text) ? " " : text; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ public void setIcon(final Image icon) {
+ // no icon
+ }
+
+ public Image getIcon() {
+ return null;
+ }
+
+ public void setSelected(final boolean value) {
+ this.selected = value;
+ // display the blue background when the figure is selected
+ setOpaque(value);
+ updateImage();
+ }
+
+ public void setFocus(final boolean value) {
+ this.focus = value;
+ repaint();
+ }
+
+ @Override
+ protected void paintFigure(final Graphics graphics) {
+ super.paintFigure(graphics);
+ if (this.focus) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.java
new file mode 100644
index 00000000000..5a5cbb4eeab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageAsyncFigure.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.figures;
+
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageAsyncFigure extends AbstractMessageFigure {
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final PolylineDecoration df = new PolylineDecoration();
+ df.setForegroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ df.setTemplate(pl);
+ return df;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.java
new file mode 100644
index 00000000000..f61206b6961
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageCreateFigure.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.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageCreateFigure extends AbstractMessageFigure {
+
+ public MessageCreateFigure() {
+ super();
+ setLineStyle(Graphics.LINE_DASH);
+ }
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final PolylineDecoration df = new PolylineDecoration();
+ df.setForegroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ df.setTemplate(pl);
+ return df;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
new file mode 100644
index 00000000000..dc41e0ad889
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageDeleteFigure extends AbstractMessageFigure {
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final PolygonDecoration df = new PolygonDecoration() {
+ @Override
+ protected void outlineShape(final Graphics g) {
+ // no outline: this is a filled arrow
+ }
+ };
+ df.setFill(true);
+ df.setForegroundColor(getForegroundColor());
+ df.setBackgroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ df.setTemplate(pl);
+ return df;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java
new file mode 100644
index 00000000000..9b1219efc44
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageFoundFigure.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageFoundFigure extends AbstractMessageFigure {
+
+ @Override
+ protected RotatableDecoration createSourceDecoration() {
+ final EllipseDecoration df = new EllipseDecoration();
+ df.setPreferredSize(new Dimension(10, 10));
+ return df;
+ }
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final PolylineDecoration df = new PolylineDecoration();
+ df.setForegroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ df.setTemplate(pl);
+ return df;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java
new file mode 100644
index 00000000000..1d081643a43
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageLostFigure.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.ArrowLocator;
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageLostFigure extends AbstractMessageFigure {
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final EllipseDecoration df = new EllipseDecoration();
+ df.setPreferredSize(new Dimension(10, 10));
+ // add the ellipse as a child figure
+ add(df, new ArrowLocator(this, ConnectionLocator.TARGET));
+
+ final PolylineDecoration arrow = new PolylineDecoration();
+ arrow.setForegroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ arrow.setTemplate(pl);
+
+ return arrow;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java
new file mode 100644
index 00000000000..dea5be003a8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageReplyFigure.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageReplyFigure extends AbstractMessageFigure {
+
+ public MessageReplyFigure() {
+ super();
+ setLineStyle(Graphics.LINE_DASH);
+ }
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final PolygonDecoration df = new PolygonDecoration();
+ df.setFill(true);
+ df.setForegroundColor(getForegroundColor());
+ df.setBackgroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ df.setTemplate(pl);
+ return df;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
new file mode 100644
index 00000000000..e679ea85951
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+
+public class MessageSyncFigure extends AbstractMessageFigure {
+
+ @Override
+ protected RotatableDecoration createTargetDecoration() {
+ final PolygonDecoration df = new PolygonDecoration() {
+ @Override
+ protected void outlineShape(final Graphics g) {
+ // no outline: this is a filled arrow
+ }
+ };
+ df.setFill(true);
+ df.setForegroundColor(getForegroundColor());
+ df.setBackgroundColor(getForegroundColor());
+ final PointList pl = new PointList();
+ final IMapMode mapMode = getMapMode();
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ pl.addPoint(mapMode.DPtoLP(0), mapMode.DPtoLP(0));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(-2));
+ pl.addPoint(mapMode.DPtoLP(-2), mapMode.DPtoLP(2));
+ df.setTemplate(pl);
+ return df;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java
new file mode 100644
index 00000000000..ed8feee47a5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.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.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
+import org.eclipse.swt.graphics.Image;
+
+public class SmallSquareFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
+
+ public static final int SQUARE_SIZE = 5;
+ /** How many pixels the Figure must be moved upwards and leftwards in order to center it */
+ public static final int RADIUS = SQUARE_SIZE / 2;
+
+ public SmallSquareFigure() {
+ super();
+ }
+
+ @Override
+ public void paintFigure(final Graphics g) {
+ g.pushState();
+
+ final int middleX = this.bounds.x + this.bounds.width / 2;
+ final int middleY = this.bounds.y + this.bounds.height / 2;
+
+ g.setLineWidth(1);
+
+ g.fillRectangle(middleX - SQUARE_SIZE / 2, middleY - SQUARE_SIZE / 2, SQUARE_SIZE, SQUARE_SIZE);
+ g.popState();
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(SQUARE_SIZE, SQUARE_SIZE);
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // nothing
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
new file mode 100644
index 00000000000..43deec99903
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+
+public class StateDefinitionFigure extends NodeNamedElementFigure {
+
+ private boolean selected;
+
+ public StateDefinitionFigure() {
+ super();
+ setShadow(false);
+ setBorder(null);
+ }
+
+ public void setSelected(final boolean selected) {
+ this.selected = selected;
+ }
+
+ public boolean isSelected() {
+ return this.selected;
+ }
+
+ @Override
+ public void paintFigure(final Graphics graphics) {
+ paintClientArea(graphics);
+ paintFocusRectangle(graphics);
+ }
+
+ @Override
+ protected void paintClientArea(final Graphics graphics) {
+ super.paintClientArea(graphics);
+ }
+
+ private void paintFocusRectangle(final Graphics g) {
+ if (isSelected()) {
+ g.pushState();
+ g.setXORMode(true);
+ g.setForegroundColor(ColorConstants.menuBackgroundSelected);
+ g.setBackgroundColor(ColorConstants.menuForegroundSelected);
+ final Rectangle b = getBounds();
+ final Rectangle focusRect = new Rectangle(b.x, b.y, b.width - 1, b.height - 1);
+ g.setLineWidth(1);
+ g.drawFocus(focusRect);
+ g.popState();
+ }
+ }
+
+ @Override
+ protected void paintBorder(final Graphics graphics) {
+ // no border
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java
new file mode 100644
index 00000000000..f41e5684b87
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.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.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class TimeRulerFigure extends InvisibleRectangleFigure {
+ @Override
+ protected void outlineShape(final Graphics graphics) {
+ final Rectangle bounds = getBounds();
+ graphics.setForegroundColor(ColorConstants.gray);
+ graphics.drawLine(bounds.getTopLeft(), bounds.getTopRight());
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java
new file mode 100644
index 00000000000..13ad551db62
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimingRulerFigure.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.layouts.FillLayout;
+
+public class TimingRulerFigure extends InvisibleRectangleFigure {
+
+ private final InvisibleRectangleFigure tickContainer;
+
+ public TimingRulerFigure() {
+ super();
+ this.tickContainer = new InvisibleRectangleFigure();
+ this.tickContainer.setLayoutManager(new FillLayout());
+ add(this.tickContainer);
+ }
+
+ public IFigure getTickContainerFigure() {
+ return this.tickContainer;
+ }
+
+ public IFigure getFreeTimeRulerContainerFigure() {
+ return this.tickContainer;
+ }
+
+ public IFigure getLinearTimeRulerContainerFigure() {
+ return this.tickContainer;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
new file mode 100644
index 00000000000..49ed0dfc66c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.AbstractImageFigure;
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Transform;
+import org.eclipse.swt.widgets.Display;
+
+public class VerticalLabel extends AbstractImageFigure {
+
+ private Image img;
+ private String myText;
+ private Font myImageFont;
+ private Color myForegroundColor;
+ private Color myBackgroundColor;
+
+ @Override
+ protected void paintFigure(final Graphics g) {
+ final Image image = getImage();
+ if (image != null) {
+ g.drawImage(image, this.bounds.x, this.bounds.y);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addNotify() {
+ updateImage();
+ super.addNotify();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeNotify() {
+ if (this.img != null) {
+ this.img.dispose();
+ this.img = null;
+ }
+ super.removeNotify();
+ }
+
+ /** {@inheritDoc} */
+ public Image getImage() {
+ boolean update = false;
+ if (this.myImageFont != getFont()) {
+ this.myImageFont = getFont();
+ update = true;
+ }
+ if (needsUpdate(this.myForegroundColor, getForegroundColor())) {
+ this.myForegroundColor = getForegroundColor();
+ update = true;
+ }
+ if (needsUpdate(this.myBackgroundColor, getBackgroundColor())) {
+ this.myBackgroundColor = getBackgroundColor();
+ update = true;
+ }
+
+ if (update) {
+ updateImage();
+ }
+ return this.img;
+ }
+
+ /**
+ * Updates the image with the string provided.
+ *
+ * @param text
+ * to display
+ */
+ public void setText(final String text) {
+ this.myText = text;
+ updateImage();
+ }
+
+ public String getText() {
+ return this.myText;
+ }
+
+ /**
+ * Redraws / creates the image of the rotated String.
+ *
+ * @return image created
+ */
+ public void updateImage() {
+ if (this.img != null) {
+ this.img.dispose();
+ this.img = null;
+ }
+ if (getText() == null || getFont() == null) {
+ return;
+ }
+ setImage(createRotatedImageOfString(getText(), getFont(), getForegroundColor(), getBackgroundColor(), isOpaque()));
+ }
+
+ private void setImage(final Image image) {
+ if (this.img == image) {
+ return;
+ }
+ this.img = image;
+ revalidate();
+ notifyImageChanged();
+ repaint();
+ }
+
+ public static Image createRotatedImageOfString(final String string, final Font font, final Color foreground, final Color background, final boolean opaque) {
+ final Display display = Display.getDefault();
+
+ final FontMetrics metrics = FigureUtilities.getFontMetrics(font);
+ final Dimension strSize = FigureUtilities.getStringExtents(string, font);
+
+ final int height = strSize.width;
+ final int width = metrics.getAscent() + metrics.getDescent() + metrics.getLeading();
+
+ final ImageData data = new ImageData(width, height, 32, new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000));
+ if (!opaque) {
+ data.transparentPixel = data.palette.getPixel(background.getRGB());
+ }
+
+ final Image image = new Image(display, data);
+ final GC gc = new GC(image);
+ gc.setFont(font);
+ gc.setBackground(background);
+ gc.fillRectangle(image.getBounds());
+ gc.setForeground(foreground);
+ final Transform transform = new Transform(Display.getCurrent());
+ transform.translate(0, height);
+ transform.rotate(-90);
+ gc.setTransform(transform);
+ gc.drawString(string, 0, 0, true);
+ gc.dispose();
+ return image;
+ }
+
+ private static final boolean needsUpdate(final Color cachedColor, final Color actualColor) {
+ if (cachedColor == null && actualColor == null) {
+ return false;
+ }
+ return cachedColor == null || !cachedColor.equals(actualColor);
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ if (this.img != null) {
+ return new Rectangle(this.img.getBounds()).getSize();
+ }
+ return super.getPreferredSize(wHint, hHint);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
new file mode 100644
index 00000000000..e653cd353e9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
+import org.eclipse.swt.graphics.Image;
+
+public class VerticalMarkFigure extends org.eclipse.draw2d.Figure implements IPapyrusUMLElementFigure {
+
+ public static final int PREFERRED_WIDTH = 5;
+ public static final int PREFERRED_HEIGHT = 12;
+
+ public VerticalMarkFigure() {
+ super();
+ }
+
+ @Override
+ protected void paintFigure(final Graphics g) {
+ super.paintFigure(g);
+ g.pushState();
+ final int middleX = this.bounds.x + this.bounds.width / 2;
+ g.setLineWidth(3);
+ g.drawLine(middleX, this.bounds.y, middleX, this.bounds.y + this.bounds.height);
+ g.popState();
+ }
+
+ @Override
+ public Dimension getPreferredSize(final int wHint, final int hHint) {
+ return new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT);
+ }
+
+ public void setStereotypeDisplay(final String stereotypes, final Image image) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java
new file mode 100644
index 00000000000..f2a4e1ff641
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.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.helper;
+
+import java.util.Collection;
+
+import org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonSourceUMLSwitch;
+import org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper.CommonTargetUMLSwitch;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Specialization of the link mapping helper for the timing diagram
+ */
+public class TimingDiagramLinkMappingHelper implements ILinkMappingHelper {
+
+ private static TimingDiagramLinkMappingHelper INSTANCE;
+
+ /**
+ * Gets the single instance of {@link TimingDiagramLinkMappingHelper}.
+ *
+ * @return single instance of {@link TimingDiagramLinkMappingHelper}
+ */
+ public static TimingDiagramLinkMappingHelper getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new TimingDiagramLinkMappingHelper();
+ }
+ return INSTANCE;
+ }
+
+ private TimingDiagramLinkMappingHelper() {
+ // singleton helper
+ }
+
+ public Collection<?> getSource(final Element link) {
+ // TODO: define source link mapping
+ return LinkMappingHelper.getSource(link, new CommonSourceUMLSwitch() {
+ // @Override
+ // public Collection<?> caseGeneralOrdering(final GeneralOrdering object) {
+ // return Collections.singleton(object.getBefore());
+ // }
+ });
+ }
+
+ public Collection<?> getTarget(final Element link) {
+ // TODO: define target link mapping
+ return LinkMappingHelper.getTarget(link, new CommonTargetUMLSwitch() {
+ // @Override
+ // public Collection<?> caseGeneralOrdering(final GeneralOrdering object) {
+ // return Collections.singleton(object.getAfter());
+ // }
+ });
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
new file mode 100644
index 00000000000..6aeb6b7ca14
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+
+/** This HelperAdvice disapproves destroy requests for VerticalLines. */
+public class DefaultTypeHelperAdvice extends AbstractEditHelperAdvice {
+
+ private static String VERTICAL_LINE_ID = Integer.toString(FullStateInvariantVerticalLineEditPart.VISUAL_ID);
+
+ @Override
+ public boolean approveRequest(final IEditCommandRequest request) {
+ if (request instanceof DestroyElementRequest) {
+ final DestroyElementRequest destroyElementRequest = (DestroyElementRequest) request;
+ final EObject elementToDestroy = destroyElementRequest.getElementToDestroy();
+ if (elementToDestroy instanceof View) {
+ final View view = (View) elementToDestroy;
+ if (VERTICAL_LINE_ID.equals(view.getType()) && TimingDiagramEditPart.MODEL_ID == ViewUtils.getContainingDiagramType(view)) {
+ return false;
+ }
+ }
+ }
+ return super.approveRequest(request);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java
new file mode 100644
index 00000000000..35064e4851a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.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.helper.advice;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.GateUtils;
+import org.eclipse.uml2.uml.Gate;
+
+/**
+ * This HelperAdvice completes {@link Gate} edit commands with commands specific to the timing diagram in order to keep
+ * the model consistent when deleting a {@link Gate}.
+ */
+public class GateHelperAdvice extends AbstractEditHelperAdvice {
+
+ @Override
+ protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
+ final EObject destructee = request.getElementToDestroy();
+ if (destructee instanceof Gate) {
+ final Gate gate = (Gate) destructee;
+ final Collection<EObject> elementsToDestroy = GateUtils.getElementsToDelete(gate);
+ if (!elementsToDestroy.isEmpty()) {
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.GateHelperAdvice_DestroyGate);
+ // destroy related elements
+ for (final EObject eObject : elementsToDestroy) {
+ final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
+ final DestroyElementCommand destroyElementCommand = new DestroyElementCommand(destroyElementRequest);
+ if (destroyElementCommand.canExecute()) {
+ compositeCommand.add(destroyElementCommand);
+ }
+ }
+ return compositeCommand;
+ }
+ }
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
new file mode 100644
index 00000000000..7c4ba3281b6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
+
+import java.util.Collection;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+/**
+ * This HelperAdvice completes {@link OccurrenceSpecification} edit commands with commands specific to the timing
+ * diagram in order to keep the model and diagram consistent when deleting an {@link OccurrenceSpecification}.
+ */
+public class OccurrenceSpecificationHelperAdvice extends AbstractEditHelperAdvice {
+
+ @Override
+ protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
+ final EObject destructee = request.getElementToDestroy();
+ if (destructee instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) destructee;
+ final Collection<EObject> elementsToDestroy = OccurrenceSpecificationUtils.getElementsToDelete(occurrenceSpecification);
+ if (!elementsToDestroy.isEmpty()) {
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification);
+ // destroy related elements
+ for (final EObject eObject : elementsToDestroy) {
+ final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
+ final DestroyElementCommand destroyElementCommand = new DestroyElementCommand(destroyElementRequest);
+ if (destroyElementCommand.canExecute()) {
+ compositeCommand.add(destroyElementCommand);
+ }
+ }
+ final IUndoableOperation updateFragmentNamesCommand = LifelineUtils.getUpdateFragmentNamesCommand(occurrenceSpecification);
+ if (updateFragmentNamesCommand != null) {
+ compositeCommand.add(updateFragmentNamesCommand);
+ }
+ return compositeCommand;
+ }
+ }
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
new file mode 100644
index 00000000000..62bf11b0b54
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice;
+
+import java.util.Collection;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.OperationForbiddenException;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
+import org.eclipse.uml2.uml.StateInvariant;
+
+/**
+ * This HelperAdvice completes {@link StateInvariant} edit commands with commands specific to the timing diagram in
+ * order to keep the model and diagram consistent when deleting a {@link StateInvariant}.
+ */
+public class StateInvariantHelperAdvice extends AbstractEditHelperAdvice {
+
+ @Override
+ protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
+ final EObject destructee = request.getElementToDestroy();
+ if (destructee instanceof StateInvariant) {
+ try {
+ final StateInvariant stateInvariant = (StateInvariant) destructee;
+ final Collection<EObject> elementsToDestroy = StateInvariantUtils.getElementsToDelete(stateInvariant);
+ if (!elementsToDestroy.isEmpty()) {
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.StateInvariantHelperAdvice_DestroyStateInvariant);
+
+ for (final EObject eObject : elementsToDestroy) {
+ final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
+ compositeCommand.add(new DestroyElementCommand(destroyElementRequest));
+ }
+ final IUndoableOperation updateFragmentNamesCommand = LifelineUtils.getUpdateFragmentNamesCommand(stateInvariant);
+ if (updateFragmentNamesCommand != null) {
+ compositeCommand.add(updateFragmentNamesCommand);
+ }
+ return compositeCommand;
+ }
+ } catch (final OperationForbiddenException e) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
new file mode 100644
index 00000000000..3ba7e926a21
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.layouts;
+
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class FillLayout extends AbstractLayout {
+ public void layout(final IFigure container) {
+ final Rectangle clientArea = container.getClientArea();
+ final List<?> children = container.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure) children.get(i);
+ child.setBounds(clientArea);
+ if (child instanceof FreeformLayer) {
+ final FreeformLayer freeformLayer = (FreeformLayer) child;
+ freeformLayer.setFreeformBounds(clientArea);
+ }
+ }
+ }
+
+ @Override
+ protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
+ return new Dimension(-1, -1);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java
new file mode 100644
index 00000000000..788ddab1b29
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.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.layouts;
+
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class TimeRulerLayout extends AbstractLayout {
+
+ public void layout(final IFigure container) {
+ // reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
+ // if (!(container.getParent().getLayoutManager() instanceof FillLayout)) {
+ // container.getParent().setLayoutManager(new FillLayout());
+ // }
+
+ // The grand-parent is a FreeformViewport, which lets its child expand outside of its clientArea, and
+ // constantly resets the bounds (in org.eclipse.draw2d.FreeformViewport#readjustScrollBars)
+ // So, layout based on the grand-parent's clientArea.
+ final Rectangle clientArea = container.getParent().getClientArea();
+ @SuppressWarnings("unchecked")
+ final List<IFigure> children = container.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final IFigure child = children.get(i);
+ child.setBounds(clientArea);
+ }
+
+ }
+
+ @Override
+ protected Dimension calculatePreferredSize(final IFigure container, final int wHint, final int hHint) {
+ return new Dimension(-1, -1);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.java
new file mode 100644
index 00000000000..027ea9a0be0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/locator/LabelInCompartmentLocator.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.locator;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
+
+/**
+ * Lets the user move a Label anywhere inside its containing compartment, but don't let the label stick out of the
+ * compartment.
+ */
+public class LabelInCompartmentLocator extends ExternalLabelPositionLocator {
+
+ public LabelInCompartmentLocator(final IFigure parentFigure) {
+ super(parentFigure);
+ }
+
+ @Override
+ public Rectangle getValidLocation(final Rectangle proposedLocation, final IFigure borderItem) {
+ return FigureUtils.constrainBoundsWithinContainingCompartment(proposedLocation, borderItem);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties
new file mode 100644
index 00000000000..bcd7961a0d6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/messages.properties
@@ -0,0 +1,93 @@
+###############################################################################
+# Copyright (c) 2012 CEA LIST.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+AbstractTimelineLayoutPolicy_MoveOccurrenceSpecification=Move OccurrenceSpecification
+AbstractTimelineLayoutPolicy_UpdateLocationOfTimeElements=Update Location of Time Elements
+AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification=Create Occurrence Specification
+ChangeLifelineFromCompactToFull_commandLabel=Change Lifeline From Compact To Full
+ChangeLifelineFromFullToCompact_commandLabel=Change Lifeline From Full To Compact
+CompactStateInvariantNameParser_SetStateInvariantName=Set State Invariant Name
+CompactStateInvariantNameParser_Unnamed=<unnamed>
+CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_CreateStateInvariant=Create State Invariant
+CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant=Initialize State Invariant
+CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement=Move element
+CustomCompactLifelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification=Move OccurrenceSpecification
+CustomCompactLifelineCompartmentLayoutEditPolicy_ResizeStateInvariant=Resize StateInvariant
+CustomCompactStateInvariantEditPartCN_CreateOccurrenceSpecification=Create OccurrenceSpecification
+CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition=Create State Definition
+CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition=Initialize State Definition
+CustomFullLifelineStateDefinitionCompartmentEditPartCN_AddStateDefinitionsHere=add State Definitions here
+CustomFullStateInvariantEditPartCN_CreateOccurrenceSpecification=Create OccurrenceSpecification
+hideStateInvariant=Hide StateInvariant
+CustomInteractionCompartmentCreationEditPolicy_CreateCompactLifeline=Create Compact Lifeline
+CustomInteractionCompartmentCreationEditPolicy_CreateFullLifeline=Create Full Lifeline
+CustomInteractionCreationEditPolicy_CreateGate=Create Gate
+CustomInteractionCreationEditPolicy_PositionGate=Position Gate
+CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation=Set MessageFound source location
+CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation=Set MessageLost target location
+OccurrenceSpecificationUtils_DestroyOccurrenceSpecification=Destroy OccurrenceSpecification
+OccurrenceSpecificationUtils_HideOccurrenceSpecification=Hide OccurrenceSpecification
+LifelineUtils_CreationOccurrence=Creation
+LifelineUtils_DestructionOccurrence=Destruction
+LifelineUtils_UpdateFragmentNames=Update Fragment Names
+LifelineUtils_UpdateLifelineFragmentNames=Update Lifeline Fragment Names
+CustomPaletteFactory_SetFoundMessageTarget=Set FoundMessage target
+CustomPaletteFactory_SetLostMessageOrigin=Set LostMessage origin
+CustomStateDefinitionEditPart_DeleteStateDefinition=Delete StateDefinition
+CustomTimelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification=Move OccurrenceSpecification
+CustomTimelineCompartmentLayoutEditPolicy_MoveStateInvariant=Move State Invariant
+CustomTimelineCompartmentLayoutEditPolicy_MoveVerticalLine=Move Vertical Line
+CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant=Update State Invariant
+CutAndInsertOccurrenceSpecificationCommand_CreateOccurrenceSpecification=Create Occurrence Specification
+CutAndInsertOccurrenceSpecificationCompactLifelineCommand_CreateOccurrenceSpecification=Create Occurrence Specification
+DeleteStateDefinitionCommand_DeleteStateDefinition=Delete StateDefinition
+DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification=Create DestructionOccurrenceSpecification
+DropUtils_DropElement=Drop Element
+DropUtils_DropGate=Drop Gate
+DurationCreationTool_ClickEndElement=Click on the end element of the duration (OccurrenceSpecification or StateInvariant)
+DurationCreationTool_ClickStartElement=Click on the start element of the duration (OccurrenceSpecification or StateInvariant)
+ModelValidationUtils_CoveredByFragmentsWereReOrdered={0} fragments in the Lifeline\#coveredBy list were re-ordered to match the Interaction\#fragments list.
+ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification={0} fragments after a DestructionOccurrenceSpecification was found.
+ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification={0} fragments after a DestructionOccurrenceSpecification was removed.
+ModelValidationUtils_MissingOccurrenceSpecificationAdded={0} missing OccurrenceSpecification between StateInvariants was added.
+ModelValidationUtils_MissingOccurrenceSpecificationFound={0} missing OccurrenceSpecification between StateInvariants was found.
+ModelValidationUtils_ModelValidation=Model Validation
+OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification=Create OccurrenceSpecification
+OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification=Destroy OccurrenceSpecification
+OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName=Set OccurrenceSpecification Name
+StateDefinitionParser_SetStateDefinitionName=Set State Definition Name
+StateDefinitionParser_Unnamed=<unnamed>
+StateDefinitionUtils_State=State
+StateInvariantHelperAdvice_DestroyStateInvariant=Destroy StateInvariant
+SwitchLifelineCommand_createLifelineFragments=Create Lifeline Fragments
+SwitchLifelineCommand_CreateLinkedElements=Create Linked Elements
+SwitchLifelineCommand_CreateTimeRuler=Create Time Ruler
+SwitchLifelineCommand_createMessages=Create Messages
+SwitchLifelineCommand_createStateDefinitions=Create State Definitions
+SwitchLifelineCommand_NameUnnamedStateInvariants=Name Unnamed StateInvariants
+SwitchLifelineCommand_ReAssociateTicks=Re-associate Ticks
+SwitchLifelineCommand_switchLifeline=Switch Lifeline
+SwitchLifelineCommand_unnamed=unnamed
+ConstraintParser_SetConstraint=Set Constraint
+GateHelperAdvice_DestroyGate=Destroy Gate
+GeneralOrderingCreationTool_ClickAfter=Click on the "after" OccurrenceSpecification of the ordering
+GeneralOrderingCreationTool_ClickBefore=Click on the "before" OccurrenceSpecification of the ordering
+TimingDiagramDragDropEditPolicy_Drop=Drop
+TimingDiagramDragDropEditPolicy_DropLifeline=Drop Lifeline
+TimingDiagramDragDropEditPolicy_DropLifelineFragments=Drop Lifeline Fragments
+TimingDiagramDragDropEditPolicy_DropMessage=Drop Message
+TimingDiagramDragDropEditPolicy_DropStateDefinitions=Drop State Definitions
+ToggleTimeRulerVisibility_ToggleTimeRulerVisibility=Toggle Time Ruler Visibility
+UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage=Cannot open input element:
+UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle=Problem opening
+ValidateInteractionCommand_ValidateInteraction=Validate Interaction
+ViewUtils_MoveView=Move View
+CreateTickCommand_attachTick=Attach Tick
+CreateTickCommand_CreateTick=Create Tick
+CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler=Create Free Time Ruler
+CustomTimingDiagramCreationEditPolicy_CreateInteraction=Create Interaction
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
new file mode 100644
index 00000000000..995ad070342
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateInvariantUtils;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * Used to get and set the name of a StateInvariant when editing a StateInvariant's label (this gets and sets the body
+ * in the OpaqueExpression of the Constraint of the StateInvariant)
+ */
+public class CompactStateInvariantNameParser implements ISemanticParser {
+
+ public String getEditString(final IAdaptable adaptable, final int flags) {
+ final StateInvariant stateInvariant = getStateInvariant(adaptable);
+ final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
+ if (name == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return name;
+ }
+
+ public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
+ final StateInvariant stateInvariant = getStateInvariant(adaptable);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return new AbstractTransactionalCommand(editingDomain, Messages.CompactStateInvariantNameParser_SetStateInvariantName, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // set the name on the Constraint and OpaqueExpression
+ StateInvariantUtils.setInnerStateInvariantName(stateInvariant, newString);
+ // set the name directly on the StateInvariant (note that this triggers a refresh of the label)
+ stateInvariant.setName(newString);
+ for (final Lifeline coveredLifeline : stateInvariant.getCovereds()) {
+ LifelineUtils.updateFragmentNames(coveredLifeline, null);
+ // XXX what if the StateInvariant appears both on a compact and on a full lifeline?
+ StateDefinitionUtils.updateStateDefinitionNamesForCompactLifeline(coveredLifeline);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ private static StateInvariant getStateInvariant(final IAdaptable adaptable) {
+ return (StateInvariant) adaptable.getAdapter(EObject.class);
+ }
+
+ public String getPrintString(final IAdaptable adaptable, final int flags) {
+ final StateInvariant stateInvariant = getStateInvariant(adaptable);
+ final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
+ if (name == null || name.length() == 0) {
+ return Messages.CompactStateInvariantNameParser_Unnamed;
+ }
+ return name;
+ }
+
+ public boolean isAffectingEvent(final Object event, final int flags) {
+ return true;
+ }
+
+ public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
+ return null;
+ }
+
+ public List<?> getSemanticElementsBeingParsed(final EObject element) {
+ final List<EObject> list = new ArrayList<EObject>();
+ if (element instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant) element;
+ final Constraint invariant = stateInvariant.getInvariant();
+ if (invariant != null) {
+ final ValueSpecification specification = invariant.getSpecification();
+ if (specification != null) {
+ list.add(specification);
+ }
+ }
+ }
+ return list;
+ }
+
+ public boolean areSemanticElementsAffected(final EObject listener, final Object notification) {
+ final EStructuralFeature feature = EcoreUtils.getEStructuralFeature(notification);
+ return UMLPackage.eINSTANCE.getStateInvariant_Invariant().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature)
+ || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
new file mode 100644
index 00000000000..8a84c116423
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Duration;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationInterval;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.TimeConstraint;
+import org.eclipse.uml2.uml.TimeExpression;
+import org.eclipse.uml2.uml.TimeInterval;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/** A parser for {@link TimeConstraint}s and {@link DurationConstraint}s */
+public class ConstraintParser implements ISemanticParser {
+
+ private static final String ERROR = "<error>"; //$NON-NLS-1$
+ private static final Pattern pattern = Pattern.compile("\\{(.*?)\\.\\.(.*?)\\}"); //$NON-NLS-1$
+
+ private class MinMax {
+ LiteralString min;
+ LiteralString max;
+
+ public MinMax(final LiteralString min, final LiteralString max) {
+ this.min = min;
+ this.max = max;
+ }
+
+ public LiteralString getMin() {
+ return this.min;
+ }
+
+ public LiteralString getMax() {
+ return this.max;
+ }
+ }
+
+ public String getPrintString(final IAdaptable element, final int flags) {
+ return getEditString(element, flags);
+ }
+
+ public String getEditString(final IAdaptable element, final int flags) {
+ final Constraint constraint = doAdapt(element);
+ final MinMax minMax = getMinMax(constraint);
+ if (minMax == null) {
+ return ERROR;
+ }
+ return getMinMaxLabel(minMax);
+ }
+
+ protected static String getMinMaxLabel(final MinMax minMax) {
+ return "{" + minMax.getMin().stringValue() + ".." + minMax.getMax().stringValue() + "}";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ public ICommand getParseCommand(final IAdaptable element, final String newString, final int flags) {
+ final Constraint constraint = doAdapt(element);
+ final MinMax minMax = getMinMax(constraint);
+ if (minMax == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final Matcher matcher = ConstraintParser.pattern.matcher(newString);
+ if (matcher.matches()) {
+ final String min = matcher.group(1);
+ final String max = matcher.group(2);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint);
+ return createSetMinMaxCommand(constraint, minMax, min, max, editingDomain);
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ private MinMax getMinMax(final Constraint constraint) {
+ if (constraint == null) {
+ return null;
+ }
+ final ValueSpecification specification = constraint.getSpecification();
+ if (specification instanceof TimeInterval) {
+ return getTimeIntervalMinMax((TimeInterval) specification);
+ } else if (specification instanceof DurationInterval) {
+ return getDurationIntervalMinMax((DurationInterval) specification);
+ }
+
+ return null;
+ }
+
+ private MinMax getTimeIntervalMinMax(final TimeInterval timeInterval) {
+ final ValueSpecification min = timeInterval.getMin();
+ final ValueSpecification max = timeInterval.getMax();
+
+ if (!(min instanceof TimeExpression) || !(max instanceof TimeExpression)) {
+ return null;
+ }
+
+ final TimeExpression minTime = (TimeExpression) min;
+ final TimeExpression maxTime = (TimeExpression) max;
+
+ final ValueSpecification minValue = minTime.getExpr();
+ final ValueSpecification maxValue = maxTime.getExpr();
+ if (!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
+ return null;
+ }
+
+ final LiteralString minStr = (LiteralString) minValue;
+ final LiteralString maxStr = (LiteralString) maxValue;
+
+ return new MinMax(minStr, maxStr);
+ }
+
+ private MinMax getDurationIntervalMinMax(final DurationInterval durationInterval) {
+ final ValueSpecification min = durationInterval.getMin();
+ final ValueSpecification max = durationInterval.getMax();
+
+ if (!(min instanceof Duration) || !(max instanceof Duration)) {
+ return null;
+ }
+
+ final Duration minDuration = (Duration) min;
+ final Duration maxDuration = (Duration) max;
+
+ final ValueSpecification minValue = minDuration.getExpr();
+ final ValueSpecification maxValue = maxDuration.getExpr();
+ if (!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
+ return null;
+ }
+
+ final LiteralString minStr = (LiteralString) minValue;
+ final LiteralString maxStr = (LiteralString) maxValue;
+
+ return new MinMax(minStr, maxStr);
+ }
+
+ public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ private static ICommand createSetMinMaxCommand(final Constraint constraint, final MinMax minMax, final String min, final String max,
+ final TransactionalEditingDomain editingDomain) {
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return new AbstractTransactionalCommand(editingDomain, Messages.ConstraintParser_SetConstraint, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ minMax.getMin().setValue(min);
+ minMax.getMax().setValue(max);
+ // setting this label is more user-friendly and it makes the label refresh since
+ // we are changing a direct property of the semantic element
+ constraint.setName(getMinMaxLabel(minMax));
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ /**
+ * Obtain the constraint element from the adaptable.
+ *
+ * @param element
+ * the given IAdaptable
+ * @return the constraint or null if it can't be found.
+ */
+ protected static Constraint doAdapt(final IAdaptable element) {
+ final Object obj = element.getAdapter(EObject.class);
+ if (obj instanceof Constraint) {
+ return (Constraint) obj;
+ }
+ return null;
+ }
+
+ public boolean isAffectingEvent(final Object event, final int flags) {
+ return true;
+ }
+
+ public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
+ return null;
+ }
+
+ public List<?> getSemanticElementsBeingParsed(final EObject element) {
+ final List<EObject> list = new ArrayList<EObject>();
+ if (element instanceof Constraint) {
+ final Constraint constraint = (Constraint) element;
+ final MinMax minMax = getMinMax(constraint);
+ if (minMax != null) {
+ list.add(minMax.getMin());
+ list.add(minMax.getMax());
+ }
+ }
+ return list;
+ }
+
+ public boolean areSemanticElementsAffected(final EObject listener, final Object notification) {
+ final EStructuralFeature feature = EcoreUtils.getEStructuralFeature(notification);
+ return UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
new file mode 100644
index 00000000000..b791193fd39
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+/**
+ * Used to get and set the name of an OccurrenceSpecification. An OccurrenceSpecification has a default name that
+ * indicates what state transition it represents (when the OccurrenceSpecification is a state change). Changing the name
+ * of such an OccurrenceSpecification removes the "autogenerated name" EAnnotation.
+ */
+public class OccurrenceSpecificationNameParser implements IParser {
+
+ public String getEditString(final IAdaptable adaptable, final int flags) {
+ final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
+ if (occurrenceSpecification == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return nonNullString(occurrenceSpecification.getName());
+ }
+
+ public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
+ final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
+ if (occurrenceSpecification == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification);
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return new AbstractTransactionalCommand(editingDomain, Messages.OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ occurrenceSpecification.setName(newString);
+ OccurrenceSpecificationUtils.setAutogeneratedName(occurrenceSpecification, false);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ public String getPrintString(final IAdaptable adaptable, final int flags) {
+ final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
+ if (occurrenceSpecification == null || OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
+ // don't display the auto-generated name (pollutes the view without any benefit)
+ return ""; //$NON-NLS-1$
+ }
+ return occurrenceSpecification.getName();
+ }
+
+ public boolean isAffectingEvent(final Object event, final int flags) {
+ return true;
+ }
+
+ public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
+ return null;
+ }
+
+ private static OccurrenceSpecification getOccurrenceSpecification(final IAdaptable adaptable) {
+ final Object adapter = adaptable.getAdapter(EObject.class);
+ if (adapter instanceof OccurrenceSpecification) {
+ return (OccurrenceSpecification) adapter;
+ }
+ return null;
+ }
+
+ private static String nonNullString(final String string) {
+ if (string == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return string;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
new file mode 100644
index 00000000000..dc14e4ac885
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.StateDefinitionUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.uml2.uml.Lifeline;
+
+/** Used to get and set the name of a StateDefinition when editing a StateDefinition's label */
+public class StateDefinitionParser implements IParser {
+
+ public String getEditString(final IAdaptable adaptable, final int flags) {
+ final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
+ final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
+ final String name = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
+ if (name == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return name;
+ }
+
+ public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
+ final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
+ final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
+ final View lifelineView = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineEditPartCN.VISUAL_ID);
+ final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ return new AbstractTransactionalCommand(editingDomain, Messages.StateDefinitionParser_SetStateDefinitionName, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, newString);
+ LifelineUtils.updateFragmentNames(lifeline, lifelineView);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ public String getPrintString(final IAdaptable adaptable, final int flags) {
+ final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
+ final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
+ final String name = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
+ if (name == null || name.length() == 0) {
+ return Messages.StateDefinitionParser_Unnamed;
+ }
+ return name;
+ }
+
+ public boolean isAffectingEvent(final Object event, final int flags) {
+ return true;
+ }
+
+ public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java
new file mode 100644
index 00000000000..ca40a1332c5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/TickParser.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parsers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+
+/** Dummy parser; only present because the gmfgen generation fails otherwise. */
+public class TickParser implements IParser {
+
+ public String getEditString(final IAdaptable element, final int flags) {
+ throw new UnsupportedOperationException();
+ }
+
+ public IParserEditStatus isValidEditString(final IAdaptable element, final String editString) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ICommand getParseCommand(final IAdaptable element, final String newString, final int flags) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPrintString(final IAdaptable element, final int flags) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAffectingEvent(final Object event, final int flags) {
+ throw new UnsupportedOperationException();
+ }
+
+ public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
new file mode 100644
index 00000000000..4f60487d5e5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.draw2d.Cursors;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.ui.PlatformUI;
+
+/** This tool allows clicking on a first Node then on a second Node to create some kind of element linked to those Nodes */
+public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedTypeCreationTool {
+
+ /** The tool is in this state after clicking on the start element of the duration */
+ private static final int STATE_FIRST = 1 << 16;
+ /** A request parameter that indicates the first clicked element */
+ public final static String FIRST_TARGET = "FIRST_TARGET"; //$NON-NLS-1$
+ /** A request parameter that indicates the second clicked element */
+ public final static String SECOND_TARGET = "SECOND_TARGET"; //$NON-NLS-1$
+
+ protected EditPart first = null;
+ protected EditPart second = null;
+
+ public AbstractTwoPointCreationTool(final IElementType elementType) {
+ super(Collections.singletonList(elementType));
+ setDefaultCursor(Cursors.CROSS);
+ setDisabledCursor(Cursors.NO);
+ }
+
+ @Override
+ public void activate() {
+ super.activate();
+ this.first = null;
+ this.second = null;
+ started();
+ }
+
+ @Override
+ public void deactivate() {
+ super.deactivate();
+ setStatusMessage(null);
+ }
+
+ @Override
+ protected boolean handleButtonDown(final int button) {
+ if (button != 1) {
+ setState(STATE_INVALID);
+ handleInvalidInput();
+ }
+
+ final Command command = getCommand();
+ final EditPart targetEditPart = getTargetEditPart();
+
+ if (isInState(STATE_INITIAL) && command.canExecute()) {
+ this.first = targetEditPart;
+ setState(STATE_FIRST);
+ // make it possible to double-click so that the first and second elements are the same
+ handleMove();
+ firstElementSelected();
+ } else if (isInState(STATE_FIRST) && command.canExecute()) {
+ this.second = targetEditPart;
+ eraseTargetFeedback();
+ // update the request and command with the second edit part
+ setTargetRequest(createTargetRequest());
+ setCurrentCommand(getCommand());
+ performCreation(button);
+ handleFinished();
+ setState(STATE_TERMINAL);
+ }
+ return true;
+ }
+
+ @Override
+ protected Request createTargetRequest() {
+ final CreateAspectUnspecifiedTypeRequest request = new CreateAspectUnspecifiedTypeRequest(getElementTypes(), getPreferencesHint()) {
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void createRequests() {
+ final IElementType elementType = (IElementType) getElementTypes().get(0);
+ // set the first and second edit parts on the CreateElementRequest that will be received
+ // by the create command
+ final CreateElementRequest createElementRequest = new CreateElementRequest(elementType);
+ createElementRequest.setParameter(FIRST_TARGET, AbstractTwoPointCreationTool.this.first);
+ createElementRequest.setParameter(SECOND_TARGET, AbstractTwoPointCreationTool.this.second);
+
+ final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(createElementRequest), Node.class,
+ getGraphicalHint((IHintedType) elementType), getPreferencesHint());
+ final Request request = new CreateViewAndElementRequest(viewDescriptor);
+ request.setExtendedData(getExtendedData());
+ request.setType(getType());
+ this.requests.put(elementType, request);
+ }
+ };
+ @SuppressWarnings("unchecked")
+ final Map<Object, Object> extendedData = request.getExtendedData();
+ extendedData.put(FIRST_TARGET, this.first);
+ extendedData.put(SECOND_TARGET, this.second);
+ return request;
+ }
+
+ @Override
+ protected void updateTargetRequest() {
+ final CreateRequest createRequest = getCreateRequest();
+ createRequest.setSize(null);
+ createRequest.setLocation(getLocation());
+ createRequest.setSnapToEnabled(false);
+ }
+
+ @Override
+ protected boolean handleButtonUp(final int button) {
+ return false;
+ }
+
+ @Override
+ protected boolean handleDrag() {
+ return false;
+ }
+
+ @Override
+ protected boolean handleDragStarted() {
+ return false;
+ }
+
+ @Override
+ protected boolean handleDragInProgress() {
+ return false;
+ }
+
+ @Override
+ protected Command getCommand() {
+ final Request request = getTargetRequest();
+ final EditPart firstTarget;
+ final EditPart secondTarget;
+ if (isInState(STATE_INITIAL)) {
+ firstTarget = getTargetEditPart();
+ secondTarget = null;
+ } else {
+ firstTarget = this.first;
+ secondTarget = getTargetEditPart();
+ }
+
+ if (!validateFirstTarget(firstTarget)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ if (isInState(STATE_INITIAL)) {
+ // dummy executable command (to accept a creation in progress)
+ return new Command() {
+ @Override
+ public void execute() {
+ throw new IllegalStateException("This dummy command must never be executed"); //$NON-NLS-1$
+ }
+ };
+ }
+
+ if (!validateSecondTarget(firstTarget, secondTarget)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return getCommand(firstTarget, secondTarget, request);
+ }
+
+ /**
+ * Return the creation command that should be executed after clicking the second node.
+ *
+ * @param firstTarget
+ * the first node that was clicked
+ * @param secondTarget
+ * the second node that was clicked
+ * @param request
+ * the request for which a creation command should be returned
+ * @return the creation command
+ */
+ protected abstract Command getCommand(EditPart firstTarget, EditPart secondTarget, Request request);
+
+ /**
+ * Validate the first selection
+ *
+ * @param firstTarget
+ * the first selected element
+ * @return whether the first selected element is valid
+ */
+ protected abstract boolean validateFirstTarget(final EditPart firstTarget);
+
+ /**
+ * Validate the second selection
+ *
+ * @param firstTarget
+ * the first selected element
+ * @param secondTarget
+ * the second selected element
+ * @return whether the second selected element is valid
+ */
+ protected abstract boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget);
+
+ /** Called when the tool is activated */
+ protected abstract void started();
+
+ /** Called after the first element was selected */
+ protected abstract void firstElementSelected();
+
+ /**
+ * Set a help message in the status bar.
+ *
+ * @param message
+ * a message that should help the user using the tool
+ */
+ protected static void setStatusMessage(final String message) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars().getStatusLineManager()
+ .setMessage(message);
+ }
+
+ /** Does the View for the first EditPart appear before the View for the second EditPart in their container? */
+ protected static boolean ordered(final EditPart first, final EditPart second) {
+ if (!(first.getModel() instanceof View) || !(second.getModel() instanceof View)) {
+ return false;
+ }
+ final View firstView = (View) first.getModel();
+ final View secondView = (View) second.getModel();
+ if (firstView.eContainer() != secondView.eContainer()) {
+ return false;
+ }
+ final View compartment = (View) firstView.eContainer();
+ final int firstIndex = compartment.getChildren().indexOf(firstView);
+ final int secondIndex = compartment.getChildren().indexOf(secondView);
+ return firstIndex <= secondIndex;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
new file mode 100644
index 00000000000..768a2653d5a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
@@ -0,0 +1,309 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.FigureUtils;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLPaletteFactory;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class CustomPaletteFactory extends UMLPaletteFactory {
+ private final static String CREATEOCCURRENCESPECIFICATIONCREATIONTOOL = "createOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
+ private final static String CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL = "createDestructionOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
+ private final static String CREATESTATEDEFINITIONCREATIONTOOL = "createStateDefinitionCreationTool"; //$NON-NLS-1$
+ private final static String CREATEMESSAGESYNCCREATIONTOOL = "createMessageSyncCreationTool"; //$NON-NLS-1$
+ private final static String CREATEMESSAGEASYNCCREATIONTOOL = "createMessageAsyncCreationTool"; //$NON-NLS-1$
+ private final static String CREATEMESSAGEREPLYCREATIONTOOL = "createMessageReplyCreationTool"; //$NON-NLS-1$
+ private final static String CREATECREATEMESSAGECREATIONTOOL = "createCreateMessageCreationTool"; //$NON-NLS-1$
+ private final static String CREATEDELETEMESSAGECREATIONTOOL = "createDeleteMessageCreationTool"; //$NON-NLS-1$
+ private final static String CREATELOSTMESSAGECREATIONTOOL = "createLostMessageCreationTool"; //$NON-NLS-1$
+ private final static String CREATEFOUNDMESSAGECREATIONTOOL = "createFoundMessageCreationTool"; //$NON-NLS-1$
+ private final static String CREATETIMEOBSERVATIONCREATIONTOOL = "createTimeObservationCreationTool"; //$NON-NLS-1$
+ private final static String CREATETIMECONSTRAINTCREATIONTOOL = "createTimeConstraintCreationTool"; //$NON-NLS-1$
+ private final static String CREATEDURATIONOBSERVATIONCREATIONTOOL = "createDurationObservationCreationTool"; //$NON-NLS-1$
+ private final static String CREATEDURATIONCONSTRAINTCREATIONTOOL = "createDurationConstraintCreationTool"; //$NON-NLS-1$
+ private final static String CREATEGENERALORDERINGCREATIONTOOL = "createGeneralOrderingCreationTool"; //$NON-NLS-1$
+
+ public final static String ORIGINAL_TARGET = "ORIGINAL_TARGET"; //$NON-NLS-1$
+
+ @Override
+ public Tool createTool(final String toolId) {
+ if (toolId.equals(CREATEOCCURRENCESPECIFICATIONCREATIONTOOL)) {
+ return createOccurrenceSpecificationCreationTool();
+ } else if (toolId.equals(CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL)) {
+ return createDestructionOccurrenceSpecificationCreationTool();
+ } else if (toolId.equals(CREATESTATEDEFINITIONCREATIONTOOL)) {
+ return createStateDefinitionCreationTool();
+ } else if (toolId.equals(CREATEMESSAGESYNCCREATIONTOOL)) {
+ return createSyncMessageCreationTool();
+ } else if (toolId.equals(CREATEMESSAGEASYNCCREATIONTOOL)) {
+ return createAsyncMessageCreationTool();
+ } else if (toolId.equals(CREATEMESSAGEREPLYCREATIONTOOL)) {
+ return createReplyMessageCreationTool();
+ } else if (toolId.equals(CREATECREATEMESSAGECREATIONTOOL)) {
+ return createCreateMessageCreationTool();
+ } else if (toolId.equals(CREATEDELETEMESSAGECREATIONTOOL)) {
+ return createDeleteMessageCreationTool();
+ } else if (toolId.equals(CREATELOSTMESSAGECREATIONTOOL)) {
+ return createLostMessageCreationTool();
+ } else if (toolId.equals(CREATEFOUNDMESSAGECREATIONTOOL)) {
+ return createFoundMessageCreationTool();
+ } else if (toolId.equals(CREATETIMEOBSERVATIONCREATIONTOOL)) {
+ return createTimeObservationCreationTool();
+ } else if (toolId.equals(CREATETIMECONSTRAINTCREATIONTOOL)) {
+ return createTimeConstraintCreationTool();
+ } else if (toolId.equals(CREATEDURATIONOBSERVATIONCREATIONTOOL)) {
+ return createDurationObservationCreationTool();
+ } else if (toolId.equals(CREATEDURATIONCONSTRAINTCREATIONTOOL)) {
+ return createDurationConstraintCreationTool();
+ } else if (toolId.equals(CREATEGENERALORDERINGCREATIONTOOL)) {
+ return createNewGeneralOrderingCreationTool();
+ }
+ return super.createTool(toolId);
+ }
+
+ private static Tool createTimeObservationCreationTool() {
+ return createNewTimeTool(UMLElementTypes.TimeObservation_16);
+ }
+
+ private static Tool createTimeConstraintCreationTool() {
+ return createNewTimeTool(UMLElementTypes.TimeConstraint_15);
+ }
+
+ private static Tool createDurationObservationCreationTool() {
+ return createNewDurationTool(UMLElementTypes.DurationObservation_17);
+ }
+
+ private static Tool createDurationConstraintCreationTool() {
+ return createNewDurationTool(UMLElementTypes.DurationConstraint_18);
+ }
+
+ private static Tool createNewTimeTool(final IElementType elementType) {
+ return new AspectUnspecifiedTypeCreationTool(Collections.singletonList(elementType)) {
+ /**
+ * Redirect the creation request to the parent (Lifeline compartment), but keep the original target in the
+ * extended data for the creation command.
+ */
+ @Override
+ protected Command getCommand() {
+ EditPart target = getTargetEditPart();
+ final Request request = getTargetRequest();
+ if (target != null
+ && EditPartUtils.isEditPartFor(target, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
+ @SuppressWarnings("unchecked")
+ final Map<Object, Object> extendedData = request.getExtendedData();
+ extendedData.put(ORIGINAL_TARGET, target);
+ target = target.getParent();
+ return target.getCommand(request);
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+ };
+ }
+
+ private static Tool createNewDurationTool(final IElementType elementType) {
+ return new DurationCreationTool(elementType);
+ }
+
+ private static Tool createOccurrenceSpecificationCreationTool() {
+ return new OccurrenceSpecificationCreationTool();
+ }
+
+ private static Tool createDestructionOccurrenceSpecificationCreationTool() {
+ return new DestructionOccurrenceSpecificationCreationTool();
+ }
+
+ private static Tool createNewGeneralOrderingCreationTool() {
+ return new GeneralOrderingCreationTool();
+ }
+
+ /** Overloaded to only let StateDefinitions be created in the StateDefinition compartment. */
+ private static Tool createStateDefinitionCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Node_9);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types) {
+ @Override
+ protected Command getCommand() {
+ if (!(getTargetEditPart() instanceof FullLifelineStateDefinitionCompartmentEditPartCN)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return super.getCommand();
+ }
+ };
+ return tool;
+ }
+
+ private static Tool createSyncMessageCreationTool() {
+ return new SpecificTypeCreationTool(UMLElementTypes.Message_3, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
+ }
+
+ private static Tool createAsyncMessageCreationTool() {
+ return new SpecificTypeCreationTool(UMLElementTypes.Message_4, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
+ }
+
+ private static Tool createReplyMessageCreationTool() {
+ return new SpecificTypeCreationTool(UMLElementTypes.Message_41, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
+ }
+
+ private static Tool createCreateMessageCreationTool() {
+ return new SpecificTypeCreationTool(UMLElementTypes.Message_44, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
+ }
+
+ private static Tool createDeleteMessageCreationTool() {
+ return new SpecificTypeCreationTool(UMLElementTypes.Message_47, MessageUtils.getAllowedMessageTargets(), MessageUtils.getAllowedMessageTargets());
+ }
+
+ private static Tool createLostMessageCreationTool() {
+ return new AspectUnspecifiedTypeConnectionTool(Collections.singletonList(UMLElementTypes.Message_50)) {
+ @Override
+ protected Command getCommand() {
+ final Object type = getTargetRequest().getType();
+ if (RequestConstants.REQ_CONNECTION_END == type) {
+ final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest) getTargetRequest();
+ final EditPart sourceEditPart = request.getSourceEditPart();
+
+ // Note: the bounds must be computed before executing the command because the source may be an
+ // OccurrenceSpecification that will get swapped to a MessageOccurrenceSpecification, thereby
+ // changing the Figure and EditPart.
+ final IFigure figure = ((GraphicalEditPart) sourceEditPart).getFigure();
+ final Point figureLocation = new Point(figure.getBounds().getCenter());
+ figure.getParent().translateToAbsolute(figureLocation);
+ final Point location = request.getLocation();
+ final double scale = FigureUtils.getScale(figure);
+ final Point anchorLocation = new Point(location.x - figureLocation.x, location.y - figureLocation.y).scale(1.0 / scale);
+
+ final Command superCommand = super.getCommand();
+ final CompoundCommand compoundCommand = new CompoundCommand();
+ compoundCommand.add(superCommand);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(sourceEditPart.getModel());
+
+ // add a command that sets the initial anchor position using an EAnnotation
+ compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetLostMessageOrigin,
+ null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final Connector connector = findCreatedConnector(superCommand);
+ MessageUtils.setMessageConnectorLocation(connector, anchorLocation);
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+ return compoundCommand;
+ }
+ return super.getCommand();
+ }
+ };
+ }
+
+ private static Tool createFoundMessageCreationTool() {
+ return new AspectUnspecifiedTypeConnectionTool(Collections.singletonList(UMLElementTypes.Message_53)) {
+ @Override
+ protected Command getCommand() {
+ final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest) getTargetRequest();
+ final EditPart targetEditPart = request.getTargetEditPart();
+
+ final Object type = getTargetRequest().getType();
+ if (RequestConstants.REQ_CONNECTION_START == type) {
+ MessageUtils.saveRequestStartLocation(request);
+ }
+
+ if (RequestConstants.REQ_CONNECTION_END == type) {
+ final Point startLocation = MessageUtils.retrieveRequestStartLocation(request);
+
+ // Note: the bounds must be computed before executing the command because the source may be an
+ // OccurrenceSpecification that will get swapped to a MessageOccurrenceSpecification, thereby
+ // changing the Figure and EditPart.
+ final IFigure figure = ((GraphicalEditPart) targetEditPart).getFigure();
+ final Point figureLocation = new Point(figure.getBounds().getCenter());
+ figure.getParent().translateToAbsolute(figureLocation);
+ final double scale = FigureUtils.getScale(figure);
+ final Point anchorLocation = new Point(startLocation.x - figureLocation.x, startLocation.y - figureLocation.y).scale(1.0 / scale);
+
+ final Command superCommand = super.getCommand();
+ final CompoundCommand compoundCommand = new CompoundCommand();
+ compoundCommand.add(superCommand);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(targetEditPart.getModel());
+
+ // add a command that sets the initial anchor position using an EAnnotation
+ compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetFoundMessageTarget,
+ null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final Connector connector = findCreatedConnector(superCommand);
+ MessageUtils.setMessageConnectorLocation(connector, anchorLocation);
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+ return compoundCommand;
+ }
+ return super.getCommand();
+ }
+ };
+ }
+
+ /** Find the Connector in the haystack (buried deep in a CommandResult within the command). */
+ protected static Connector findCreatedConnector(final Command command) {
+ if (command instanceof ICommandProxy) {
+ final ICommandProxy commandProxy = (ICommandProxy) command;
+ final ICommand iCommand = commandProxy.getICommand();
+ final CommandResult commandResult = iCommand.getCommandResult();
+ final Object returnValue = commandResult.getReturnValue();
+ if (returnValue instanceof List<?>) {
+ final List<?> resultList = (List<?>) returnValue;
+ for (final Object resultElement : resultList) {
+ if (resultElement instanceof ConnectionViewAndElementDescriptor) {
+ final ConnectionViewAndElementDescriptor connectionViewAndElementDescriptor = (ConnectionViewAndElementDescriptor) resultElement;
+ final View view = (View) connectionViewAndElementDescriptor.getAdapter(View.class);
+ if (view instanceof Connector) {
+ final Connector connector = (Connector) view;
+ return connector;
+ }
+ }
+ }
+ }
+ }
+ throw new IllegalStateException("connector not found"); //$NON-NLS-1$
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
new file mode 100644
index 00000000000..fa23f53c96c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import org.eclipse.draw2d.Cursors;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCommand;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCompactLifelineCommand;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * Creating an OccurrenceSpecification means cutting a StateInvariant in two, and inserting the OccurrenceSpecification
+ * in-between (and adding a VerticalLine View).
+ */
+public class DestructionOccurrenceSpecificationCreationTool extends CreationTool {
+
+ public DestructionOccurrenceSpecificationCreationTool() {
+ super(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ setDefaultCursor(Cursors.CROSS);
+ setDisabledCursor(Cursors.NO);
+ }
+
+ @Override
+ protected Command getCommand() {
+ final EditPart targetEditPart = getTargetEditPart();
+ final CompositeCommand compositeCommand = new CompositeCommand(
+ Messages.DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification);
+ EditPart timeline;
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN) targetEditPart;
+ timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(fullStateInvariantEditPartCN, getLocation(), true));
+ } else if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN) targetEditPart;
+ timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ compositeCommand.add(new CutAndInsertOccurrenceSpecificationCompactLifelineCommand(compactStateInvariantEditPartCN, getLocation(), true));
+ } else {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final Command updateLayoutCommand = timeline.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
+ compositeCommand.add(new CommandProxy(updateLayoutCommand));
+ return new ICommandProxy(compositeCommand);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
new file mode 100644
index 00000000000..91a28227ca5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class DurationCreationTool extends AbstractTwoPointCreationTool {
+
+ public DurationCreationTool(final IElementType elementType) {
+ super(elementType);
+ }
+
+ @Override
+ protected boolean validateFirstTarget(final EditPart firstTarget) {
+ return firstTarget != null
+ && EditPartUtils.isEditPartFor(firstTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant());
+ }
+
+ @Override
+ protected boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget) {
+ if (secondTarget == null
+ || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
+ return false;
+ }
+ return ordered(firstTarget, secondTarget);
+ }
+
+ /** Redirect the creation request to the parent (Lifeline compartment) */
+ @Override
+ protected Command getCommand(final EditPart firstTarget, final EditPart secondTarget, final Request request) {
+ return secondTarget.getParent().getCommand(request);
+ }
+
+ @Override
+ protected void started() {
+ setStatusMessage(Messages.DurationCreationTool_ClickStartElement);
+
+ }
+
+ @Override
+ protected void firstElementSelected() {
+ setStatusMessage(Messages.DurationCreationTool_ClickEndElement);
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java
new file mode 100644
index 00000000000..b1b5ea96f77
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.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.parts;
+
+import org.eclipse.draw2d.ConnectionAnchorBase;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
+
+/**
+ * This is an anchor for either a lost or found Message. It floats on a Lifeline, and is not actually attached to
+ * anything, because a lost message doesn't have a target, and a found message doesn't have a source. So this anchor
+ * gets its relative location from an EAnnotation stored on the Connector.
+ */
+public class FloatingMessageAnchor extends ConnectionAnchorBase {
+ private final ConnectionEditPart connectionEditPart;
+ private final Point defaultOffset;
+
+ public FloatingMessageAnchor(final ConnectionEditPart connEditPart, final Point defaultOffset) {
+ this.connectionEditPart = connEditPart;
+ this.defaultOffset = defaultOffset;
+ }
+
+ public Point getReferencePoint() {
+ return new Point(0, 0);
+ }
+
+ public IFigure getOwner() {
+ return null;
+ }
+
+ public Point getLocation(final Point reference) {
+ final Point point = MessageUtils.getMessageConnectorLocation(this.connectionEditPart);
+ if (point != null) {
+ return new Point(reference.x + point.x, reference.y + point.y);
+ }
+ return new Point(reference.x + this.defaultOffset.x, reference.y + this.defaultOffset.y);
+ }
+} \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java
new file mode 100644
index 00000000000..0aa648b9642
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.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.parts;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class GeneralOrderingCreationTool extends AbstractTwoPointCreationTool {
+
+ public GeneralOrderingCreationTool() {
+ super(UMLElementTypes.GeneralOrdering_67);
+ }
+
+ @Override
+ protected boolean validateFirstTarget(final EditPart firstTarget) {
+ return firstTarget != null && EditPartUtils.isEditPartFor(firstTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification());
+ }
+
+ @Override
+ protected boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget) {
+ if (secondTarget == null || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ return false;
+ }
+ return ordered(firstTarget, secondTarget);
+ }
+
+ /** Redirect the creation request to the parent (Lifeline compartment) */
+ @Override
+ protected Command getCommand(final EditPart firstTarget, final EditPart secondTarget, final Request request) {
+ return secondTarget.getParent().getCommand(request);
+ }
+
+ @Override
+ protected void started() {
+ setStatusMessage(Messages.GeneralOrderingCreationTool_ClickBefore);
+ }
+
+ @Override
+ protected void firstElementSelected() {
+ setStatusMessage(Messages.GeneralOrderingCreationTool_ClickAfter);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java
new file mode 100644
index 00000000000..ff01e4d430a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/NoScrollNoBorderDragEditPartsTracker.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.papyrus.uml.diagram.common.dragtracker.NoScrollDragEditPartsTrackerEx;
+
+public class NoScrollNoBorderDragEditPartsTracker extends NoScrollDragEditPartsTrackerEx {
+
+ public NoScrollNoBorderDragEditPartsTracker(final EditPart sourceEditPart) {
+ super(sourceEditPart);
+ setBorder(0);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
new file mode 100644
index 00000000000..527cd94994b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import org.eclipse.draw2d.Cursors;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.AddOccurrenceSpecificationInCompactLifelineCommand;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CutAndInsertOccurrenceSpecificationCommand;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * Creating an OccurrenceSpecification means cutting a StateInvariant in two, and inserting the OccurrenceSpecification
+ * in-between (and adding a VerticalLine View).
+ */
+public class OccurrenceSpecificationCreationTool extends CreationTool {
+
+ public OccurrenceSpecificationCreationTool() {
+ super(UMLElementTypes.OccurrenceSpecification_12);
+ setDefaultCursor(Cursors.CROSS);
+ setDisabledCursor(Cursors.NO);
+ }
+
+ @Override
+ protected Command getCommand() {
+ final EditPart targetEditPart = getTargetEditPart();
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification);
+ EditPart timeline;
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN) targetEditPart;
+ timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(fullStateInvariantEditPartCN, getLocation(), false));
+ } else if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN) targetEditPart;
+ timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ compositeCommand.add(new AddOccurrenceSpecificationInCompactLifelineCommand(compactStateInvariantEditPartCN, getLocation()));
+ } else {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final Command updateLayoutCommand = timeline.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST);
+ compositeCommand.add(new CommandProxy(updateLayoutCommand));
+ return new ICommandProxy(compositeCommand);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java
new file mode 100644
index 00000000000..0aa144c31b8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.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.parts;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+
+public class PropertyDiagramUpdater implements ICustomDiagramUpdater {
+
+ public List<?> getSemanticChildren(final View view) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static List<UMLNodeDescriptor> getLifelineFullLifelineTimelineCompartment_8SemanticChildren(final View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ final View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ final Lifeline modelElement = (Lifeline) containerView.getElement();
+ final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+
+ if ((modelElement).getCoveredBys().size() > 0) {
+ final Interaction interaction = modelElement.getInteraction();
+
+ for (final Object element : interaction.getFragments()) {
+
+ final InteractionFragment childElement = (InteractionFragment) element;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == FullStateInvariantEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ }
+
+ if ((modelElement).getCoveredBys().size() > 0) {
+ final Interaction interaction = modelElement.getInteraction();
+
+ for (final Object element : interaction.getOwnedRules()) {
+ final Constraint childElement = (Constraint) element;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == DurationConstraintEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DurationObservationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ }
+ return result;
+ }
+
+ public static List<UMLNodeDescriptor> createLifelineCompactLifelineCompartment_23Children(final View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ final View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ final Lifeline modelElement = (Lifeline) containerView.getElement();
+ final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+
+ if ((modelElement).getCoveredBys().size() > 0) {
+ final Interaction interaction = modelElement.getInteraction();
+
+ for (final Object element : interaction.getFragments()) {
+
+ final InteractionFragment childElement = (InteractionFragment) element;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CompactStateInvariantEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ }
+
+ if ((modelElement).getCoveredBys().size() > 0) {
+ final Interaction interaction = modelElement.getInteraction();
+
+ for (final Object element : interaction.getOwnedRules()) {
+ final Constraint childElement = (Constraint) element;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == DurationConstraintEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DurationObservationEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
new file mode 100644
index 00000000000..49ec232aeaa
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.parts;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+
+/** A creation tool that only allows creating connections between specific types. */
+public class SpecificTypeCreationTool extends AspectUnspecifiedTypeConnectionTool {
+ private final Collection<EClass> sourceTypes;
+ private final Collection<EClass> targetTypes;
+
+ /**
+ * @param connectionTypeToCreate
+ * the element type of the connection to create
+ * @param sourceTypes
+ * the connection will only be allowed if the source is of one of these types
+ * @param targetTypes
+ * the connection will only be allowed if the target is of one of these types
+ */
+ public SpecificTypeCreationTool(final IElementType connectionTypeToCreate, final Collection<EClass> sourceTypes, final Collection<EClass> targetTypes) {
+ super(Collections.singletonList(connectionTypeToCreate));
+ this.sourceTypes = sourceTypes;
+ this.targetTypes = targetTypes;
+ }
+
+ @Override
+ protected Command getCommand() {
+ final EditPart targetEditPart = getTargetEditPart();
+ EObject element = null;
+ if (targetEditPart != null && targetEditPart.getModel() instanceof View) {
+ element = ((View) targetEditPart.getModel()).getElement();
+ }
+
+ // only allow creating a connection that starts from the sourceType
+ if (isInState(STATE_INITIAL)) {
+ if (!isOfType(element, this.sourceTypes)) {
+ return null;
+ }
+ }
+
+ // only allow creating a connection that goes to the targetType
+ if (isInState(STATE_CONNECTION_STARTED) || isInState(STATE_TERMINAL)) {
+ if (!isOfType(element, this.targetTypes)) {
+ return null;
+ }
+ }
+ return super.getCommand();
+ }
+
+ private static boolean isOfType(final EObject element, final Collection<EClass> types) {
+ for (final EClass eClass : types) {
+ if (eClass.isInstance(element)) {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java
new file mode 100644
index 00000000000..b26e7cebb35
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.providers;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypeMultilinePropertyEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+
+/**
+ * this is an editpolicy provider in charge to install a policy to create a AssociationClass
+ *
+ * @author Patrick Tessier
+ */
+public class CustomEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void createEditPolicies(final EditPart editPart) {
+ if (!(editPart instanceof AppliedStereotypeMultilinePropertyEditPart)) {
+ // editPart.installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
+ if (editPart instanceof IPrimaryEditPart) {
+ // if (EMFHelper.getEObject(editPart) != null) {
+ // editPart.installEditPolicy(AppliedStereotypeCommentCreationEditPolicy.APPLIED_STEREOTYPE_COMMENT,
+ // new AppliedStereotypeCommentCreationEditPolicy());
+ // }
+
+ if (!(editPart instanceof ConnectionEditPart)) {
+ // editPart.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
+ }
+ }
+ if (editPart instanceof NamedElementEditPart) {
+ editPart.installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
+ }
+ }
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public boolean provides(final IOperation operation) {
+ final CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
+ return false;
+ }
+
+ final EditPart gep = epOperation.getEditPart();
+ final String diagramType = ((View) gep.getModel()).getDiagram().getType();
+ if (!TimingDiagramEditPart.MODEL_ID.equals(diagramType)) {
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.java
new file mode 100644
index 00000000000..4414fbf478d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomUMLEditPartProvider.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.providers;
+
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomUMLEditPartFactory;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLEditPartProvider;
+
+public class CustomUMLEditPartProvider extends UMLEditPartProvider {
+
+ public CustomUMLEditPartProvider() {
+ setFactory(new CustomUMLEditPartFactory());
+ setAllowCaching(true);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java
new file mode 100644
index 00000000000..3896319ebd0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.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
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.providers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.RestrictedAbstractEditPartProvider;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypeConpartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypeMultilinePropertyEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypePropertyEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypesCommentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AppliedStereotypesCommentLinkEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+
+public class StereotypePropertiesEditPartProvider extends RestrictedAbstractEditPartProvider {
+
+ /** Map containing node view types supported by this provider */
+ protected Map<String, Class<?>> nodeMap = new HashMap<String, Class<?>>();
+
+ /** Map containing edge view types supported by this provider */
+ protected Map<String, Class<?>> edgeMap = new HashMap<String, Class<?>>();
+
+ /** Default constructor */
+ public StereotypePropertiesEditPartProvider() {
+ super();
+
+ this.diagramType = TimingDiagramEditPart.MODEL_ID;
+
+ this.nodeMap.put(AppliedStereotypeConpartmentEditPart.ID, AppliedStereotypeConpartmentEditPart.class);
+ this.nodeMap.put(AppliedStereotypePropertyEditPart.ID, AppliedStereotypeMultilinePropertyEditPart.class);
+ this.nodeMap.put(AppliedStereotypesCommentEditPart.ID, AppliedStereotypesCommentEditPart.class);
+ this.edgeMap.put(AppliedStereotypesCommentLinkEditPart.ID, AppliedStereotypesCommentLinkEditPart.class);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean provides(final IOperation operation) {
+ if (operation instanceof CreateGraphicEditPartOperation) {
+ final View newView = ((IEditPartOperation) operation).getView();
+ if (newView == null) {
+ return false;
+ }
+
+ final String graphicalType = newView.getType();
+
+ if ((newView instanceof Node) && (!this.nodeMap.containsKey(graphicalType))) {
+ return false;
+ }
+
+ if ((newView instanceof Edge) && (!this.edgeMap.containsKey(graphicalType))) {
+ return false;
+ }
+ }
+
+ return super.provides(operation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getNodeEditPartClass(final View view) {
+ return this.nodeMap.get(view.getType());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<?> getEdgeEditPartClass(final View view) {
+ return this.edgeMap.get(view.getType());
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
new file mode 100644
index 00000000000..43ba86f4579
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
+
+public final class Constants {
+ private Constants() {
+ // not instantiable
+ }
+
+ /**
+ * The minimum distance between the center of two occurrence specifications (to avoid indistinguishable overlapping
+ * figures)
+ */
+ public static final int MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS = 4;
+
+ public static final int MARGIN_BETWEEN_LIFELINES = 8;
+ public static final int TIME_RULER_HEIGHT = 30;
+ public static final int STATE_DEFINITIONS_WIDTH = 100;
+
+ public static final String fullStateInvariantId = Integer.toString(FullStateInvariantEditPartCN.VISUAL_ID);
+ public static final String compactStateInvariantId = Integer.toString(CompactStateInvariantEditPartCN.VISUAL_ID);
+ public static final String verticalLineId = Integer.toString(FullStateInvariantVerticalLineEditPart.VISUAL_ID);
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
new file mode 100644
index 00000000000..b582ce4c60b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.AbstractTimelineLayoutPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.Gate;
+import org.eclipse.uml2.uml.GeneralOrdering;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.MessageKind;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.TimeConstraint;
+import org.eclipse.uml2.uml.TimeObservation;
+
+public final class DropUtils {
+
+ private DropUtils() {
+ // utility class
+ }
+
+ public static ICommand getDropMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
+ if (message.getMessageKind() == MessageKind.LOST_LITERAL) {
+ return getDropLostMessageCommand(message, dropTarget, viewer);
+ }
+ if (message.getMessageKind() == MessageKind.FOUND_LITERAL) {
+ return getDropFoundMessageCommand(message, dropTarget, viewer);
+ }
+
+ final MessageEnd sendEvent = message.getSendEvent();
+ final MessageEnd receiveEvent = message.getReceiveEvent();
+ if (sendEvent == null || receiveEvent == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ final List<View> sourceViews = new ArrayList<View>(CrossReferencerUtil.getCrossReferencingViews(sendEvent, TimingDiagramEditPart.MODEL_ID));
+ final List<View> targetViews = new ArrayList<View>(CrossReferencerUtil.getCrossReferencingViews(receiveEvent, TimingDiagramEditPart.MODEL_ID));
+
+ // Messages can only be created between MessageEnds
+ filterMessageSourceOrTargetViews(sourceViews);
+ filterMessageSourceOrTargetViews(targetViews);
+
+ if (sourceViews.size() != 1 || targetViews.size() != 1) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final View sourceView = sourceViews.get(0);
+ final View targetView = targetViews.get(0);
+
+ if (sourceView == null || sourceView.getDiagram() == null || targetView == null || targetView.getDiagram() == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
+ // the drop must be targeted inside the interaction
+ if (interactionView == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // the source and target views must be inside the interaction view
+ if (!ViewUtils.isContained(sourceView, interactionView) || !ViewUtils.isContained(targetView, interactionView)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // don't allow multiple Views for the same Message in the same Diagram
+ if (ViewUtils.containsConnectorFor(dropTarget, message)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // create the connection for the existing message, from the sourceView to the targetView
+ return createMessageConnectionView(message, viewer, sourceView, targetView);
+ }
+
+ private static ICommand getDropLostMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
+ final MessageEnd sendEvent = message.getSendEvent();
+ if (sendEvent == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return getDropLostOrFoundMessage(message, dropTarget, viewer, sendEvent);
+ }
+
+ private static ICommand getDropFoundMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
+ final MessageEnd receiveEvent = message.getReceiveEvent();
+ if (receiveEvent == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return getDropLostOrFoundMessage(message, dropTarget, viewer, receiveEvent);
+ }
+
+ private static ICommand getDropLostOrFoundMessage(final Message message, final View dropTarget, final EditPartViewer viewer, final MessageEnd endEvent) {
+ final List<View> endViews = DiagramEditPartsUtil.findViews(endEvent, viewer);
+ filterMessageSourceOrTargetViews(endViews);
+ if (endViews.size() != 1) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final View endView = endViews.get(0);
+ final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
+ View lifelineView = ViewUtils.findSuperViewWithId(endView, FullLifelineEditPartCN.VISUAL_ID);
+ if (lifelineView == null) {
+ lifelineView = ViewUtils.findSuperViewWithId(endView, CompactLifelineEditPartCN.VISUAL_ID);
+ }
+ if (interactionView == null || lifelineView == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ if (!ViewUtils.isContained(endView, interactionView)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ if (ViewUtils.containsConnectorFor(dropTarget, message)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // create the connection for the lost message, from the endView to the lifelineView
+ if (message.getMessageKind() == MessageKind.LOST_LITERAL) {
+ return createMessageConnectionView(message, viewer, endView, lifelineView);
+ }
+ // create the connection for the found message, from the lifelineView to the endView
+ return createMessageConnectionView(message, viewer, lifelineView, endView);
+ }
+
+ private static ICommand createMessageConnectionView(final Message message, final EditPartViewer viewer, final View sourceView, final View targetView) {
+ final IElementType elementType = MessageUtils.getElementType(message);
+ final String semanticHint = ((IHintedType) elementType).getSemanticHint();
+ final ConnectionViewDescriptor connectionViewDescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(elementType, semanticHint,
+ ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ final IAdaptable sourceViewAdapter = new EObjectAdapter(sourceView);
+ final IAdaptable targetViewAdapter = new EObjectAdapter(targetView);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(message);
+ final CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(editingDomain,
+ semanticHint, sourceViewAdapter, targetViewAdapter, viewer, PreferencesHint.USE_DEFAULTS, connectionViewDescriptor, null);
+ createConnectionViewCommand.setElement(message);
+ return createConnectionViewCommand;
+ }
+
+ private static void filterMessageSourceOrTargetViews(final List<View> views) {
+ final ListIterator<View> listIterator = views.listIterator();
+ while (listIterator.hasNext()) {
+ final View view = listIterator.next();
+ final int visualID = UMLVisualIDRegistry.getVisualID(view);
+ if (!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) && visualID != GateEditPart.VISUAL_ID) {
+ listIterator.remove();
+ }
+ }
+ }
+
+ private interface IDropLinkedNodeInLifelineAction<T extends EObject> {
+ void drop(T element, View compartmentView);
+ }
+
+ public static ICommand getDropLinkedNodeInLifelineCommand(final EObject droppedElement, final Collection<EObject> linkedElements, final View dropTarget,
+ final EditPartViewer viewer, final IDropLinkedNodeInLifelineAction<? extends EObject> dropAction) {
+ final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
+ // the drop must be targeted inside the interaction
+ if (interactionView == null || ViewUtils.containsViewFor(interactionView, droppedElement)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ final Set<View> targetLifelines = new HashSet<View>();
+ for (final EObject eObject : linkedElements) {
+ if (eObject instanceof InteractionFragment) {
+ final InteractionFragment interactionFragment = (InteractionFragment) eObject;
+ final EList<Lifeline> covereds = interactionFragment.getCovereds();
+ for (final Lifeline lifeline : covereds) {
+ final List<View> lifelineViews = DiagramEditPartsUtil.findViews(lifeline, viewer);
+ for (final View lifelineView : lifelineViews) {
+ if (LifelineUtils.isLifelineView(lifelineView) && ViewUtils.isContained(lifelineView, interactionView)) {
+ targetLifelines.add(lifelineView);
+ }
+ }
+ }
+ }
+ }
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interactionView);
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.DropUtils_DropElement);
+
+ compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.DropUtils_DropElement, null) {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ for (final View targetLifeline : targetLifelines) {
+ final View compartmentView = ViewUtils.findChildTimelineCompartmentView(targetLifeline);
+ ((IDropLinkedNodeInLifelineAction<EObject>) dropAction).drop(droppedElement, compartmentView);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ });
+
+ // add command to layout the new Node
+ for (final View targetLifeline : targetLifelines) {
+ final EditPart lifelineEditPart = (EditPart) viewer.getEditPartRegistry().get(targetLifeline);
+ final EditPart compartmentEditPart = LifelineUtils.getLifelineCompartment(lifelineEditPart);
+ compositeCommand.add(new CommandProxy(compartmentEditPart.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST)));
+ }
+
+ return compositeCommand;
+ }
+
+ protected static class DropTimeObservationAction implements IDropLinkedNodeInLifelineAction<TimeObservation> {
+ public void drop(final TimeObservation timeObservation, final View compartmentView) {
+ final Node timeObservationNode = new UMLViewProvider().createTimeObservation_16(timeObservation, compartmentView, ViewUtil.APPEND, true,
+ PreferencesHint.USE_DEFAULTS);
+ if (timeObservationNode != null) {
+ final Location loc = NotationFactory.eINSTANCE.createLocation();
+ loc.setX(0);
+ loc.setY(40);
+ timeObservationNode.setLayoutConstraint(loc);
+ }
+ }
+ }
+
+ public static ICommand getDropTimeObservationCommand(final TimeObservation timeObservation, final View dropTarget, final EditPartViewer viewer) {
+ final NamedElement event = timeObservation.getEvent();
+ return getDropLinkedNodeInLifelineCommand(timeObservation, Collections.<EObject> singletonList(event), dropTarget, viewer,
+ new DropTimeObservationAction());
+ }
+
+ protected static class DropTimeConstraintAction implements IDropLinkedNodeInLifelineAction<TimeConstraint> {
+ public void drop(final TimeConstraint timeConstraint, final View compartmentView) {
+ final Node timeConstraintNode = new UMLViewProvider().createTimeConstraint_15(timeConstraint, compartmentView, ViewUtil.APPEND, true,
+ PreferencesHint.USE_DEFAULTS);
+ if (timeConstraintNode != null) {
+ final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
+ bounds.setY(40);
+ timeConstraintNode.setLayoutConstraint(bounds);
+ }
+ }
+ }
+
+ public static ICommand getDropTimeConstraintCommand(final TimeConstraint timeConstraint, final View dropTarget, final EditPartViewer viewer) {
+ final Collection<EObject> linkedElements = new ArrayList<EObject>();
+ linkedElements.addAll(timeConstraint.getConstrainedElements());
+ return getDropLinkedNodeInLifelineCommand(timeConstraint, linkedElements, dropTarget, viewer, new DropTimeConstraintAction());
+ }
+
+ protected static class DropDurationObservationAction implements IDropLinkedNodeInLifelineAction<DurationObservation> {
+ public void drop(final DurationObservation durationObservation, final View compartmentView) {
+ final Node durationObservationNode = new UMLViewProvider().createDurationObservation_17(durationObservation, compartmentView, ViewUtil.APPEND,
+ true, PreferencesHint.USE_DEFAULTS);
+ if (durationObservationNode != null) {
+ final Location loc = NotationFactory.eINSTANCE.createLocation();
+ loc.setX(0);
+ loc.setY(40);
+ durationObservationNode.setLayoutConstraint(loc);
+ }
+ }
+ }
+
+ public static ICommand getDropDurationObservationCommand(final DurationObservation durationObservation, final View dropTarget, final EditPartViewer viewer) {
+ final Collection<EObject> linkedElements = new ArrayList<EObject>();
+ linkedElements.addAll(durationObservation.getEvents());
+ return getDropLinkedNodeInLifelineCommand(durationObservation, linkedElements, dropTarget, viewer, new DropDurationObservationAction());
+ }
+
+ protected static class DropDurationConstraintAction implements IDropLinkedNodeInLifelineAction<DurationConstraint> {
+ public void drop(final DurationConstraint durationConstraint, final View compartmentView) {
+ final Node durationConstraintNode = new UMLViewProvider().createDurationConstraint_18(durationConstraint, compartmentView, ViewUtil.APPEND, true,
+ PreferencesHint.USE_DEFAULTS);
+ if (durationConstraintNode != null) {
+ final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
+ bounds.setY(5);
+ durationConstraintNode.setLayoutConstraint(bounds);
+ }
+ }
+ }
+
+ public static ICommand getDropDurationConstraintCommand(final DurationConstraint durationConstraint, final View dropTarget, final EditPartViewer viewer) {
+ final Collection<EObject> linkedElements = new ArrayList<EObject>();
+ linkedElements.addAll(durationConstraint.getConstrainedElements());
+ return getDropLinkedNodeInLifelineCommand(durationConstraint, linkedElements, dropTarget, viewer, new DropDurationConstraintAction());
+ }
+
+ protected static class DropGeneralOrderingAction implements IDropLinkedNodeInLifelineAction<GeneralOrdering> {
+ public void drop(final GeneralOrdering generalOrdering, final View compartmentView) {
+ final Node generalOrderingNode = new UMLViewProvider().createGeneralOrdering_67(generalOrdering, compartmentView, ViewUtil.APPEND, true,
+ PreferencesHint.USE_DEFAULTS);
+ if (generalOrderingNode != null) {
+ final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
+ bounds.setY(30);
+ generalOrderingNode.setLayoutConstraint(bounds);
+ }
+ }
+ }
+
+ public static ICommand getDropGeneralOrderingCommand(final GeneralOrdering generalOrdering, final View dropTarget, final EditPartViewer viewer) {
+ final Collection<EObject> linkedElements = new ArrayList<EObject>();
+ linkedElements.add(generalOrdering.getBefore());
+ linkedElements.add(generalOrdering.getAfter());
+ return getDropLinkedNodeInLifelineCommand(generalOrdering, linkedElements, dropTarget, viewer, new DropGeneralOrderingAction());
+ }
+
+ public static ICommand getDropGateCommand(final Gate gate, final View dropTarget, final EditPartViewer viewer) {
+ final Node interactionView = (Node) ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
+ // the drop must be targeted on the interaction
+ if (interactionView == null || ViewUtils.containsViewFor(interactionView, gate)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interactionView);
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.DropUtils_DropGate);
+ compositeCommand.add(new CommandProxy(new RefreshCommandForUndo((GraphicalEditPart) viewer.getRootEditPart())));
+ compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.DropUtils_DropGate, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final Node gateNode = new UMLViewProvider().createGate_69(gate, interactionView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ try {
+ final int index = ((Interaction) gate.eContainer()).getFormalGates().indexOf(gate);
+ final Location loc = NotationFactory.eINSTANCE.createLocation();
+ // space Gates regularly (useful when dropping several Gates)
+ loc.setX(-10);
+ loc.setY(30 + index * 20);
+ gateNode.setLayoutConstraint(loc);
+ } catch (final Exception e) {
+ Activator.log.error("Couldn't layout dropped Gates", e); //$NON-NLS-1$
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ });
+ compositeCommand.add(new CommandProxy(new RefreshCommandForDo((GraphicalEditPart) viewer.getRootEditPart())));
+
+ return compositeCommand;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
new file mode 100644
index 00000000000..cbc930b3f5c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public final class EcoreUtils {
+ private EcoreUtils() {
+ // utility class
+ }
+
+ /**
+ * Replace an EObject instance by another compatible EObject instance (replacement must be either the same type, or
+ * a subtype of original).
+ *
+ * @param original
+ * the object to replace
+ * @param replacement
+ * the replacement object
+ */
+ public static void replaceEObjectInstance(final EObject original, final EObject replacement) {
+ final Collection<Setting> settings = EcoreUtil.UsageCrossReferencer.find(original, original.eResource().getResourceSet());
+
+ final Set<EStructuralFeature> referencingFeatures = new HashSet<EStructuralFeature>();
+ for (final Setting setting : settings) {
+ referencingFeatures.add(setting.getEStructuralFeature());
+ }
+
+ // copy all the features of the original object to the replacement object
+ copyFeatures(original, replacement, referencingFeatures);
+
+ // put the replacement object in all the referencing features of the original object
+ for (final Setting setting : settings) {
+ final EStructuralFeature feature = setting.getEStructuralFeature();
+ if (feature.isChangeable() && !feature.isDerived()) {
+ // if it is already in the list, remove it and put it at the right index
+ EcoreUtil.remove(setting, replacement);
+ // replace the original by the replacement
+ EcoreUtil.replace(setting, original, replacement);
+ }
+ }
+
+ // change the container
+ EcoreUtil.replace(original, replacement);
+ }
+
+ /**
+ * Copies all the features from the source object to the target object, ignoring the referencingFeatures
+ *
+ * @param source
+ * the object that will give its values to the target object
+ * @param target
+ * the object that will receive its values from the source object
+ * @param referencingFeatures
+ * features to ignore in the copy
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private static void copyFeatures(final EObject source, final EObject target, final Set<EStructuralFeature> referencingFeatures) {
+ final EList<EStructuralFeature> eAllStructuralFeatures = source.eClass().getEAllStructuralFeatures();
+
+ for (final EStructuralFeature feature : eAllStructuralFeatures) {
+ if (referencingFeatures.contains(feature)) {
+ // the value will be set through the object referencing the "from" object
+ continue;
+ }
+ if (feature instanceof EReference) {
+ final EReference reference = (EReference) feature;
+ if (reference.isContainer()) {
+ // the container will be set at the end
+ continue;
+ }
+ }
+ if (feature.isChangeable() && !feature.isDerived()) {
+ if (feature.isMany()) {
+ final Object result = source.eGet(feature);
+ if (result instanceof List<?>) {
+ final List list1 = (List) result;
+ final List list2 = (List) target.eGet(feature);
+ list2.addAll(list1);
+ }
+ } else {
+ final Object value = source.eGet(feature);
+ target.eSet(feature, value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the first element in the container hierarchy of the given element that is of the given class.
+ *
+ * @param element
+ * the starting point
+ * @param clazz
+ * the class of the parent that is searched
+ * @return the first containing element of the given class, or <code>null</code> if none
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getContaining(final EObject element, final Class<T> clazz) {
+ EObject container = element;
+ while (container != null) {
+ if (clazz.isInstance(container)) {
+ return (T) container;
+ }
+ container = container.eContainer();
+ }
+ return null;
+ }
+
+ public static EStructuralFeature getEStructuralFeature(final Object notification) {
+ EStructuralFeature featureImpl = null;
+ if (notification instanceof Notification) {
+ final Object feature = ((Notification) notification).getFeature();
+ if (feature instanceof EStructuralFeature) {
+ featureImpl = (EStructuralFeature) feature;
+ }
+ }
+ return featureImpl;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java
new file mode 100644
index 00000000000..207f59a0415
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.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.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+
+public class EditPartUtils {
+
+ public static EditPart findFirstChildEditPartWithId(final EditPart editPart, final int visualId) {
+ final List<? extends EditPart> result = findChildEditPartsWithId(editPart, visualId);
+ if (result.isEmpty()) {
+ return null;
+ }
+ return result.get(0);
+ }
+
+ public static List<? extends EditPart> findChildEditPartsWithId(final EditPart editPart, final int visualId) {
+ final List<EditPart> editParts = new ArrayList<EditPart>();
+ internalFindChildEditPartsWithId(editPart, visualId, editParts);
+ return editParts;
+ }
+
+ private static void internalFindChildEditPartsWithId(final EditPart editPart, final int visualId, final List<EditPart> result) {
+ final Object model = editPart.getModel();
+ if (model instanceof View) {
+ final View view = (View) model;
+ if (UMLVisualIDRegistry.getVisualID(view) == visualId) {
+ result.add(editPart);
+ }
+ }
+ @SuppressWarnings("unchecked")
+ final List<EditPart> children = editPart.getChildren();
+ for (final EditPart child : children) {
+ internalFindChildEditPartsWithId(child, visualId, result);
+ }
+ }
+
+ public static EditPart findParentEditPartWithId(final EditPart editPart, final int visualId) {
+ EditPart parent = editPart;
+ while (parent != null) {
+ final Object model = parent.getModel();
+ if (model instanceof View) {
+ final View parentView = (View) model;
+ if (UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
+ return parent;
+ }
+ parent = parent.getParent();
+ } else {
+ break;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Find the EditPart whose Figure is closest to the given y-coordinate.
+ *
+ * @param ordinate
+ * the y-coordinate
+ * @param editParts
+ * the EditParts among which to choose
+ * @return the EditPart closest to the given vertical coordinate
+ */
+ public static GraphicalEditPart findEditPartClosestToOrdinate(final int ordinate, final List<? extends GraphicalEditPart> editParts) {
+ if (editParts.isEmpty()) {
+ return null;
+ }
+
+ final TreeMap<Integer, GraphicalEditPart> distanceMap = new TreeMap<Integer, GraphicalEditPart>();
+ for (final GraphicalEditPart editPart : editParts) {
+ final IFigure figure = editPart.getFigure();
+ final Rectangle bounds = new Rectangle(figure.getBounds());
+ figure.getParent().translateToAbsolute(bounds);
+ final int posY = bounds.y + bounds.height / 2;
+ final int distance = Math.abs(posY - ordinate);
+ distanceMap.put(Integer.valueOf(distance), editPart);
+ }
+ final Entry<Integer, GraphicalEditPart> firstEntry = distanceMap.firstEntry();
+ return firstEntry.getValue();
+ }
+
+ public static boolean isEditPartFor(final EditPart editPart, final EClass... eClasses) {
+ final Object model = editPart.getModel();
+ if (model instanceof View) {
+ final View view = (View) model;
+ return ViewUtils.isViewFor(view, eClasses);
+ }
+ return false;
+ }
+
+ public static CompartmentEditPart findParentTimelineCompartment(final EditPart editPart) {
+ CompartmentEditPart compartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN) EditPartUtils.findParentEditPartWithId(editPart,
+ FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ if (compartmentEditPart == null) {
+ compartmentEditPart = (CompactLifelineCompartmentEditPartCN) EditPartUtils.findParentEditPartWithId(editPart,
+ CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ }
+ return compartmentEditPart;
+ }
+
+ /** Reveals the given EditPart in its viewer */
+ public static void revealEditPart(final EditPart editPart) {
+ if (editPart != null && editPart.getViewer() != null) {
+ editPart.getViewer().reveal(editPart);
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
new file mode 100644
index 00000000000..a62097cf2ca
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
@@ -0,0 +1,149 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LayeredPane;
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+
+public final class FigureUtils {
+
+ private FigureUtils() {
+ // utility class
+ }
+
+ /**
+ * Returns a child figure of the given type recursively contained in the given parent figure.
+ *
+ * @param parent
+ * the parent figure
+ * @param childFigureClass
+ * the type of the child figure that is looked for
+ * @return the child figure if found, or <code>null</code> if the parent figure contains no child figure of the
+ * given type
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends IFigure> T findChildFigureInstance(final IFigure parent, final Class<T> childFigureClass) {
+ final List<IFigure> children = parent.getChildren();
+ for (final IFigure child : children) {
+ if (childFigureClass.isAssignableFrom(child.getClass())) {
+ return (T) child;
+ }
+ // look recursively
+ final IFigure subresult = findChildFigureInstance(child, childFigureClass);
+ if (subresult != null) {
+ return (T) subresult;
+ }
+ }
+ // not found
+ return null;
+ }
+
+ public static <T extends IFigure> List<T> findChildFigureInstances(final IFigure parent, final Class<T> childFigureClass) {
+ final List<T> result = new ArrayList<T>();
+ internalFindChildFigureInstances(parent, result, childFigureClass);
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends IFigure> void internalFindChildFigureInstances(final IFigure parent, final List<T> result, final Class<T> childFigureClass) {
+ final List<IFigure> children = parent.getChildren();
+ for (final IFigure child : children) {
+ if (childFigureClass.isAssignableFrom(child.getClass())) {
+ result.add((T) child);
+ } else {
+ internalFindChildFigureInstances(child, result, childFigureClass);
+ }
+
+ }
+ }
+
+ /**
+ * Returns the first parent figure of the given type recursively containing the given figure.
+ *
+ * @param figure
+ * the figure
+ * @param parentFigureClass
+ * the type of the parent figure that is looked for
+ * @return the parent figure if found, or <code>null</code> if the figure is not contained by any figure of the
+ * given type
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends IFigure> T findParentFigureInstance(final IFigure figure, final Class<T> parentFigureClass) {
+ IFigure parent = figure.getParent();
+ while (parent != null) {
+ if (parentFigureClass.isAssignableFrom(parent.getClass())) {
+ return (T) parent;
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * Constrain the given bounds (whose presumed purpose is to become the new bounds for the given Figure), so that
+ * they don't stick out of the bounds of the {@link ResizableCompartmentFigure} in which the given figure is
+ * contained. Returns the original bounds if the given Figure is not contained in a
+ * {@link ResizableCompartmentFigure}.
+ *
+ * @param bounds
+ * The bounds to constrain (will not be modified)
+ * @param figure
+ * the figure in the containing {@link ResizableCompartmentFigure} of which the bound must be constrained
+ * @return the bounds, constrained so that they don't stick out of the {@link ResizableCompartmentFigure} in which
+ * the Figure is contained
+ *
+ */
+ public static Rectangle constrainBoundsWithinContainingCompartment(final Rectangle bounds, final IFigure figure) {
+ final Rectangle result = new Rectangle(bounds);
+ final ResizableCompartmentFigure parentCompartment = FigureUtils.findParentFigureInstance(figure, ResizableCompartmentFigure.class);
+ if (parentCompartment == null) {
+ return result;
+ }
+ final Rectangle parentBounds = parentCompartment.getBounds();
+ result.x = Math.max(result.x, 0);
+ result.y = Math.max(result.y, 0);
+ result.x = Math.min(result.x, parentBounds.width - result.width);
+ result.y = Math.min(result.y, parentBounds.height - result.height);
+ return result;
+ }
+
+ /**
+ * @return The origin of the coordinate system applied to the given figure (i.e.: the amount scrolled in the scroll
+ * pane)
+ */
+ public static Point getLayeredPaneOrigin(final IFigure figure) {
+ final LayeredPane layeredPane = FigureUtils.findChildFigureInstance(FigureUtilities.getRoot(figure), LayeredPane.class);
+ final Point origin = new Point(0, 0);
+ layeredPane.translateToRelative(origin);
+ return origin;
+ }
+
+ /**
+ * @return The scale applied to the given figure (i.e.: the zoom set by the user)
+ */
+ public static double getScale(final IFigure figure) {
+ final ScalableFigure scalableFigure = FigureUtils.findParentFigureInstance(figure, ScalableFigure.class);
+ return scalableFigure.getScale();
+ }
+
+ public static Point scaleByZoom(final Point delta, final IFigure figure) {
+ return new Point(delta).scale(1.0 / getScale(figure));
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java
new file mode 100644
index 00000000000..e317c696b1c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.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.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.uml2.uml.Gate;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public final class GateUtils {
+
+ private GateUtils() {
+ // utility class
+ }
+
+ /**
+ * Get all elements to delete when deleting a Gate.
+ *
+ * @param gate
+ * the Gate being deleted
+ * @return the elements (EObjects and Views) that should be deleted together with the Gate
+ */
+ public static Collection<EObject> getElementsToDelete(final Gate gate) {
+ final Set<EObject> elementsToDestroy = new HashSet<EObject>();
+ final Collection<Setting> settings = EcoreUtil.UsageCrossReferencer.find(gate, gate.eResource().getResourceSet());
+ for (final Setting setting : settings) {
+ // delete messages originating from or going to that gate
+ if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_SendEvent()
+ || setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_ReceiveEvent()) {
+ elementsToDestroy.add(setting.getEObject());
+ }
+ }
+ return elementsToDestroy;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java
new file mode 100644
index 00000000000..1212eea38a7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.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.utils;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
+import org.eclipse.uml2.uml.GeneralOrdering;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public final class GeneralOrderingUtils {
+ private GeneralOrderingUtils() {
+ // utility class
+ }
+
+ public static boolean isGeneralOrderingEditPart(final int visualID) {
+ return visualID == GeneralOrderingEditPart.VISUAL_ID;
+ }
+
+ public static boolean isGeneralOrderingEditPart(final EditPart editPart) {
+ return editPart instanceof GeneralOrderingEditPart;
+ }
+
+ /**
+ * Find {@link GeneralOrdering}s linked to the given element.
+ *
+ * @param element
+ * the element for which related {@link GeneralOrdering}s must be found
+ * @param hideOnly
+ * whether to only return Views
+ * @param expectedParentView
+ * if not <code>null</code>, then only return Views under this parent View
+ * @return the list of linked {@link GeneralOrdering}s to remove
+ */
+ public static Collection<? extends EObject> getReferencingGeneralOrderingsToRemove(final EObject element, final boolean hideOnly,
+ final View expectedParentView) {
+ final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getGeneralOrdering_Before(), UMLPackage.eINSTANCE.getGeneralOrdering_After() };
+ final Class<?>[] expectedClasses = new Class<?>[] { GeneralOrdering.class };
+ return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
new file mode 100644
index 00000000000..47411ed8c7e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Interaction;
+
+/** Utility class for manipulating {@link Interaction}s */
+public final class InteractionUtils {
+
+ private InteractionUtils() {
+ // utility class
+ }
+
+ /**
+ * Return the {@link Interaction} containing the given model element if any, or <code>null</code> if the element is
+ * not recursively contained in any {@link Interaction}.
+ *
+ * @param eObject
+ * the model element for which we want to find the containing {@link Interaction}.
+ * @return the parent {@link Interaction} or <code>null</code> if none.
+ */
+ public static Interaction getContainingInteraction(final EObject eObject) {
+ if (eObject != null) {
+ if (eObject instanceof Interaction) {
+ return (Interaction) eObject;
+ }
+ final EObject eContainer = eObject.eContainer();
+ return getContainingInteraction(eContainer);
+ }
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
new file mode 100644
index 00000000000..b14d9b6e751
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
@@ -0,0 +1,268 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.StateInvariant;
+
+/** Utility class for manipulating {@link Lifeline}s */
+public final class LifelineUtils {
+
+ public enum LifelineType {
+ full, compact
+ }
+
+ /** The key for the EAnnotation on a Lifeline that indicates whether the Lifeline is a compact or full lifeline */
+ private static final String LIFELINE_ANNOTATION = "org.eclipse.papyrus.uml.diagram.timing.lifeline"; //$NON-NLS-1$
+ private static final String LIFELINE_TYPE = "type"; //$NON-NLS-1$
+
+ private LifelineUtils() {
+ // utility class
+ }
+
+ /**
+ * Get the type of the given lifeline
+ *
+ * @param lifeline
+ * the lifeline whose type to get
+ * @return the type
+ */
+ public static LifelineType getLifelineType(final Lifeline lifeline) {
+ final EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_ANNOTATION);
+ if (eAnnotation != null) {
+ final String type = eAnnotation.getDetails().get(LIFELINE_TYPE);
+ if (type != null) {
+ return LifelineType.valueOf(type);
+ }
+ }
+ // a non-annotated Lifeline is full by default
+ return LifelineType.full;
+ }
+
+ /**
+ * Set the type of the given lifeline (between compact and full) using an annotation. This is needed in order to let
+ * {@link UMLViewProvider} choose the right view depending on this annotation.
+ *
+ * @param lifeline
+ * the lifeline whose type to set
+ * @param lifelineType
+ * the type to set
+ */
+ public static void setLifelineType(final Lifeline lifeline, final LifelineType lifelineType) {
+ EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_ANNOTATION);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(LIFELINE_ANNOTATION);
+ lifeline.getEAnnotations().add(eAnnotation);
+ }
+ eAnnotation.getDetails().put(LIFELINE_TYPE, lifelineType.name());
+ }
+
+ /**
+ * Update the names of StateInvariants and OccurrenceSpecifications in the given Lifeline, so that StateInvariants
+ * have a number suffix to distinguish multiple occurrences of the same state, and OccurrenceSpecifications that
+ * indicate a state change have a name that indicates their incoming and outgoing state.
+ *
+ * @param lifeline
+ * the Lifeline to update
+ * @param lifelineView
+ * the Lifeline's view, containing the StateDefinitions (ignored for a Compact lifeline)
+ */
+ @SuppressWarnings("boxing")
+ public static void updateFragmentNames(final Lifeline lifeline, final View lifelineView) {
+ View fullLifelineView = lifelineView;
+ if (lifelineView != null && !Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
+ fullLifelineView = null;
+ }
+ final Map<String, Integer> stateInvariantCounts = new HashMap<String, Integer>();
+ final EList<InteractionFragment> fragments = lifeline.getCoveredBys();
+ final Map<StateInvariant, String> stateInvariantNames = new HashMap<StateInvariant, String>();
+
+ // first, handle StateInvariant names
+ for (int i = 0; i < fragments.size(); i++) {
+ final InteractionFragment interactionFragment = fragments.get(i);
+ if (interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ final String stateInvariantId = StateInvariantUtils.getStateInvariantId(stateInvariant);
+ final String baseStateInvariantName;
+ if (stateInvariantId != null && fullLifelineView != null) {
+ // in a full lifeline,
+ final View stateDefinitionView = StateDefinitionUtils.getStateDefinitionViewWithId(stateInvariantId, fullLifelineView);
+ baseStateInvariantName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
+ // update the StateInvariant name based on the corresponding StateDefinition name
+ StateInvariantUtils.setInnerStateInvariantName(stateInvariant, baseStateInvariantName);
+ } else {
+ baseStateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
+ }
+
+ if (baseStateInvariantName == null) {
+ continue;
+ }
+ Integer count = stateInvariantCounts.get(baseStateInvariantName);
+ if (count == null) {
+ count = 0;
+ }
+ count++;
+ // set the StateInvariant's name with its ordering number
+ final String stateInvariantName = baseStateInvariantName + "_" + count; //$NON-NLS-1$
+ stateInvariant.setName(stateInvariantName);
+ stateInvariantCounts.put(baseStateInvariantName, count);
+ stateInvariantNames.put(stateInvariant, stateInvariantName);
+ }
+ }
+
+ // then, handle OccurrenceSpecification names (since they depend on StateInvariant names)
+ // start at 1 and end at (size - 1) since we only care about OccurrenceSpecifications that
+ // appear between StateInvariants
+ final int nFragments = fragments.size();
+ for (int i = 0; i < nFragments; i++) {
+ final InteractionFragment interactionFragment = fragments.get(i);
+ if (interactionFragment instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) interactionFragment;
+ // don't override user modifications
+ if (!OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
+ continue;
+ }
+
+ if (i == 0) {
+ // first fragment is an occurrence => creation
+ occurrenceSpecification.setName(Messages.LifelineUtils_CreationOccurrence);
+ continue;
+ }
+ if (i == nFragments - 1) {
+ // last fragment is an occurrence => destruction
+ occurrenceSpecification.setName(Messages.LifelineUtils_DestructionOccurrence);
+ continue;
+ }
+
+ final InteractionFragment previous = fragments.get(i - 1);
+ final InteractionFragment next = fragments.get(i + 1);
+ if (!(previous instanceof StateInvariant) || !(next instanceof StateInvariant)) {
+ continue;
+ }
+ final StateInvariant precedingStateInvariant = (StateInvariant) previous;
+ final StateInvariant followingStateInvariant = (StateInvariant) next;
+ String previousName = stateInvariantNames.get(precedingStateInvariant);
+ String followingName = stateInvariantNames.get(followingStateInvariant);
+ if (previousName == null) {
+ previousName = "<unnamed>"; //$NON-NLS-1$
+ }
+ if (followingName == null) {
+ followingName = "<unnamed>"; //$NON-NLS-1$
+ }
+ occurrenceSpecification.setName(previousName + "_To_" + followingName); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Returns a command that updates fragment names for Lifeline Views contained by Views referencing the given
+ * element.
+ *
+ * @param element
+ * an element contained in a Lifeline
+ * @return a command to update the names of Lifeline fragments
+ */
+ public static IUndoableOperation getUpdateFragmentNamesCommand(final EObject element) {
+ final Set<View> impactedLifelines = new HashSet<View>();
+ final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(element, TimingDiagramEditPart.MODEL_ID);
+ for (final View referencingView : crossReferencingViews) {
+ View lifeline = ViewUtils.findSuperViewWithId(referencingView, FullLifelineEditPartCN.VISUAL_ID);
+ if (lifeline == null) {
+ lifeline = ViewUtils.findSuperViewWithId(referencingView, CompactLifelineEditPartCN.VISUAL_ID);
+ }
+ if (lifeline != null) {
+ impactedLifelines.add(lifeline);
+ }
+ }
+ if (impactedLifelines.isEmpty()) {
+ return null;
+ }
+
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.LifelineUtils_UpdateFragmentNames);
+ // update fragment names
+ for (final View lifelineView : impactedLifelines) {
+ Assert.isLegal(lifelineView.getElement() instanceof Lifeline);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifelineView);
+ compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.LifelineUtils_UpdateLifelineFragmentNames, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final EObject element = lifelineView.getElement();
+ // note: the element becomes the Interaction when the Lifeline is deleted
+ if (element instanceof Lifeline) {
+ final Lifeline lifeline = (Lifeline) element;
+ updateFragmentNames(lifeline, lifelineView);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ });
+ }
+ return compositeCommand;
+ }
+
+ public static boolean isLifelineEditPart(final int visualID) {
+ return visualID == FullLifelineEditPartCN.VISUAL_ID || visualID == CompactLifelineEditPartCN.VISUAL_ID;
+ }
+
+ public static boolean isLifelineEditPart(final EditPart editPart) {
+ return editPart instanceof FullLifelineEditPartCN || editPart instanceof CompactLifelineEditPartCN;
+ }
+
+ public static boolean isLifelineView(final View view) {
+ final int visualID = UMLVisualIDRegistry.getVisualID(view);
+ return isLifelineEditPart(visualID);
+ }
+
+ public static EditPart getLifelineCompartment(final EditPart lifelineEditPart) {
+ EditPart compartment;
+ if (lifelineEditPart instanceof FullLifelineEditPartCN) {
+ compartment = EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ } else {
+ compartment = EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ }
+ if (compartment == null) {
+ throw new IllegalStateException("No compartment in Lifeline"); //$NON-NLS-1$
+ }
+ return compartment;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
new file mode 100644
index 00000000000..28290d1f0ed
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
@@ -0,0 +1,339 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.LocationRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+import org.eclipse.uml2.uml.Gate;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.MessageKind;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.MessageSort;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public final class MessageUtils {
+
+ private static final String MESSAGE_CONNECTOR_LOCATION = "messageConnectorLocation"; //$NON-NLS-1$
+ private static final String START_LOCATION = "startLocation"; //$NON-NLS-1$
+ private static final String X = "x"; //$NON-NLS-1$
+ private static final String Y = "y"; //$NON-NLS-1$
+
+ /** Used for feedback when drawing a MessageFound */
+ public static Point lastStartLocation = new Point();
+
+ private MessageUtils() {
+ // utility class
+ }
+
+ public static boolean isMessage(final IElementType requestElementType) {
+ return requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4
+ || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44
+ || requestElementType == UMLElementTypes.Message_47 || requestElementType == UMLElementTypes.Message_50
+ || requestElementType == UMLElementTypes.Message_53;
+ }
+
+ public static boolean isMessage(final int visualID) {
+ return visualID == MessageSyncEditPart.VISUAL_ID || visualID == MessageAsyncEditPart.VISUAL_ID || visualID == MessageReplyEditPart.VISUAL_ID
+ || visualID == MessageCreateEditPart.VISUAL_ID || visualID == MessageDeleteEditPart.VISUAL_ID || visualID == MessageFoundEditPart.VISUAL_ID
+ || visualID == MessageLostEditPart.VISUAL_ID;
+ }
+
+ public static MessageKind getMessageKind(final IElementType requestElementType) {
+ if (requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4
+ || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44
+ || requestElementType == UMLElementTypes.Message_47) {
+ return MessageKind.UNKNOWN_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_50) {
+ return MessageKind.LOST_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_53) {
+ return MessageKind.FOUND_LITERAL;
+ }
+ return null;
+ }
+
+ public static MessageSort getMessageSort(final IElementType requestElementType) {
+ if (requestElementType == UMLElementTypes.Message_3) {
+ return MessageSort.SYNCH_CALL_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_4) {
+ return MessageSort.ASYNCH_CALL_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_41) {
+ return MessageSort.REPLY_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_44) {
+ return MessageSort.CREATE_MESSAGE_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_47) {
+ return MessageSort.DELETE_MESSAGE_LITERAL;
+ }
+ if (requestElementType == UMLElementTypes.Message_50 || requestElementType == UMLElementTypes.Message_53) {
+ // lost or found message
+ return MessageSort.SYNCH_CALL_LITERAL;
+ }
+ return null;
+ }
+
+ public static IElementType getElementType(final Message message) {
+ switch (message.getMessageKind()) {
+ case LOST_LITERAL:
+ return UMLElementTypes.Message_50;
+ case FOUND_LITERAL:
+ return UMLElementTypes.Message_53;
+ default:
+ }
+
+ switch (message.getMessageSort()) {
+ case SYNCH_CALL_LITERAL:
+ return UMLElementTypes.Message_3;
+ case ASYNCH_CALL_LITERAL:
+ return UMLElementTypes.Message_4;
+ case REPLY_LITERAL:
+ return UMLElementTypes.Message_41;
+ case CREATE_MESSAGE_LITERAL:
+ return UMLElementTypes.Message_44;
+ case DELETE_MESSAGE_LITERAL:
+ return UMLElementTypes.Message_47;
+ default:
+ throw new IllegalArgumentException("Unknown message type"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Create a command to move a FloatingMessageAnchor, by changing the EAnnotation stored on the Connector.
+ *
+ * @param request
+ * the request that contains the new Location
+ * @param connectionEditPart
+ * the EditPart for the connector
+ * @param referenceFigure
+ * the figure to which the anchor is relative
+ * @param commandName
+ * a name for the command
+ * @param editingDomain
+ * the editing domain
+ * @return the command to move the anchor
+ */
+ public static Command createMoveMessageAnchorCommand(final LocationRequest request, final ConnectionEditPart connectionEditPart,
+ final IFigure referenceFigure, final String commandName, final TransactionalEditingDomain editingDomain) {
+ final Connector connector = (Connector) connectionEditPart.getModel();
+ final Point location = request.getLocation();
+ final Point figureLocation = new Point(referenceFigure.getBounds().getCenter());
+ referenceFigure.getParent().translateToAbsolute(figureLocation);
+ final double scale = FigureUtils.getScale(connectionEditPart.getFigure());
+ final Point anchorLocation = new Point(location.x - figureLocation.x, location.y - figureLocation.y).scale(1.0 / scale);
+
+ final CompoundCommand compoundCommand = new CompoundCommand();
+ compoundCommand.add(new RefreshCommandForUndo(connectionEditPart));
+ compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, commandName, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ setMessageConnectorLocation(connector, anchorLocation);
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+ compoundCommand.add(new RefreshCommandForDo(connectionEditPart));
+ return compoundCommand;
+ }
+
+ public static void setMessageConnectorLocation(final Connector connector, final Point location) {
+ EAnnotation eAnnotation = connector.getEAnnotation(MESSAGE_CONNECTOR_LOCATION);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(MESSAGE_CONNECTOR_LOCATION);
+ connector.getEAnnotations().add(eAnnotation);
+ }
+ eAnnotation.getDetails().put(X, Integer.toString(location.x));
+ eAnnotation.getDetails().put(Y, Integer.toString(location.y));
+ }
+
+ public static Point getMessageConnectorLocation(final ConnectionEditPart connectionEditPart) {
+ final double scale = FigureUtils.getScale(connectionEditPart.getFigure());
+ final Connector connector = (Connector) connectionEditPart.getModel();
+ final EAnnotation eAnnotation = connector.getEAnnotation(MESSAGE_CONNECTOR_LOCATION);
+ if (eAnnotation != null) {
+ return new Point(Integer.parseInt(eAnnotation.getDetails().get(X)), Integer.parseInt(eAnnotation.getDetails().get(Y))).scale(scale);
+ }
+ return null;
+ }
+
+ public static void saveRequestStartLocation(final CreateRequest request) {
+ @SuppressWarnings("unchecked")
+ final Map<Object, Object> extendedData = request.getExtendedData();
+ final Point location = request.getLocation();
+ extendedData.put(START_LOCATION, location);
+ lastStartLocation = new Point(location);
+ }
+
+ public static Point retrieveRequestStartLocation(final CreateRequest request) {
+ @SuppressWarnings("unchecked")
+ final Map<Object, Object> extendedData = request.getExtendedData();
+ return (Point) extendedData.get(START_LOCATION);
+ }
+
+ public static Point getLastStartLocation() {
+ return lastStartLocation;
+ }
+
+ /**
+ * Find {@link Message}s linked to the given element.
+ *
+ * @param element
+ * the element for which related {@link Message}s must be found
+ * @param hideOnly
+ * whether to only return Views
+ * @param expectedParentView
+ * if not <code>null</code>, then only return Views under this parent View
+ * @return the list of linked {@link Message}s to remove
+ */
+ public static Collection<? extends EObject> getReferencingMessagesToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
+ final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
+ final Class<?>[] expectedClasses = new Class<?>[] { Message.class };
+ return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
+ }
+
+ /**
+ * Convert the given element to a MessageOccurrenceSpecification (or its subtype DestructionOccurrenceSpecification
+ * if <code>destruction</code> is <code>true</code>)
+ *
+ * @return the converted element, or <code>null</code> if the element is not an {@link OccurrenceSpecification}
+ */
+ public static MessageEnd convertToMessageOccurrenceSpecification(final EObject element, final boolean destruction) {
+ // destruction => DestructionOccurrenceSpecification
+ if (element instanceof MessageEnd && !destruction || element instanceof DestructionOccurrenceSpecification) {
+ return (MessageEnd) element;
+ }
+
+ if (element instanceof OccurrenceSpecification) {
+ // convert OccurrenceSpecification to MessageOccurrenceSpecification (or its subtype
+ // DestructionOccurrenceSpecification if destruction is true)
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) element;
+ final boolean autogeneratedName = OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification);
+ final Set<View> views = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
+
+ final MessageOccurrenceSpecification messageOccurrenceSpecification = destruction ? UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification()
+ : UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
+ // "autogenerated" EAnnotation is transferred on "do", but is lost on "redo" unless we set it explicitly
+ OccurrenceSpecificationUtils.setAutogeneratedName(messageOccurrenceSpecification, autogeneratedName);
+ EcoreUtils.replaceEObjectInstance(occurrenceSpecification, messageOccurrenceSpecification);
+
+ // update the type of each View (the element has already been updated at this point)
+ for (final View view : views) {
+ final int type = UMLVisualIDRegistry.getVisualID(view);
+ if (!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(type)) {
+ continue;
+ }
+
+ view.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID
+ : MessageOccurrenceSpecificationEditPartCN.VISUAL_ID));
+ /*
+ * The element must be updated manually here, because since BasicDecorationNodeImpl#getElement changes
+ * the element without changing the "set" flag, the UsageCrossReferencer used above doesn't consider the
+ * element reference (see Bug 394270 - BasicDecorationNodeImpl#getElement updates the element without
+ * marking it as set), and so doesn't find the child View
+ */
+ @SuppressWarnings("unchecked")
+ final List<View> children = new ArrayList<View>(view.getChildren());
+ for (final View childView : children) {
+ final int childType = UMLVisualIDRegistry.getVisualID(childView);
+ if (OccurrenceSpecificationLabelEditPart.VISUAL_ID == childType || MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID == childType) {
+ childView.setElement(messageOccurrenceSpecification);
+ childView.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID
+ : MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+ }
+ }
+ return messageOccurrenceSpecification;
+ }
+ return null;
+ }
+
+ /**
+ * Whether the given element is a {@link MessageEnd} ({@link MessageOccurrenceSpecification},
+ * {@link DestructionOccurrenceSpecification} or {@link Gate}), or can be converted to one (
+ * {@link OccurrenceSpecification}).
+ */
+ public static boolean isPotentialMessageEnd(final EObject element) {
+ return element instanceof MessageEnd || element instanceof OccurrenceSpecification;
+ }
+
+ public static Collection<EClass> getAllowedMessageTargets() {
+ return Arrays.asList(UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getGate());
+ }
+
+ public static boolean isValidMessage(final MessageSort messageSort, final MessageKind messageKind, final EObject source, final EObject target) {
+ // found message <=> source == null
+ if (source == null != (messageKind == MessageKind.FOUND_LITERAL)) {
+ return false;
+ }
+ // lost message <=> target == null
+ if (target == null != (messageKind == MessageKind.LOST_LITERAL)) {
+ return false;
+ }
+
+ if ((messageSort == MessageSort.DELETE_MESSAGE_LITERAL || messageSort == MessageSort.CREATE_MESSAGE_LITERAL) && target instanceof Gate) {
+ return false;
+ }
+ if (messageSort == MessageSort.CREATE_MESSAGE_LITERAL && target instanceof DestructionOccurrenceSpecification) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
new file mode 100644
index 00000000000..6805ec7f5bb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.widgets.toolbox.notification.dialogs.PapyrusAsyncNotificationPopup;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/** Validates a timing model in the context of a Papyrus timing diagram */
+public final class ModelValidationUtils {
+
+ private ModelValidationUtils() {
+ // utility class
+ }
+
+ /**
+ * Validates the given {@link Interaction}. Note that this only validates rules specific to the timing diagram. The
+ * model may be valid according to the UML specification, but we want it to follow some additional constraints in
+ * the context of a Papyrus timing diagram:
+ * <ul>
+ * <li>A Lifeline's coveredBys must follow the same order as the containing Interaction's fragments
+ * <li>There must be no fragment in a {@link Lifeline} after a {@link DestructionOccurrenceSpecification}
+ * <li>There must always be an {@link OccurrenceSpecification} between two {@link StateInvariant}s in a Lifeline.
+ * </ul>
+ *
+ * @param interaction
+ * the Interaction to validate
+ * @param autoCorrection
+ * whether to fix the model if it is not considered valid for us
+ * @param interactive
+ * whether to display notifications to the user, and ask for confirmation using dialog boxes
+ * @return whether the Interaction is valid for the Papyrus timing diagram, after potential fixes were applied (if
+ * <code>autoCorrection</code> is <code>true</code>)
+ */
+ public static boolean validate(final Interaction interaction, final boolean autoCorrection, final boolean interactive) {
+ final StringBuilder messageBuilder = new StringBuilder();
+
+ // In order to ease the process, "coveredBy" features are reordered according to Interaction.fragments order.
+ // autoCorrection is overridden as Lifeline.coveredBy is not ordered in UML
+ reorderLifelineCoveredBy(interaction, messageBuilder);
+
+ boolean isDestructionOccurrenceOK = false;
+ boolean isOSbetweenSIOK = false;
+ for (final Lifeline lifeline : interaction.getLifelines()) {
+ // There must be no fragment after a DestructionOccurrence
+ isDestructionOccurrenceOK = validateDestructionOccurrence(lifeline, autoCorrection, messageBuilder);
+ // There must be an OccurrenceSpecification in between 2 StateInvariants
+ isOSbetweenSIOK = validateOSbetweenSI(lifeline, autoCorrection, messageBuilder);
+ }
+
+ final Display display = Display.getCurrent();
+ if (display != null) {
+ final String popupMessage = messageBuilder.toString().trim();
+ if (popupMessage.length() > 0) {
+ // open a popup to notify the user about validation errors, and fixes that were applied
+ final PapyrusAsyncNotificationPopup popup = new PapyrusAsyncNotificationPopup(display, new FormToolkit(display));
+ popup.setTitle(Messages.ModelValidationUtils_ModelValidation);
+ popup.setText(popupMessage);
+ popup.open();
+ }
+ } else if (interactive) {
+ throw new IllegalStateException("This method must be called on the UI thread when executed interactively"); //$NON-NLS-1$
+ }
+
+ return isDestructionOccurrenceOK && isOSbetweenSIOK;
+ }
+
+ private static void appendMessage(final StringBuilder message, final String string) {
+ if (message.length() > 0) {
+ // start adding dashes if there is more than one message
+ if (message.charAt(0) != '-') {
+ final String msg = message.toString();
+ message.setLength(0);
+ message.append("- ").append(msg); //$NON-NLS-1$
+ }
+ message.append("\n- "); //$NON-NLS-1$
+ }
+ message.append(string);
+ }
+
+ /**
+ * Reorders the InteractionFragments in the coveredBys of all Lifelines in the given Interaction, so that they are
+ * in the same order as the fragments of the Interaction.
+ *
+ * @param interaction
+ * the Interaction whose Lifelines to reorder
+ * @param messageBuilder
+ * to build a validation message
+ */
+ private static void reorderLifelineCoveredBy(final Interaction interaction, final StringBuilder messageBuilder) {
+ int reorderCount = 0;
+ for (final Lifeline lifeline : interaction.getLifelines()) {
+ final EList<InteractionFragment> coveredBy = lifeline.getCoveredBys();
+ if (!coveredBy.isEmpty()) {
+ final List<InteractionFragment> fragments = filterFragments(interaction.getFragments(), lifeline);
+ int indexInFragments = 0;
+ for (final InteractionFragment interactionFragment : fragments) {
+ final int indexInLifeline = coveredBy.indexOf(interactionFragment);
+ if (indexInFragments != indexInLifeline) {
+ coveredBy.move(indexInFragments, indexInLifeline);
+ reorderCount++;
+ }
+ indexInFragments++;
+ }
+ }
+ }
+ if (reorderCount > 0) {
+ appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_CoveredByFragmentsWereReOrdered, Integer.toString(reorderCount)));
+ }
+ }
+
+ /**
+ * Return the sublist of the given fragments covered by the given Lifeline.
+ *
+ * @param fragments
+ * the fragments list to filter
+ * @param lifeline
+ * the Lifeline which must be covered by the returned fragments
+ * @return the filtered list of fragments that cover the Lifeline
+ */
+ private static List<InteractionFragment> filterFragments(final EList<InteractionFragment> fragments, final Lifeline lifeline) {
+ final List<InteractionFragment> result = new ArrayList<InteractionFragment>();
+ for (final InteractionFragment interactionFragment : fragments) {
+ if (interactionFragment.getCovereds().contains(lifeline)) {
+ result.add(interactionFragment);
+ }
+ }
+ return result;
+ }
+
+ private static boolean validateDestructionOccurrence(final Lifeline lifeline, final boolean autoCorrection, final StringBuilder messageBuilder) {
+ int wrongFragmentsFound = 0;
+ int wrongFragmentsRemoved = 0;
+
+ final ListIterator<InteractionFragment> listIterator = lifeline.getCoveredBys().listIterator();
+ boolean afterDestructionOccurrenceSpecification = false;
+ while (listIterator.hasNext()) {
+ final InteractionFragment fragment = listIterator.next();
+ if (afterDestructionOccurrenceSpecification) {
+ if (autoCorrection) {
+ listIterator.remove();
+ wrongFragmentsRemoved++;
+ } else {
+ wrongFragmentsFound++;
+ }
+ }
+ if (fragment instanceof DestructionOccurrenceSpecification) {
+ afterDestructionOccurrenceSpecification = true;
+ }
+ }
+
+ if (wrongFragmentsFound > 0) {
+ appendMessage(messageBuilder,
+ NLS.bind(Messages.ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsFound)));
+ }
+ if (wrongFragmentsRemoved > 0) {
+ appendMessage(messageBuilder,
+ NLS.bind(Messages.ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsRemoved)));
+ }
+
+ return wrongFragmentsFound == 0;
+ }
+
+ private static boolean validateOSbetweenSI(final Lifeline lifeline, final boolean autoCorrection, final StringBuilder messageBuilder) {
+
+ final List<InteractionFragment> coveredBys = lifeline.getCoveredBys();
+ int missingOccurrences = 0;
+ final Map<OccurrenceSpecification, Integer> occurencesToBeAdded = new LinkedHashMap<OccurrenceSpecification, Integer>();
+ InteractionFragment previousElement = null;
+ int offset = 0;
+ for (final InteractionFragment interactionFragment : coveredBys) {
+ if (interactionFragment instanceof StateInvariant && previousElement instanceof StateInvariant) {
+ if (autoCorrection) {
+ final OccurrenceSpecification occurrence = UMLFactory.eINSTANCE.createOccurrenceSpecification();
+ OccurrenceSpecificationUtils.setAutogeneratedName(occurrence, true);
+ occurencesToBeAdded.put(occurrence, Integer.valueOf(coveredBys.indexOf(interactionFragment) + offset++));
+ } else {
+ missingOccurrences++;
+ }
+ }
+ previousElement = interactionFragment;
+ }
+ if (!occurencesToBeAdded.isEmpty()) {
+ for (final Entry<OccurrenceSpecification, Integer> entry : occurencesToBeAdded.entrySet()) {
+ final OccurrenceSpecification occurrence = entry.getKey();
+ final int indexInCoveredBys = entry.getValue().intValue();
+ // Element must be a StateInvariant
+ final StateInvariant stateInvariant = (StateInvariant) lifeline.getCoveredBys().get(indexInCoveredBys);
+
+ // insert the OccurrenceSpecification before the StateInvariant in the Lifeline's coveredBys
+ lifeline.getCoveredBys().add(indexInCoveredBys, occurrence);
+
+ final EList<InteractionFragment> fragments = lifeline.getInteraction().getFragments();
+ final int indexInFragments = fragments.indexOf(stateInvariant);
+
+ // insert the OccurrenceSpecification before the StateInvariant in the Interaction's fragments
+ fragments.add(indexInFragments, occurrence);
+
+ String previousName = null;
+ if (indexInCoveredBys > 0) {
+ final InteractionFragment previousFragment = lifeline.getCoveredBys().get(indexInCoveredBys - 1);
+ if (previousFragment instanceof StateInvariant) {
+ final StateInvariant previousStateInvariant = (StateInvariant) previousFragment;
+ previousName = previousStateInvariant.getName();
+ }
+ }
+
+ String followingName = stateInvariant.getName();
+ if (previousName == null) {
+ previousName = "<unnamed>"; //$NON-NLS-1$
+ }
+ if (followingName == null) {
+ followingName = "<unnamed>"; //$NON-NLS-1$
+ }
+ occurrence.setName(previousName + "_To_" + followingName); //$NON-NLS-1$
+ }
+ appendMessage(messageBuilder,
+ NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationAdded, Integer.valueOf(occurencesToBeAdded.size())));
+ }
+
+ if (missingOccurrences > 0) {
+ appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationFound, Integer.valueOf(missingOccurrences)));
+ }
+ return missingOccurrences == 0;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
new file mode 100644
index 00000000000..8426d8f3835
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
@@ -0,0 +1,448 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.StateInvariant;
+
+/** Utility class for manipulating {@link OccurrenceSpecification}s */
+public final class OccurrenceSpecificationUtils {
+
+ /** The key for the EAnnotation on an OccurrenceSpecification that indicates that its name is autogenerated */
+ private static final String AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME = "org.eclipse.papyrus.uml.diagram.timing.autogeneratedOccurrenceSpecificationName"; //$NON-NLS-1$
+
+ private OccurrenceSpecificationUtils() {
+ // utility class
+ }
+
+ public static boolean isOccurrenceSpecificationEditPart(final int visualID) {
+ return visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID || visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID
+ || visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+
+ public static boolean isOccurrenceSpecificationEditPart(final EditPart editPart) {
+ return editPart instanceof OccurrenceSpecificationEditPartCN || editPart instanceof MessageOccurrenceSpecificationEditPartCN
+ || editPart instanceof DestructionOccurrenceSpecificationEditPartCN;
+ }
+
+ public static boolean isOccurrenceSpecificationView(final View view) {
+ final int visualID = UMLVisualIDRegistry.getVisualID(view);
+ return isOccurrenceSpecificationEditPart(visualID);
+ }
+
+ private static EAnnotation getAutogeneratedAnnotation(final OccurrenceSpecification occurrenceSpecification) {
+ return occurrenceSpecification.getEAnnotation(AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME);
+ }
+
+ /**
+ * Marks with an EAnnotation whether the given OccurrenceSpecification has an auto-generated name.
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification for which to specify whether it has an auto-generated name
+ * @param autogenerated
+ * whether the name is auto-generated
+ */
+ public static void setAutogeneratedName(final OccurrenceSpecification occurrenceSpecification, final boolean autogenerated) {
+ EAnnotation eAnnotation = getAutogeneratedAnnotation(occurrenceSpecification);
+ if (autogenerated && eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME);
+ occurrenceSpecification.getEAnnotations().add(eAnnotation);
+ } else if (!autogenerated && eAnnotation != null) {
+ occurrenceSpecification.getEAnnotations().remove(eAnnotation);
+ }
+ }
+
+ /**
+ * Returns whether the given OccurrenceSpecification has an auto-generated name.
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification for which to determine whether it has an auto-generated name
+ * @return whether the name of the given OccurrenceSpecification is auto-generated
+ */
+ public static boolean isAutogeneratedName(final OccurrenceSpecification occurrenceSpecification) {
+ final EAnnotation eAnnotation = getAutogeneratedAnnotation(occurrenceSpecification);
+ return eAnnotation != null;
+ }
+
+ /**
+ * Get all elements to delete when deleting an OccurrenceSpecification.
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification being deleted
+ * @return the elements (EObjects and Views) that should be deleted together with the OccurrenceSpecification
+ */
+ public static Collection<EObject> getElementsToDelete(final OccurrenceSpecification occurrenceSpecification) {
+ final Set<EObject> elementsToDestroy = new HashSet<EObject>();
+ final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
+ for (final View view : crossReferencingViews) {
+ elementsToDestroy.addAll(getElementsToRemove(view, false));
+ }
+ return elementsToDestroy;
+ }
+
+ /**
+ * Get all Views to remove when hiding an OccurrenceSpecification (i.e., deleting an OccurrenceSpecification's
+ * View).
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification being hidden
+ * @return the Views that should be hidden together with the given OccurrenceSpecification View
+ */
+ public static Collection<View> getViewsToHide(final View occurrenceSpecificationView) {
+ final Set<View> viewsToHide = new HashSet<View>();
+ final Collection<EObject> elementsToRemove = getElementsToRemove(occurrenceSpecificationView, true);
+ for (final EObject eObject : elementsToRemove) {
+ if (eObject instanceof View) {
+ viewsToHide.add((View) eObject);
+ } else {
+ throw new IllegalStateException("Only views should be returned"); //$NON-NLS-1$
+ }
+ }
+ return viewsToHide;
+ }
+
+ /**
+ * Get all elements to remove when removing an OccurrenceSpecification.
+ *
+ * @param occurrenceSpecificationView
+ * the OccurrenceSpecification View being removed
+ * @param hideOnly
+ * if <code>true</code>, only return the Views, not the semantic elements
+ * @return the elements (Views and EObjects if <code>hideOnly</code> is <code>false</code>) that should be removed
+ * together with the OccurrenceSpecification
+ */
+ public static Collection<EObject> getElementsToRemove(final View occurrenceSpecificationView, final boolean hideOnly) {
+ final Set<EObject> elementsToRemove = new HashSet<EObject>();
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(occurrenceSpecificationView)) {
+ // remove associated ticks
+ final List<Node> associatedTickViews = TickUtils.getAssociatedTickViews(occurrenceSpecificationView);
+ elementsToRemove.addAll(associatedTickViews);
+
+ // only remove Views under the same Interaction
+ final View interactionView = ViewUtils.findSuperViewWithId(occurrenceSpecificationView, InteractionEditPartTN.VISUAL_ID);
+ final EObject eContainer = occurrenceSpecificationView.eContainer();
+ if (eContainer instanceof Node) {
+ final Node node = (Node) eContainer;
+ @SuppressWarnings("unchecked")
+ final EList<View> children = node.getChildren();
+
+ final int childrenSize = children.size();
+ final int index = children.indexOf(occurrenceSpecificationView);
+
+ boolean done = false;
+ // the Lifeline starts by an OccurrenceSpecification (created with a Create Message)
+ if (index == 0) {
+ if (index + 1 < childrenSize) {
+ final View following = children.get(index + 1);
+ if (following.getType().equals(Constants.verticalLineId)) {
+ elementsToRemove.add(following);
+ }
+ }
+ // let the Lifeline start from a StateInvariant again
+ done = true;
+ }
+
+ // state change in a full lifeline
+ if (!done && index + 2 < childrenSize) {
+ final View following1 = children.get(index + 1);
+ final View following2 = children.get(index + 2);
+ if (following1.getType().equals(Constants.verticalLineId) && following2.getType().equals(Constants.fullStateInvariantId)) {
+ elementsToRemove.add(following1);
+ elementsToRemove.add(following2);
+ if (!hideOnly) {
+ elementsToRemove.add(following2.getElement());
+ }
+ elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(following2.getElement(), hideOnly, interactionView));
+ done = true;
+ }
+ }
+
+ // state change in a compact lifeline, or non-state-change OccurrenceSpecification in any Lifeline
+ if (!done && index + 1 < childrenSize) {
+ final View following = children.get(index + 1);
+ if (following.getType().equals(Constants.fullStateInvariantId) || following.getType().equals(Constants.compactStateInvariantId)) {
+ elementsToRemove.add(following);
+ if (!hideOnly) {
+ elementsToRemove.add(following.getElement());
+ }
+ elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(following.getElement(), hideOnly, interactionView));
+ }
+ }
+ }
+
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) occurrenceSpecificationView.getElement();
+ elementsToRemove.addAll(getRelatedElementsToRemove(occurrenceSpecification, hideOnly, interactionView));
+
+ }
+ return elementsToRemove;
+ }
+
+ public static Collection<? extends EObject> getRelatedElementsToRemove(final EObject occurrenceSpecification, final boolean hideOnly,
+ final View interactionView) {
+ Assert.isLegal(occurrenceSpecification instanceof OccurrenceSpecification);
+ final Set<EObject> elementsToRemove = new HashSet<EObject>();
+ elementsToRemove.addAll(TimeElementUtils.getTimeElementsToRemove(occurrenceSpecification, hideOnly, interactionView));
+ elementsToRemove.addAll(MessageUtils.getReferencingMessagesToRemove(occurrenceSpecification, hideOnly, interactionView));
+ elementsToRemove.addAll(GeneralOrderingUtils.getReferencingGeneralOrderingsToRemove(occurrenceSpecification, hideOnly, interactionView));
+ return elementsToRemove;
+ }
+
+ /**
+ * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s after the given
+ * DestructionOccurrenceSpecification (which signifies the end of a Lifeline). Doesn't delete time elements.
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification after which everything must be deleted
+ * @param occurrenceSpecificationView
+ * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
+ * the views will be searched)
+ */
+ private static void deleteEverythingAfterOrBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView,
+ final boolean before) {
+ // remove fragments from UML model
+ final EList<Lifeline> coveredLifelines = occurrenceSpecification.getCovereds();
+ for (final Lifeline lifeline : coveredLifelines) {
+ final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
+ int index = coveredBys.indexOf(occurrenceSpecification);
+ if (index != -1) {
+ // if we are removing everything before an OccurrenceSpecification in the middle of a StateInvariant,
+ // then we need to move the StateInvariant after the OccurrenceSpecification
+ if (before && index + 1 < coveredBys.size() && !(coveredBys.get(index + 1) instanceof StateInvariant)) {
+ if (movePreviousStateInvariantAfter(coveredBys, occurrenceSpecification)) {
+ // the OccurrenceSpecification moved since we removed an element before it
+ index--;
+ }
+ }
+ final List<InteractionFragment> fragmentsToRemove = new ArrayList<InteractionFragment>();
+ for (int i = before ? index - 1 : index + 1; before ? i >= 0 : i < coveredBys.size(); i = (before ? i - 1 : i + 1)) {
+ fragmentsToRemove.add(coveredBys.get(i));
+ }
+ for (final InteractionFragment fragmentToRemove : fragmentsToRemove) {
+ // remove the related elements
+ Collection<? extends EObject> relatedElementsToRemove = Collections.emptyList();
+ if (fragmentToRemove instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrence = (OccurrenceSpecification) fragmentToRemove;
+ relatedElementsToRemove = OccurrenceSpecificationUtils.getRelatedElementsToRemove(occurrence, false, null);
+ } else if (fragmentToRemove instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant) fragmentToRemove;
+ relatedElementsToRemove = StateInvariantUtils.getRelatedElementsToRemove(stateInvariant, false, null);
+ }
+ for (final EObject eObject : relatedElementsToRemove) {
+ DestroyElementCommand.destroy(eObject);
+ }
+ // remove the fragment
+ DestroyElementCommand.destroy(fragmentToRemove);
+ }
+ }
+ }
+ // remove Views from notation model
+ final Collection<View> views;
+ if (occurrenceSpecificationView == null) {
+ views = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
+ } else {
+ views = Collections.singletonList(occurrenceSpecificationView);
+ }
+ for (final View view : views) {
+ final View parentView = (View) view.eContainer();
+ @SuppressWarnings("unchecked")
+ final EList<View> children = parentView.getChildren();
+ final int index = children.indexOf(view);
+ if (index != -1) {
+ final List<View> viewsToRemove = new ArrayList<View>();
+ for (int i = before ? index - 1 : index + 1; before ? i >= 0 : i < children.size(); i = (before ? i - 1 : i + 1)) {
+ final View childView = children.get(i);
+ final int visualID = UMLVisualIDRegistry.getVisualID(childView);
+ if (isOccurrenceSpecificationEditPart(visualID) || StateInvariantUtils.isStateInvariantEditPart(visualID)
+ || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
+ viewsToRemove.add(childView);
+ }
+ }
+ // remove the vertical line (a state change is not possible anymore
+ // since we deleted the preceding state invariant)
+ if (before && index + 1 < children.size()) {
+ final View childView = children.get(index + 1);
+ final int visualID = UMLVisualIDRegistry.getVisualID(childView);
+ if (visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
+ viewsToRemove.add(childView);
+ }
+ }
+ for (final View viewToRemove : viewsToRemove) {
+ ViewUtil.destroy(viewToRemove);
+ }
+ }
+ }
+ }
+
+ private static boolean movePreviousStateInvariantAfter(final EList<InteractionFragment> fragments, final OccurrenceSpecification occurrenceSpecification) {
+ final int umlIndex = fragments.indexOf(occurrenceSpecification);
+ // move the StateInvariant in the UML model
+ final int previousStateInvariantIndex = findPreviousStateInvariantIndex(umlIndex, fragments);
+ if (previousStateInvariantIndex == -1) {
+ Activator.log.error(new IllegalStateException("No StateInvariant after or before the OccurrenceSpecification")); //$NON-NLS-1$
+ return false;
+ }
+ final StateInvariant stateInvariant = (StateInvariant) fragments.get(previousStateInvariantIndex);
+ fragments.move(umlIndex, previousStateInvariantIndex);
+
+ // move the StateInvariant View in the notation model
+ final Collection<View> stateInvariantViews = CrossReferencerUtil.getCrossReferencingViews(stateInvariant, TimingDiagramEditPart.MODEL_ID);
+ for (final View stateInvariantView : stateInvariantViews) {
+ final View parentView = (View) stateInvariantView.eContainer();
+ @SuppressWarnings("unchecked")
+ final EList<View> children = parentView.getPersistedChildren();
+ // find the OccurrenceSpecification View index
+ int viewIndex = -1;
+ for (int i = 0; i < children.size(); i++) {
+ final View view = children.get(i);
+ if (view.getElement() == occurrenceSpecification) {
+ viewIndex = i;
+ break;
+ }
+ }
+ children.move(viewIndex, stateInvariantView);
+ }
+ return true;
+ }
+
+ private static int findPreviousStateInvariantIndex(final int index, final EList<InteractionFragment> fragments) {
+ for (int i = index - 1; i >= 0; i--) {
+ final InteractionFragment fragment = fragments.get(i);
+ if (fragment instanceof StateInvariant) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s after the given
+ * DestructionOccurrenceSpecification (which signifies the end of a Lifeline). Doesn't delete time elements.
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification after which everything must be deleted
+ * @param occurrenceSpecificationView
+ * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
+ * the views will be searched)
+ */
+ public static void deleteEverythingAfter(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView) {
+ deleteEverythingAfterOrBefore(occurrenceSpecification, occurrenceSpecificationView, false);
+ }
+
+ /**
+ * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s before the given
+ * {@link OccurrenceSpecification} (which signifies the creation of a Lifeline). Doesn't delete time elements.
+ *
+ * @param occurrenceSpecification
+ * the OccurrenceSpecification before which everything must be deleted
+ * @param occurrenceSpecificationView
+ * the OccurrenceSpecification View before which other views must be deleted (if <code>null</code>, then
+ * the views will be searched)
+ */
+ public static void deleteEverythingBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView) {
+ deleteEverythingAfterOrBefore(occurrenceSpecification, occurrenceSpecificationView, true);
+ }
+
+ /**
+ * Find at which index to insert an OccurrenceSpecification in a compartment, based on a location.
+ *
+ * @param pt
+ * the location
+ * @param compartmentView
+ * the compartment view in which the OccurrenceSpecification will be inserted
+ * @param viewer
+ * the viewer in which the EditParts corresponding to the Views are registered
+ * @return the index in the compartment where the OccurrenceSpecification should be inserted
+ */
+ public static int findInsertionIndexFor(final Point pt, final View compartmentView, final EditPartViewer viewer) {
+ @SuppressWarnings("unchecked")
+ final EList<View> children = compartmentView.getChildren();
+ int index = 0;
+ for (final View view : children) {
+ if (view instanceof Node) {
+ final Node node = (Node) view;
+ final Object editPart = viewer.getEditPartRegistry().get(node);
+ if (editPart instanceof GraphicalEditPart) {
+ final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) editPart;
+ final Rectangle bounds = graphicalEditPart.getFigure().getBounds();
+ if (pt.x < bounds.x()) {
+ break;
+ }
+ } else {
+ Activator.log.error(new Exception("No EditPart found for the Node")); //$NON-NLS-1$
+ }
+ }
+ index++;
+ }
+ return index;
+ }
+
+ /**
+ * Wrap the given <code>baseCommand</code> (that hides an OccurrenceSpecification View) into a
+ * {@link CompoundCommand}, and add a deletion of other Views associated to the OccurrenceSpecification.
+ */
+ public static CompoundCommand getHideOccurrenceSpecificationCommand(final EditPart occurrenceSpecificationEditPart, final Command baseCommand) {
+ final View view = (View) occurrenceSpecificationEditPart.getModel();
+ if (!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(UMLVisualIDRegistry.getVisualID(view))) {
+ return null;
+ }
+ final Collection<View> viewsToHide = OccurrenceSpecificationUtils.getViewsToHide(view);
+ final CompoundCommand compoundCommand = new CompoundCommand(Messages.OccurrenceSpecificationUtils_HideOccurrenceSpecification);
+ if (baseCommand != null) {
+ compoundCommand.add(baseCommand);
+ }
+ for (final View viewToHide : viewsToHide) {
+ compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToHide)));
+ }
+ if (compoundCommand.isEmpty()) {
+ return null;
+ }
+ return compoundCommand;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
new file mode 100644
index 00000000000..b9ceb6e6ca3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+public final class RequestUtils {
+ private RequestUtils() {
+ // utility class
+ }
+
+ /** Whether the given request is a ChangeBoundsRequest concerning instances of the given EClass only. */
+ public static boolean isChangeBoundsRequestFor(final Request request, final EClass eClass) {
+ if (request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ return isGroupRequestFor(changeBoundsRequest, eClass);
+ }
+ return false;
+ }
+
+ /** Whether the given request is a ChangeBoundsRequest concerning instances of the given EditPart only. */
+ public static boolean isChangeBoundsRequestFor(final Request request, final Class<? extends EditPart> editPartClass) {
+ if (request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ return isGroupRequestFor(changeBoundsRequest, editPartClass);
+ }
+ return false;
+ }
+
+ /** Whether the given request is a GroupRequest concerning instances of the given EClass only. */
+ public static boolean isGroupRequestFor(final GroupRequest groupRequest, final EClass eClass) {
+ @SuppressWarnings("unchecked")
+ final List<EditPart> editParts = groupRequest.getEditParts();
+ if (editParts == null) {
+ return false;
+ }
+ for (final EditPart editPart : editParts) {
+ final Object model = editPart.getModel();
+ if (model instanceof View) {
+ final View view = (View) model;
+ final EObject element = view.getElement();
+ if (!eClass.isInstance(element)) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /** Whether the given request is a GroupRequest concerning instances of the given EditPart only. */
+ public static boolean isGroupRequestFor(final GroupRequest groupRequest, final Class<? extends EditPart> editPartClass) {
+ @SuppressWarnings("unchecked")
+ final List<EditPart> editParts = groupRequest.getEditParts();
+ for (final EditPart editPart : editParts) {
+ if (!editPartClass.isInstance(editPart)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
new file mode 100644
index 00000000000..46db314ed8b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
@@ -0,0 +1,304 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.StateInvariant;
+
+/**
+ * Utility class for the creation and retrieval of StateDefinition names through EAnnotations on Lifeline and
+ * StateDefinition View
+ */
+public final class StateDefinitionUtils {
+
+ /** The key for the EAnnotation on a Lifeline in which the StateDefinition (id,name) detail map is contained */
+ private static final String LIFELINE_STATE_DEFINITIONS_KEY = "org.eclipse.papyrus.uml.diagram.timing.LifelineStateDefinitions"; //$NON-NLS-1$
+ /**
+ * The key for the EAnnotation on a StateDefinition View in which the id (STATE_DEFINITION_VIEW_ID_KEY) and name
+ * (STATE_DEFINITION_VIEW_NAME_KEY) are defined
+ */
+ private static final String STATE_DEFINITION_VIEW_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionView"; //$NON-NLS-1$
+ /** The key for the name of a StateDefinition in the details map of a StateDefinition View's annotations */
+ private static final String STATE_DEFINITION_VIEW_ID_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionViewID"; //$NON-NLS-1$
+ /** The key for the id of a StateDefinition in the details map of a StateDefinition View's annotations */
+ private static final String STATE_DEFINITION_VIEW_NAME_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionViewName"; //$NON-NLS-1$
+
+ private StateDefinitionUtils() {
+ // utility class
+ }
+
+ public static boolean hasStateDefinitionEAnnotation(final Lifeline lifeline) {
+ final EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
+ if (eAnnotation == null) {
+ return false;
+ }
+ return !eAnnotation.getDetails().isEmpty();
+ }
+
+ /** Get or create an EAnnotation in the given Lifeline, to hold the map of state definition IDs and names */
+ public static EAnnotation getOrCreateStateDefinitionsEAnnotation(final Lifeline lifeline) {
+ EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(LIFELINE_STATE_DEFINITIONS_KEY);
+ lifeline.getEAnnotations().add(eAnnotation);
+ }
+ return eAnnotation;
+ }
+
+ /**
+ * Get the EAnnotation that contains a Details map (stateDefinitionId,stateDefinitionName) on the given Lifeline, or
+ * <code>null</code> if none was created
+ */
+ public static EAnnotation getStateDefinitionsEAnnotation(final Lifeline lifeline) {
+ return lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
+ }
+
+ public static String getStateDefinitionViewID(final View stateDefinitionView) {
+ final EAnnotation eAnnotation = stateDefinitionView.getEAnnotation(STATE_DEFINITION_VIEW_KEY);
+ if (eAnnotation != null) {
+ return eAnnotation.getDetails().get(STATE_DEFINITION_VIEW_ID_KEY);
+ }
+ return null;
+ }
+
+ private static EAnnotation getOrCreateStateDefinitionViewAnnotation(final View stateDefinitionView) {
+ EAnnotation eAnnotation = stateDefinitionView.getEAnnotation(STATE_DEFINITION_VIEW_KEY);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(STATE_DEFINITION_VIEW_KEY);
+ stateDefinitionView.getEAnnotations().add(eAnnotation);
+ }
+ return eAnnotation;
+ }
+
+ public static void setStateDefinitionViewID(final View stateDefinitionView, final String id) {
+ final EAnnotation eAnnotation = getOrCreateStateDefinitionViewAnnotation(stateDefinitionView);
+ eAnnotation.getDetails().put(STATE_DEFINITION_VIEW_ID_KEY, id);
+ }
+
+ private static void setStateDefinitionViewName(final View stateDefinitionView, final String name) {
+ final EAnnotation eAnnotation = getOrCreateStateDefinitionViewAnnotation(stateDefinitionView);
+ eAnnotation.getDetails().put(STATE_DEFINITION_VIEW_NAME_KEY, name);
+ }
+
+ public static void setStateDefinitionName(final View stateDefinitionView, final String newName) {
+ checkStateDefinitionView(stateDefinitionView);
+ String stateDefinitionViewID = getStateDefinitionViewID(stateDefinitionView);
+ if (stateDefinitionViewID == null) {
+ // generate a unique ID that we will use to link the StateDefinition Figure to its name in the
+ // EAnnotation: we have a map (ID,name) in the Lifeline's EAnnotation and an entry (View,ID) in the
+ // StateDefinition Figure's EAnnotation
+ stateDefinitionViewID = EcoreUtil.generateUUID();
+ setStateDefinitionViewID(stateDefinitionView, stateDefinitionViewID);
+ }
+ final Lifeline lifeline = StateDefinitionUtils.getParentLifeline(stateDefinitionView);
+ final EAnnotation lifelineEAnnotation = getOrCreateStateDefinitionsEAnnotation(lifeline);
+ lifelineEAnnotation.getDetails().put(stateDefinitionViewID, newName);
+ // setting the name on the View too lets the Label refresh, since the refresh is only listening on the DI model
+ setStateDefinitionViewName(stateDefinitionView, newName);
+ }
+
+ public static void removeStateDefinitionEAnnotationFromLifeline(final String id, final Lifeline lifeline) {
+ final EAnnotation lifelineEAnnotation = getStateDefinitionsEAnnotation(lifeline);
+ if (lifelineEAnnotation != null) {
+ lifelineEAnnotation.getDetails().removeKey(id);
+ }
+ }
+
+ public static String getStateDefinitionName(final View stateDefinitionView) {
+ checkStateDefinitionView(stateDefinitionView);
+ final String stateDefinitionViewID = getStateDefinitionViewID(stateDefinitionView);
+ if (stateDefinitionViewID == null) {
+ return null;
+ }
+ final Lifeline lifeline = StateDefinitionUtils.getParentLifeline(stateDefinitionView);
+ return getStateDefinitionName(stateDefinitionViewID, lifeline);
+ }
+
+ public static String getStateDefinitionName(final String stateDefinitionViewID, final Lifeline lifeline) {
+ if (stateDefinitionViewID == null || lifeline == null) {
+ return null;
+ }
+ final EAnnotation lifelineEAnnotation = getStateDefinitionsEAnnotation(lifeline);
+ if (lifelineEAnnotation == null) {
+ return null;
+ }
+ return lifelineEAnnotation.getDetails().get(stateDefinitionViewID);
+ }
+
+ public static View getParentLifelineView(final View view) {
+ final String id = Integer.toString(FullLifelineEditPartCN.VISUAL_ID);
+ View parent = view;
+ while (parent != null) {
+ if (id.equals(parent.getType())) {
+ return parent;
+ }
+ parent = (View) parent.eContainer();
+ }
+ throw new IllegalStateException("Parent Lifeline not found"); //$NON-NLS-1$
+ }
+
+ public static Lifeline getParentLifeline(final View view) {
+ final View parentLifelineView = getParentLifelineView(view);
+ if (parentLifelineView != null) {
+ return (Lifeline) parentLifelineView.getElement();
+ }
+ return null;
+ }
+
+ /** Set a new name on the given StateDefinition view */
+ public static void initNewStateDefinitionName(final View stateDefinitionView) {
+ checkStateDefinitionView(stateDefinitionView);
+ final View stateDefinitionsCompartment = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID);
+ final List<View> allStateDefinitionViews = ViewUtils.findSubViewsWithId(stateDefinitionsCompartment, StateDefinitionEditPart.VISUAL_ID);
+ final Set<String> existingNames = new HashSet<String>();
+ for (final View aStateDefinitionView : allStateDefinitionViews) {
+ existingNames.add(getStateDefinitionName(aStateDefinitionView));
+ }
+ setStateDefinitionName(stateDefinitionView, findNewStateName(existingNames));
+ }
+
+ private static String findNewStateName(final Set<String> existingNames) {
+ String newName = ""; //$NON-NLS-1$
+ final String prefix = Messages.StateDefinitionUtils_State;
+ int suffix = 1;
+ while (true) {
+ newName = prefix + suffix;
+ if (!existingNames.contains(newName)) {
+ break;
+ }
+ suffix++;
+ }
+ return newName;
+ }
+
+ public static View getStateDefinitionViewWithId(final String id, final View lifelineView) {
+ checkLifelineView(lifelineView);
+ final List<View> stateDefinitionViews = ViewUtils.findSubViewsWithId(lifelineView, StateDefinitionEditPart.VISUAL_ID);
+ for (final View stateDefinitionView : stateDefinitionViews) {
+ if (id.equals(getStateDefinitionViewID(stateDefinitionView))) {
+ return stateDefinitionView;
+ }
+ }
+ return null;
+ }
+
+ public static View getStateDefinitionViewWithName(final String name, final View lifelineView) {
+ checkLifelineView(lifelineView);
+ final List<View> stateDefinitionViews = ViewUtils.findSubViewsWithId(lifelineView, StateDefinitionEditPart.VISUAL_ID);
+ for (final View stateDefinitionView : stateDefinitionViews) {
+ if (name.equals(getStateDefinitionName(stateDefinitionView))) {
+ return stateDefinitionView;
+ }
+ }
+ return null;
+ }
+
+ public static List<String> getStateDefinitionIds(final Lifeline lifeline) {
+ final EAnnotation eAnnotation = getStateDefinitionsEAnnotation(lifeline);
+ if (eAnnotation != null) {
+ final EMap<String, String> details = eAnnotation.getDetails();
+ final List<String> result = new ArrayList<String>();
+ // note: using the iterator preserves the order
+ final Iterator<Entry<String, String>> iterator = details.iterator();
+ while (iterator.hasNext()) {
+ final Entry<String, String> entry = iterator.next();
+ result.add(entry.getKey());
+ }
+ return result;
+ }
+ return Collections.emptyList();
+ }
+
+ private static void checkStateDefinitionView(final View stateDefinitionView) {
+ if (!Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(stateDefinitionView.getType())) {
+ throw new IllegalArgumentException(
+ "The parameter must be a StateDefinition View (id = " + StateDefinitionEditPart.VISUAL_ID + "). The id was " + stateDefinitionView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ private static void checkLifelineView(final View lifelineView) {
+ if (!Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
+ throw new IllegalArgumentException(
+ "The parameter must be a Lifeline View (id = " + FullLifelineEditPartCN.VISUAL_ID + "). The id was " + lifelineView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /** Find the StateDefinition closest to the given y-coordinate and return it. */
+ public static StateDefinitionEditPart findStateDefinitionClosestToOrdinate(final FullLifelineEditPartCN lifelineEditPart, final int ordinate) {
+ @SuppressWarnings("unchecked")
+ final List<GraphicalEditPart> editParts = (List<GraphicalEditPart>) EditPartUtils.findChildEditPartsWithId(lifelineEditPart,
+ StateDefinitionEditPart.VISUAL_ID);
+ return (StateDefinitionEditPart) EditPartUtils.findEditPartClosestToOrdinate(ordinate, editParts);
+ }
+
+ /**
+ * Updates the StateDefinitions of the given Lifeline so that they match the names of the fragments covered by this
+ * Lifeline. This should only be called on a compact lifeline. The purpose of this operation is to make sure that
+ * the UML model is the same for a compact lifeline as a full lifeline, so that the two types of lifelines can be
+ * switched easily at any time.
+ *
+ * @param lifeline
+ * the lifeline to update
+ */
+ public static void updateStateDefinitionNamesForCompactLifeline(final Lifeline lifeline) {
+ final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
+ final Map<String, String> nameIdMap = new LinkedHashMap<String, String>();
+ // first, get all the unique state invariant names and generate the associated ids
+ for (final InteractionFragment interactionFragment : coveredBys) {
+ if (interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
+ nameIdMap.put(name, EcoreUtil.generateUUID());
+ }
+ }
+ // then, (re-)create the StateDefinitions
+ final EAnnotation stateDefinitionsEAnnotation = getOrCreateStateDefinitionsEAnnotation(lifeline);
+ stateDefinitionsEAnnotation.getDetails().clear();
+ for (final Entry<String, String> entry : nameIdMap.entrySet()) {
+ final String name = entry.getKey();
+ final String id = entry.getValue();
+ stateDefinitionsEAnnotation.getDetails().put(id, name);
+ }
+ // then, set the IDs on the state invariants
+ for (final InteractionFragment interactionFragment : coveredBys) {
+ if (interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
+ final String id = nameIdMap.get(name);
+ StateInvariantUtils.setStateInvariantId(stateInvariant, id);
+ }
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
new file mode 100644
index 00000000000..f2d9cc26314
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
@@ -0,0 +1,444 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.timing.custom.OperationForbiddenException;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.OpaqueExpression;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public final class StateInvariantUtils {
+
+ private StateInvariantUtils() {
+ // utility class
+ }
+
+ /** The key for the EAnnotation on a {@link StateInvariant} */
+ private static final String STATE_INVARIANT_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateInvariant"; //$NON-NLS-1$
+ /** The key for the corresponding StateDefinition, defined in the details map in the EAnnotation on a StateInvariant */
+ private static final String STATE_INVARIANT_STATE_DEFINITION_ID_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateInvariantStateDefinitionId"; //$NON-NLS-1$
+
+ /**
+ * Create a StateInvariant and its View.
+ *
+ * @param stateDefinitionId
+ * the id of the state definition that the state invariant will be set to
+ * @param lifelineEditPart
+ * the Lifeline in which the StateInvariant must be added
+ * @param indexInFragments
+ * index to insert the state invariant in the Interaction's fragments list (-1 to insert at the end)
+ * @param indexInCoveredBys
+ * index to insert the state invariant in the Lifeline's coveredBys list (-1 to insert at the end)
+ * @param indexInCompartment
+ * index to insert the state invariant in the Compartment's children list (-1 to insert at the end)
+ * @return the Node that represents the StateInvariant in the GMF model
+ */
+ public static Node createStateInvariant(final String stateDefinitionId, final FullLifelineEditPartCN lifelineEditPart, final int indexInFragments,
+ final int indexInCoveredBys, final int indexInCompartment) {
+ final View timelineCompartmentView = (View) EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart,
+ FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID).getModel();
+ final View lifelineView = (View) lifelineEditPart.getModel();
+ final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+
+ // create the StateInvariant
+ final StateInvariant newStateInvariant = UMLFactory.eINSTANCE.createStateInvariant();
+ final Constraint newConstraint = UMLFactory.eINSTANCE.createConstraint();
+ newStateInvariant.setInvariant(newConstraint);
+ final OpaqueExpression newOpaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
+ final View stateDefinitionView = StateDefinitionUtils.getStateDefinitionViewWithId(stateDefinitionId, lifelineView);
+ final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
+ newConstraint.setSpecification(newOpaqueExpression);
+
+ if (indexInFragments == -1) {
+ lifeline.getInteraction().getFragments().add(newStateInvariant);
+ } else {
+ lifeline.getInteraction().getFragments().add(indexInFragments, newStateInvariant);
+ }
+ if (indexInCoveredBys == -1) {
+ lifeline.getCoveredBys().add(newStateInvariant);
+ } else {
+ lifeline.getCoveredBys().add(indexInCoveredBys, newStateInvariant);
+ }
+
+ // associate the StateInvariant with the StateDefinition through the same id
+ setStateInvariantId(newStateInvariant, stateDefinitionId);
+ setInnerStateInvariantName(newStateInvariant, stateDefinitionName);
+
+ // create the View for the new state invariant
+ final UMLViewProvider umlViewProvider = new UMLViewProvider();
+ final Node stateInvariantNode = umlViewProvider.createStateInvariant_11(newStateInvariant, timelineCompartmentView, indexInCompartment, true,
+ PreferencesHint.USE_DEFAULTS);
+ return stateInvariantNode;
+ }
+
+ public static Node createCompactStateInvariant(final View lifelineCompartmentView, final int indexInFragments, final int indexInCoveredBys,
+ final int indexInCompartment) {
+
+ final Lifeline lifeline = (Lifeline) lifelineCompartmentView.getElement();
+
+ // create the StateInvariant
+ final StateInvariant newStateInvariant = UMLFactory.eINSTANCE.createStateInvariant();
+ final Constraint newConstraint = UMLFactory.eINSTANCE.createConstraint();
+ newStateInvariant.setInvariant(newConstraint);
+ final OpaqueExpression newOpaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
+
+ newConstraint.setSpecification(newOpaqueExpression);
+
+ if (indexInFragments == -1) {
+ lifeline.getInteraction().getFragments().add(newStateInvariant);
+ } else {
+ lifeline.getInteraction().getFragments().add(indexInFragments, newStateInvariant);
+ }
+ if (indexInCoveredBys == -1) {
+ lifeline.getCoveredBys().add(newStateInvariant);
+ } else {
+ lifeline.getCoveredBys().add(indexInCoveredBys, newStateInvariant);
+ }
+
+ // create the View for the new state invariant
+ final UMLViewProvider umlViewProvider = new UMLViewProvider();
+ final Node stateInvariantNode = umlViewProvider.createStateInvariant_28(newStateInvariant, lifelineCompartmentView, indexInCompartment, true,
+ PreferencesHint.USE_DEFAULTS);
+ return stateInvariantNode;
+ }
+
+ /**
+ * Set the value of the body in the ValueSpecification (which must be an OpaqueExpression) of the Constraint of this
+ * StateInvariant and the name of the Constraint.
+ *
+ * @param stateInvariant
+ * the StateInvariant whose name to update
+ * @param newName
+ * the new name for the StateInvariant (which is the name of the corresponding StateDefinition in a full
+ * Lifeline)
+ */
+ public static void setInnerStateInvariantName(final StateInvariant stateInvariant, final String newName) {
+ final Constraint constraint = stateInvariant.getInvariant();
+ Assert.isNotNull(constraint, "The StateInvariant must have a Constraint"); //$NON-NLS-1$
+ // set the constraint's name
+ constraint.setName("InState_" + newName); //$NON-NLS-1$
+ final ValueSpecification specification = constraint.getSpecification();
+ Assert.isNotNull(specification, "The Constraint must have a ValueSpecification"); //$NON-NLS-1$
+ Assert.isLegal(specification instanceof OpaqueExpression, "The ValueSpecification must be an OpaqueExpression"); //$NON-NLS-1$
+ final OpaqueExpression opaqueExpression = (OpaqueExpression) specification;
+ // (re-)set the body
+ opaqueExpression.getBodies().clear();
+ opaqueExpression.getBodies().add(newName);
+ }
+
+ /**
+ * Return the value of the body in the ValueSpecification (which must be an OpaqueExpression) of the Constraint of
+ * this StateInvariant.
+ * <p>
+ * In a compact Lifeline, the name is duplicated:
+ * <ul>
+ * <li>the StateInvariant's name
+ * <li>the body in the OpaqueExpression of the Constraint of the StateInvariant
+ * </ul>
+ * In addition to this, in a full Lifeline, the name appears in a third place:
+ * <ul>
+ * <li>the name of the corresponding StateDefinition (defined in the EAnnotation on the Lifeline) which has an id
+ * matching the id stored in the StateInvariant's EAnnotation: this is the canonical name when in a full Lifeline
+ * (see {@link StateDefinitionUtils})
+ * </ul>
+ *
+ * */
+ public static String getInnerStateInvariantName(final StateInvariant stateInvariant) {
+ final Constraint constraint = stateInvariant.getInvariant();
+ if (constraint == null) {
+ return null;
+ }
+ final ValueSpecification specification = constraint.getSpecification();
+ if (specification == null || !(specification instanceof OpaqueExpression)) {
+ return null;
+ }
+ final OpaqueExpression opaqueExpression = (OpaqueExpression) specification;
+ final EList<String> bodies = opaqueExpression.getBodies();
+ if (bodies == null || bodies.size() < 1) {
+ return null;
+ }
+ return bodies.get(0);
+ }
+
+ public static void setStateInvariantId(final StateInvariant stateInvariant, final String id) {
+ final EAnnotation eAnnotation = getOrCreateStateInvariantEAnnotation(stateInvariant);
+ eAnnotation.getDetails().put(STATE_INVARIANT_STATE_DEFINITION_ID_KEY, id);
+ }
+
+ public static String getStateInvariantId(final StateInvariant stateInvariant) {
+ final EAnnotation eAnnotation = stateInvariant.getEAnnotation(STATE_INVARIANT_KEY);
+ if (eAnnotation != null) {
+ return eAnnotation.getDetails().get(STATE_INVARIANT_STATE_DEFINITION_ID_KEY);
+ }
+ return null;
+ }
+
+ private static EAnnotation getOrCreateStateInvariantEAnnotation(final StateInvariant stateInvariant) {
+ EAnnotation eAnnotation = stateInvariant.getEAnnotation(STATE_INVARIANT_KEY);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(STATE_INVARIANT_KEY);
+ stateInvariant.getEAnnotations().add(eAnnotation);
+ }
+ return eAnnotation;
+ }
+
+ /** Find and return all the StateInvariants defined in the given Interaction that have the given id. */
+ public static List<StateInvariant> findStateInvariantsWithId(final String id, final Interaction interaction) {
+ final List<StateInvariant> stateInvariants = new ArrayList<StateInvariant>();
+ final EList<InteractionFragment> fragments = interaction.getFragments();
+ for (final InteractionFragment interactionFragment : fragments) {
+ if (interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ final String stateInvariantId = getStateInvariantId(stateInvariant);
+ if (id.equals(stateInvariantId)) {
+ stateInvariants.add(stateInvariant);
+ }
+ }
+ }
+ return stateInvariants;
+ }
+
+ /**
+ * Get all elements to delete when deleting a StateInvariant.
+ *
+ * @param stateInvariant
+ * the StateInvariant being deleted
+ * @return the elements (EObjects and Views) that should be deleted together with the StateInvariant
+ * @throws OperationForbiddenException
+ * if the StateInvariant should not be deleted
+ */
+ public static Collection<EObject> getElementsToDelete(final StateInvariant stateInvariant) throws OperationForbiddenException {
+ final Set<EObject> elementsToDestroy = new HashSet<EObject>();
+ final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(stateInvariant, TimingDiagramEditPart.MODEL_ID);
+ for (final View view : crossReferencingViews) {
+ elementsToDestroy.addAll(getElementsToRemove(view, false));
+ }
+ return elementsToDestroy;
+ }
+
+ /**
+ * Get all Views to remove when hiding a StateInvariant (i.e., deleting a StateInvariant's View).
+ *
+ * @param stateInvariant
+ * the StateInvariant being hidden
+ * @return the Views that should be hidden together with the given StateInvariant View
+ * @throws OperationForbiddenException
+ * if the StateInvariant should not be hidden
+ */
+ public static Collection<View> getViewsToHide(final View stateInvariantView) throws OperationForbiddenException {
+
+ final Set<View> viewsToHide = new HashSet<View>();
+ final Collection<EObject> elementsToRemove = getElementsToRemove(stateInvariantView, true);
+ for (final EObject eObject : elementsToRemove) {
+ if (eObject instanceof View) {
+ viewsToHide.add((View) eObject);
+ } else {
+ throw new IllegalStateException("Only views should be returned"); //$NON-NLS-1$
+ }
+ }
+ return viewsToHide;
+ }
+
+ /**
+ * Get all elements to remove when removing a StateInvariant.
+ *
+ * @param view
+ * the StateInvariant View being removed
+ * @param hideOnly
+ * if <code>true</code>, only return the Views, not the semantic elements
+ * @return the elements (Views and EObjects if <code>hideOnly</code> is <code>false</code>) that should be removed
+ * together with the StateInvariant
+ * @throws OperationForbiddenException
+ * if the StateInvariant should not be removed
+ */
+ public static Collection<EObject> getElementsToRemove(final View view, final boolean hideOnly) throws OperationForbiddenException {
+ final Set<EObject> elementsToRemove = new HashSet<EObject>();
+ final boolean fullStateInvariant = view.getType().equals(Constants.fullStateInvariantId);
+ final boolean compactStateInvariant = view.getType().equals(Constants.compactStateInvariantId);
+
+ if (fullStateInvariant || compactStateInvariant) {
+ // only remove Views under the same Interaction
+ final View interactionView = ViewUtils.findSuperViewWithId(view, InteractionEditPartTN.VISUAL_ID);
+
+ final StateInvariant stateInvariant = (StateInvariant) view.getElement();
+ elementsToRemove.addAll(getRelatedElementsToRemove(stateInvariant, hideOnly, interactionView));
+
+ final EObject eContainer = view.eContainer();
+ if (eContainer instanceof Node) {
+ final Node node = (Node) eContainer;
+ @SuppressWarnings("unchecked")
+ final EList<View> children = node.getChildren();
+ int nStateInvariants = 0;
+ for (final View childView : children) {
+ if (childView.getType().equals(Constants.fullStateInvariantId) || childView.getType().equals(Constants.compactStateInvariantId)) {
+ nStateInvariants++;
+ }
+ }
+ if (nStateInvariants <= 1) {
+ // don't allow deleting the only StateInvariant (since this renders the diagram unusable)
+ throw new OperationForbiddenException();
+ }
+ if (fullStateInvariant) {
+ elementsToRemove.addAll(getElementsToRemoveForFullStateInvariant(view, children, hideOnly, interactionView));
+ } else if (compactStateInvariant) {
+ elementsToRemove.addAll(getElementsToRemoveForCompactStateInvariant(view, children, hideOnly, interactionView));
+ }
+ }
+ }
+ return elementsToRemove;
+ }
+
+ public static Collection<? extends EObject> getRelatedElementsToRemove(final EObject stateInvariant, final boolean hideOnly, final View interactionView) {
+ Assert.isLegal(stateInvariant instanceof StateInvariant);
+ final Set<EObject> elementsToRemove = new HashSet<EObject>();
+ elementsToRemove.addAll(TimeElementUtils.getTimeElementsToRemove(stateInvariant, hideOnly, interactionView));
+ elementsToRemove.addAll(GeneralOrderingUtils.getReferencingGeneralOrderingsToRemove(stateInvariant, hideOnly, interactionView));
+ return elementsToRemove;
+ }
+
+ private static Collection<EObject> getElementsToRemoveForFullStateInvariant(final View stateInvariantView, final EList<View> children,
+ final boolean hideOnly, final View interactionView) {
+ final Set<EObject> elementsToRemove = new HashSet<EObject>();
+ final int childrenSize = children.size();
+ final int index = children.indexOf(stateInvariantView);
+ if (index == 0) {
+ // first StateInvariant: remove the OccurrenceSpecification and VerticalLine AFTER it
+ if (index + 1 < childrenSize) {
+ final View following = children.get(index + 1);
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(following)) {
+ addElementToRemove(following, hideOnly, interactionView, elementsToRemove);
+ }
+ }
+ if (index + 2 < childrenSize) {
+ final View following = children.get(index + 2);
+ if (following.getType().equals(Constants.verticalLineId)) {
+ elementsToRemove.add(following);
+ }
+ }
+ } else {
+ // other StateInvariant: remove the VerticalLine and OccurrenceSpecification BEFORE it
+ if (index >= 1) {
+ final View preceding = children.get(index - 1);
+ if (preceding.getType().equals(Constants.verticalLineId)) {
+ elementsToRemove.add(preceding);
+ }
+ // in the case of a creation Message
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
+ addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
+ }
+ }
+ if (index >= 2) {
+ final View preceding = children.get(index - 2);
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
+ addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
+ }
+ }
+ }
+ return elementsToRemove;
+ }
+
+ private static Collection<EObject> getElementsToRemoveForCompactStateInvariant(final View stateInvariantView, final EList<View> children,
+ final boolean hideOnly, final View interactionView) {
+ final Set<EObject> elementsToRemove = new HashSet<EObject>();
+ final int index = children.indexOf(stateInvariantView);
+ if (index == 0) {
+ // first StateInvariant: remove the OccurrenceSpecification AFTER it
+ // (and all the OccurrenceSpecifications on top of it)
+ for (int i = index + 1; i < children.size(); i++) {
+ final View view = children.get(i);
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view)) {
+ addElementToRemove(view, hideOnly, interactionView, elementsToRemove);
+ } else {
+ break;
+ }
+ }
+ } else {
+ // other StateInvariant: remove the OccurrenceSpecification BEFORE it
+ if (index >= 1) {
+ final View preceding = children.get(index - 1);
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
+ addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
+ }
+ }
+ // and all the OccurrenceSpecifications on top of it (until a state change occurrence)
+ for (int i = index + 1; i < children.size(); i++) {
+ View following = null;
+ if (i + 1 < children.size()) {
+ following = children.get(i + 1);
+ }
+ final View view = children.get(i);
+ // if this is not a state change occurrence then delete it
+ if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view)
+ && (following == null || !StateInvariantUtils.isStateInvariantView(following))) {
+ addElementToRemove(view, hideOnly, interactionView, elementsToRemove);
+ } else {
+ break;
+ }
+
+ }
+ }
+ return elementsToRemove;
+ }
+
+ private static void addElementToRemove(final View viewToRemove, final boolean hideOnly, final View interactionView, final Set<EObject> elementsToRemove) {
+ final EObject element = viewToRemove.getElement();
+ elementsToRemove.add(viewToRemove);
+ if (!hideOnly) {
+ elementsToRemove.add(element);
+ }
+ if (element instanceof StateInvariant) {
+ elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(element, hideOnly, interactionView));
+ } else if (element instanceof OccurrenceSpecification) {
+ elementsToRemove.addAll(OccurrenceSpecificationUtils.getRelatedElementsToRemove(element, hideOnly, interactionView));
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public static boolean isStateInvariantView(final View view) {
+ final int visualID = UMLVisualIDRegistry.getVisualID(view);
+ return isStateInvariantEditPart(visualID);
+ }
+
+ public static boolean isStateInvariantEditPart(final int visualID) {
+ return visualID == FullStateInvariantEditPartCN.VISUAL_ID || visualID == CompactStateInvariantEditPartCN.VISUAL_ID;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
new file mode 100644
index 00000000000..5303446dc36
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+
+public final class TickUtils {
+
+ private static final String OCCURRENCE_TO_TICK_ANNOTATION = "occurrenceToTick"; //$NON-NLS-1$
+ private static final String TICK_TO_OCCURRENCE_ANNOTATION = "tickToOccurrence"; //$NON-NLS-1$
+
+ private TickUtils() {
+ // utility class
+ }
+
+ public static void associateTickNodeToOccurrenceNode(final Node tickNode, final Node occurrenceNode, final boolean overwrite) {
+ // preconditions
+ checkTickView(tickNode);
+ checkOccurrenceSpecificationView(occurrenceNode);
+ // associate tick to occurrence
+ final EAnnotation tickEAnnotation = TickUtils.getOrCreateTickEAnnotation(tickNode);
+ if (overwrite) {
+ clearTickAssociation(tickNode, tickEAnnotation);
+ }
+ Assert.isLegal(tickEAnnotation.getReferences().isEmpty(), "A tick can only be associated to one occurrence"); //$NON-NLS-1$
+ tickEAnnotation.getReferences().add(occurrenceNode);
+ // associate occurrence to tick
+ final EAnnotation occurrenceEAnnotation = TickUtils.getOrCreateOccurrenceEAnnotation(occurrenceNode);
+ occurrenceEAnnotation.getReferences().add(tickNode);
+ }
+
+ /** Remove associations for this tick to any occurrences, and from associated occurrences to this tick. */
+ private static void clearTickAssociation(final Node tickNode, final EAnnotation tickEAnnotation) {
+ final EList<EObject> references = tickEAnnotation.getReferences();
+ for (final EObject eObject : references) {
+ final EAnnotation occurrenceAnnotation = ((EModelElement) eObject).getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
+ if (occurrenceAnnotation != null) {
+ occurrenceAnnotation.getReferences().remove(tickNode);
+ }
+ }
+ tickEAnnotation.getReferences().clear();
+ }
+
+ public static Node getAssociatedOccurrenceView(final View tickView) {
+ checkTickView(tickView);
+ final EAnnotation eAnnotation = tickView.getEAnnotation(TICK_TO_OCCURRENCE_ANNOTATION);
+ if (eAnnotation != null) {
+ final EList<EObject> references = eAnnotation.getReferences();
+ if (references.isEmpty()) {
+ throw new IllegalStateException("A tick must be associated to one occurrence"); //$NON-NLS-1$
+ }
+ if (references.size() > 1) {
+ throw new IllegalStateException("A tick can be associated to only one occurrence"); //$NON-NLS-1$
+ }
+ final EObject eObject = references.get(0);
+ if (eObject instanceof Node) {
+ final Node node = (Node) eObject;
+ checkOccurrenceSpecificationView(node);
+ return node;
+ }
+ throw new IllegalStateException("A tick must be associated to an occurrence View"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static List<Node> getAssociatedTickViews(final View occurrenceView) {
+ final List<Node> result = new ArrayList<Node>();
+ checkOccurrenceSpecificationView(occurrenceView);
+ final EAnnotation eAnnotation = occurrenceView.getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
+ if (eAnnotation != null) {
+ final EList<EObject> references = eAnnotation.getReferences();
+ for (final EObject eObject : references) {
+ if (eObject instanceof Node) {
+ final Node node = (Node) eObject;
+ checkTickView(node);
+ result.add(node);
+ } else {
+ throw new IllegalStateException("Expecting only tick Nodes"); //$NON-NLS-1$
+ }
+ }
+ }
+ return result;
+ }
+
+ public static IGraphicalEditPart findOccurrenceSpecificationEditPartFromTickEditPart(final TickEditPart tickEditPart, final EditPartViewer viewer) {
+ if (tickEditPart != null) {
+ final Node tickNode = (Node) tickEditPart.getModel();
+ final Node occurrenceView = TickUtils.getAssociatedOccurrenceView(tickNode);
+ if (occurrenceView != null) {
+ final IGraphicalEditPart occurrenceSpecificationEditPart = (IGraphicalEditPart) viewer.getEditPartRegistry().get(occurrenceView);
+ if (occurrenceSpecificationEditPart != null) {
+ return occurrenceSpecificationEditPart;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static boolean containsTickFor(final View parentView, final OccurrenceSpecification occurrenceSpecification) {
+ @SuppressWarnings("unchecked")
+ final EList<View> children = parentView.getChildren();
+ for (final View child : children) {
+ checkTickView(child);
+ final Node occurrenceView = TickUtils.getAssociatedOccurrenceView(child);
+ if (occurrenceView != null) {
+ final EObject element = occurrenceView.getElement();
+ if (element == occurrenceSpecification) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static EAnnotation getOrCreateTickEAnnotation(final View tickView) {
+ checkTickView(tickView);
+ EAnnotation eAnnotation = tickView.getEAnnotation(TICK_TO_OCCURRENCE_ANNOTATION);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(TICK_TO_OCCURRENCE_ANNOTATION);
+ tickView.getEAnnotations().add(eAnnotation);
+ }
+ return eAnnotation;
+ }
+
+ private static EAnnotation getOrCreateOccurrenceEAnnotation(final View occurrenceView) {
+ checkOccurrenceSpecificationView(occurrenceView);
+ EAnnotation eAnnotation = occurrenceView.getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
+ if (eAnnotation == null) {
+ eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(OCCURRENCE_TO_TICK_ANNOTATION);
+ occurrenceView.getEAnnotations().add(eAnnotation);
+ }
+ return eAnnotation;
+ }
+
+ private static void checkTickView(final View tickView) {
+ if (!Integer.toString(TickEditPart.VISUAL_ID).equals(tickView.getType())) {
+ throw new IllegalArgumentException("The parameter must be a tick View (id = " + TickEditPart.VISUAL_ID + "). The id was " + tickView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ private static void checkOccurrenceSpecificationView(final View occurrenceSpecificationView) {
+ if (!Integer.toString(OccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())
+ && !Integer.toString(MessageOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())
+ && !Integer.toString(DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())) {
+ throw new IllegalArgumentException("The parameter must be an Occurrencespecification View. The id was " + occurrenceSpecificationView.getType()); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
new file mode 100644
index 00000000000..a1d32534496
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.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 final class TimeElementUtils {
+ private TimeElementUtils() {
+ // utility class
+ }
+
+ public static boolean isTimeElementEditPart(final int visualID) {
+ return visualID == TimeObservationEditPart.VISUAL_ID || visualID == TimeConstraintEditPart.VISUAL_ID
+ || visualID == DurationObservationEditPartCN.VISUAL_ID || visualID == DurationConstraintEditPartCN.VISUAL_ID;
+ }
+
+ public static boolean isTimeElementEditPart(final EditPart editPart) {
+ return editPart instanceof TimeObservationEditPart || editPart instanceof TimeConstraintEditPart || editPart instanceof DurationObservationEditPartCN
+ || editPart instanceof DurationConstraintEditPartCN;
+ }
+
+ /**
+ * Find time elements ({@link TimeObservation}s, {@link DurationObservation}s, {@link TimeConstraint}s and
+ * {@link DurationConstraint}s) linked to the given element.
+ *
+ * @param element
+ * the {@link OccurrenceSpecification} or {@link StateInvariant} for which related time elements must be
+ * found
+ * @param hideOnly
+ * whether to only return Views
+ * @param expectedParentView
+ * if not <code>null</code>, then only return Views under this parent View
+ * @return the list of linked time elements to remove
+ */
+ public static Set<EObject> getTimeElementsToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
+ final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getDurationObservation_Event(),
+ UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
+ final Class<?>[] expectedClasses = new Class<?>[] { TimeObservation.class, DurationObservation.class, TimeConstraint.class, DurationConstraint.class };
+ return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
new file mode 100644
index 00000000000..1df375b1c0c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimeRulerCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
+
+public final class TimeRulerUtils {
+ private TimeRulerUtils() {
+ // utility class
+ }
+
+ /**
+ * @param createViewCommand
+ *
+ * @param editPart
+ * @param visible
+ * @return
+ */
+ /**
+ * @param createViewCommand
+ * the command that creates a Lifeline or Interaction View
+ * @param editingDomain
+ * an editing domain
+ * @param visible
+ * whether the time ruler should be visible initially
+ * @return the time ruler creation command
+ */
+ public static ICommand getCreateFreeTimeRulerCommand(final Command createViewCommand, final TransactionalEditingDomain editingDomain, final boolean visible) {
+ final CommandResult superCommandResult = ((ICommandProxy) createViewCommand).getICommand().getCommandResult();
+ // final Interaction interaction = (Interaction) superCommandResult.getElement();
+ if (editingDomain == null) {
+ throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
+ }
+
+ final AbstractTransactionalCommand createFreeTimeRulerCommand = new AbstractTransactionalCommand(editingDomain,
+ Messages.CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // the result from the super command that creates the view
+ final ViewDescriptor viewDescriptor = (ViewDescriptor) superCommandResult.getReturnValue();
+ final View view = (View) viewDescriptor.getAdapter(View.class);
+ final Node freeTimeRulerNode = createFreeTimeRuler(view);
+ final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(view);
+ timeRulerCompartmentView.setVisible(visible);
+ return CommandResult.newOKCommandResult(freeTimeRulerNode);
+ }
+ };
+ return createFreeTimeRulerCommand;
+ }
+
+ public static Node createFreeTimeRuler(final View view) {
+ final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(view);
+ final UMLViewProvider umlViewProvider = new UMLViewProvider();
+ return umlViewProvider.createNode_24(null, timeRulerCompartmentView, 0, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ }
+
+ /**
+ * Find and return the FreeTimeRulerCompartmentEditPart in the Lifeline or Interaction that contains the given
+ * editPart. If the containing Lifeline has a time ruler, then return it. Otherwise, return the containing
+ * Interaction's time ruler.
+ */
+ public static IGraphicalEditPart findClosestTimeRuler(final IGraphicalEditPart editPart) {
+ IGraphicalEditPart lifelineEditPart = (IGraphicalEditPart) EditPartUtils.findParentEditPartWithId(editPart, CompactLifelineEditPartCN.VISUAL_ID);
+ if (lifelineEditPart == null) {
+ lifelineEditPart = (IGraphicalEditPart) EditPartUtils.findParentEditPartWithId(editPart, FullLifelineEditPartCN.VISUAL_ID);
+ }
+ if (lifelineEditPart != null) {
+ IGraphicalEditPart tickContainerEditPart = (IGraphicalEditPart) EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart,
+ FreeTimeRulerCompartmentEditPart.VISUAL_ID);
+ if (tickContainerEditPart == null) {
+ // then tickContainer is in the Interaction
+ final IGraphicalEditPart interactionEditPart = (IGraphicalEditPart) EditPartUtils.findParentEditPartWithId(lifelineEditPart,
+ InteractionEditPartTN.VISUAL_ID);
+ if (interactionEditPart != null) {
+ final IGraphicalEditPart interactionTimeRulerCompartmentEditPart = (IGraphicalEditPart) EditPartUtils.findFirstChildEditPartWithId(
+ interactionEditPart, TimeRulerCompartmentEditPartCN.VISUAL_ID);
+ if (interactionTimeRulerCompartmentEditPart != null) {
+ tickContainerEditPart = (IGraphicalEditPart) EditPartUtils.findFirstChildEditPartWithId(interactionTimeRulerCompartmentEditPart,
+ FreeTimeRulerCompartmentEditPart.VISUAL_ID);
+ }
+ }
+ }
+ return tickContainerEditPart;
+ }
+ return null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
new file mode 100644
index 00000000000..662fe71b801
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.swt.widgets.Display;
+
+public final class Utils {
+ private Utils() {
+ // utility class
+ }
+
+ public static boolean safeEquals(final Object a, final Object b) {
+ if (a == null) {
+ return b == null;
+ }
+ return a.equals(b);
+ }
+
+ /**
+ * Find elements linked to the given element (only Views if viewsOnly=true, otherwise both Views and semantic
+ * elements are returned)
+ *
+ * @param element
+ * the element for which related elements must be found
+ * @param references
+ * the references through which the referencing elements must be found
+ * @param viewsOnly
+ * whether to only return Views (otherwise both Views and semantic elements are returned).
+ * @param expectedParentView
+ * if not <code>null</code>, then only return Views under this parent View
+ * @param expectedClasses
+ * the classes of referencing elements to remove
+ * @return the list of linked elements to remove
+ */
+ public static Set<EObject> getReferencingElementsToRemove(final EObject element, final EReference[] references, final boolean viewsOnly,
+ final View expectedParentView, final Class<?>[] expectedClasses) {
+ final Set<EObject> referencingElements = new HashSet<EObject>();
+ final Collection<?> referencers = EMFCoreUtil.getReferencers(element, references);
+ for (final Object object : referencers) {
+ if (object instanceof EObject && isExpectedClass(object, expectedClasses)) {
+ final EObject eObject = (EObject) object;
+ if (!viewsOnly) {
+ referencingElements.add(eObject);
+ }
+ final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(eObject, TimingDiagramEditPart.MODEL_ID);
+ for (final View view : crossReferencingViews) {
+ if (expectedParentView == null || ViewUtils.isContained(view, expectedParentView)) {
+ referencingElements.add(view);
+ }
+ }
+ }
+ }
+ return referencingElements;
+ }
+
+ private static boolean isExpectedClass(final Object object, final Class<?>[] expectedClasses) {
+ for (final Class<?> expectedClass : expectedClasses) {
+ if (expectedClass.isInstance(object)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Executes the given command in an "unprotected" transaction, without recording it on the undo/redo stack. The
+ * command is scheduled to be executed later, in order to be run outside any currently running transaction.
+ *
+ * @param command
+ * the command to execute
+ * @param domain
+ * the editing domain
+ */
+ public static void executeLaterUnprotected(final Command command, final TransactionalEditingDomain domain) {
+ Display.getCurrent().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ final Map<String, Boolean> options = Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
+ final AbstractEMFOperation operation = new AbstractEMFOperation(domain, StringStatics.BLANK, options) {
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ command.execute();
+ return Status.OK_STATUS;
+ }
+ };
+ operation.execute(new NullProgressMonitor(), null);
+ } catch (final Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * Find model elements linked to the given element
+ *
+ * @param element
+ * the element for which related elements must be found
+ * @param references
+ * the references through which the referencing elements must be found
+ * @param expectedClasses
+ * the classes of referencing elements to look for
+ * @return the list of linked elements
+ */
+ public static Set<EObject> findReferencingElements(final EObject element, final EReference[] references, final Class<?>[] expectedClasses) {
+ final Set<EObject> referencingElements = new HashSet<EObject>();
+ final Collection<?> referencers = EMFCoreUtil.getReferencers(element, references);
+ for (final Object object : referencers) {
+ if (object instanceof EObject && isExpectedClass(object, expectedClasses)) {
+ final EObject eObject = (EObject) object;
+ referencingElements.add(eObject);
+ }
+ }
+ return referencingElements;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
new file mode 100644
index 00000000000..a65ec8aa787
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
@@ -0,0 +1,270 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.timing.custom.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
+import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineTimeRulerCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineStateDefinitionCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimeRulerCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionCompartmentEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.swt.widgets.Display;
+
+public class ViewUtils {
+ public static View findFullLifelineCompartmentView(final View lifelineView) {
+ final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ if (timelineCompartmentViews.size() < 1) {
+ throw new IllegalStateException("No timeline compartment found in the lifeline View"); //$NON-NLS-1$
+ }
+ return timelineCompartmentViews.get(0);
+ }
+
+ public static View findCompactTimelineCompartmentView(final View lifelineView) {
+ final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ if (timelineCompartmentViews.size() < 1) {
+ throw new IllegalStateException("No timeline compartment found in the lifeline View"); //$NON-NLS-1$
+ }
+ return timelineCompartmentViews.get(0);
+ }
+
+ public static View findChildTimelineCompartmentView(final View view) {
+ List<View> timelineCompartmentViews = findSubViewsWithId(view, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ if (!timelineCompartmentViews.isEmpty()) {
+ return timelineCompartmentViews.get(0);
+ }
+ timelineCompartmentViews = findSubViewsWithId(view, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ if (!timelineCompartmentViews.isEmpty()) {
+ return timelineCompartmentViews.get(0);
+ }
+ throw new IllegalStateException("No timeline compartment found in the given View"); //$NON-NLS-1$
+ }
+
+ public static View findTimeRulerCompartmentView(final View view) {
+ List<View> timeRulerCompartmentViews = findSubViewsWithId(view, TimeRulerCompartmentEditPartCN.VISUAL_ID);
+ if (!timeRulerCompartmentViews.isEmpty()) {
+ return timeRulerCompartmentViews.get(0);
+ }
+ timeRulerCompartmentViews = findSubViewsWithId(view, FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID);
+ if (!timeRulerCompartmentViews.isEmpty()) {
+ return timeRulerCompartmentViews.get(0);
+ }
+ timeRulerCompartmentViews = findSubViewsWithId(view, CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID);
+ if (!timeRulerCompartmentViews.isEmpty()) {
+ return timeRulerCompartmentViews.get(0);
+ }
+ throw new IllegalStateException("No timeruler compartment found in the View"); //$NON-NLS-1$
+ }
+
+ public static View findInteractionCompartmentView(final View interactionView) {
+ final List<View> timelineCompartmentViews = findSubViewsWithId(interactionView, InteractionCompartmentEditPartTN.VISUAL_ID);
+ if (timelineCompartmentViews.isEmpty()) {
+ throw new IllegalStateException("No interaction compartment found in the interaction View"); //$NON-NLS-1$
+ }
+ return timelineCompartmentViews.get(0);
+ }
+
+ public static View findStateDefinitionCompartmentView(final View lifelineView) {
+ final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID);
+ if (timelineCompartmentViews.isEmpty()) {
+ throw new IllegalStateException("No state definition compartment found in the lifeline View"); //$NON-NLS-1$
+ }
+ return timelineCompartmentViews.get(0);
+ }
+
+ public static View findFirstChildViewWithId(final View view, final int visualId) {
+ final List<View> result = findSubViewsWithId(view, visualId);
+ if (result.isEmpty()) {
+ return null;
+ }
+ return result.get(0);
+ }
+
+ public static List<View> findSubViewsWithId(final View view, final int visualId) {
+ final List<View> views = new ArrayList<View>();
+ internalFindSubViewsWithId(view, visualId, views);
+ return views;
+ }
+
+ private static List<View> internalFindSubViewsWithId(final View view, final int visualId, final List<View> result) {
+ // the javadoc says it's a list of Views
+ @SuppressWarnings("unchecked")
+ final EList<View> children = view.getChildren();
+ for (final View child : children) {
+ if (UMLVisualIDRegistry.getVisualID(child) == visualId) {
+ result.add(child);
+ }
+ internalFindSubViewsWithId(child, visualId, result);
+ }
+ return null;
+ }
+
+ public static View findSuperViewWithId(final View view, final int visualId) {
+ EObject parent = view;
+ while (parent != null) {
+ if (parent instanceof View) {
+ final View parentView = (View) parent;
+ if (UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
+ return parentView;
+ }
+ }
+ parent = parent.eContainer();
+ }
+ return null;
+ }
+
+ public static String getContainingDiagramType(final View view) {
+ if (view instanceof Diagram) {
+ final Diagram diagram = (Diagram) view;
+ return diagram.getType();
+ }
+ final EObject eContainer = view.eContainer();
+ if (eContainer instanceof View) {
+ final View parentView = (View) eContainer;
+ return getContainingDiagramType(parentView);
+ }
+ return null;
+ }
+
+ public static ICommand getMoveViewCommand(final View parentView, final View viewToMove, final int targetIndex) {
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(parentView);
+ return new AbstractTransactionalCommand(editingDomain, Messages.ViewUtils_MoveView, null, null) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ int newIndex = targetIndex;
+ final EList<?> children = parentView.getChildren();
+ final int size = children.size();
+ final int index = children.indexOf(viewToMove);
+ if (index < targetIndex) {
+ // account for the removed child
+ newIndex--;
+ }
+ if (newIndex < 0) {
+ newIndex = 0;
+ }
+ if (newIndex > size - 1) {
+ newIndex = size - 1;
+ }
+ ViewUtil.repositionChildAt(parentView, viewToMove, newIndex);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ }
+
+ public static boolean isContained(final View child, final View parent) {
+ View view = child;
+ while (view != null) {
+ if (view == parent) {
+ return true;
+ }
+ final EObject eContainer = view.eContainer();
+ if (eContainer instanceof View) {
+ view = (View) eContainer;
+ } else {
+ break;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isViewFor(final View view, final EClass... eClasses) {
+ final EObject element = view.getElement();
+ for (final EClass eClass : eClasses) {
+ if (eClass.isInstance(element)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /** Returns whether the given View contains a child View for the given {@link EObject} */
+ public static boolean containsViewFor(final View parentView, final EObject eObject) {
+ if (parentView.getElement() == eObject) {
+ return true;
+ }
+ @SuppressWarnings("unchecked")
+ final EList<View> children = parentView.getChildren();
+ for (final View child : children) {
+ if (containsViewFor(child, eObject)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether the diagram that contains the given referenceView contains a {@link Connector} for the given
+ * EObject.
+ */
+ public static boolean containsConnectorFor(final View referenceView, final EObject eObject) {
+ final View parentDiagramView1 = ViewUtils.findSuperViewWithId(referenceView, TimingDiagramEditPart.VISUAL_ID);
+ final Set<View> existingViews = CrossReferencerUtil.getCrossReferencingViews(eObject, TimingDiagramEditPart.MODEL_ID);
+ for (final View existingView : existingViews) {
+ if (existingView instanceof Connector) {
+ final View parentDiagramView2 = ViewUtils.findSuperViewWithId(existingView, TimingDiagramEditPart.VISUAL_ID);
+ if (parentDiagramView1 == parentDiagramView2) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void selectInViewer(final View view, final EditPartViewer viewer) {
+ final EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(view);
+ if (editPart != null) {
+ viewer.setSelection(new StructuredSelection(editPart));
+ }
+ }
+
+ public static void performEditRequest(final View view, final EditPartViewer viewer) {
+ final EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(view);
+ if (editPart != null) {
+ // viewer.setSelection(new StructuredSelection(editPart));
+ Display.getCurrent().asyncExec(new Runnable() {
+ public void run() {
+ if (editPart.isActive()) {
+ editPart.performRequest(new Request(RequestConstants.REQ_DIRECT_EDIT));
+ EditPartUtils.revealEditPart(editPart);
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/Diagram_Timing.gif b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/Diagram_Timing.gif
new file mode 100644
index 00000000000..d76518956bd
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/Diagram_Timing.gif
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/UMLDiagramFile.gif b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/UMLDiagramFile.gif
new file mode 100644
index 00000000000..de938070dea
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/UMLDiagramFile.gif
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png
new file mode 100644
index 00000000000..dea09bea3c5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png
new file mode 100644
index 00000000000..401acbbfff0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png
new file mode 100644
index 00000000000..673d2ad0b6f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/tick.png b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/tick.png
new file mode 100644
index 00000000000..aa3f2fdd07c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/tick.png
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/wizban/NewUMLWizard.gif b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/wizban/NewUMLWizard.gif
new file mode 100644
index 00000000000..83e03bf39bf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/icons/wizban/NewUMLWizard.gif
Binary files differ
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/messages.properties b/incoming/org.eclipse.papyrus.uml.diagram.timing/messages.properties
new file mode 100644
index 00000000000..a1d8d1e5f13
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/messages.properties
@@ -0,0 +1,116 @@
+###############################################################################
+# Copyright (c) 2012 CEA LIST.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+
+# TODO: manually put keys and values
+UMLCreationWizardTitle=New PapyrusUMLTimingDiagram Diagram
+UMLCreationWizard_DiagramModelFilePageTitle=Create PapyrusUMLTimingDiagram Diagram
+UMLCreationWizard_DiagramModelFilePageDescription=Select file that will contain diagram model.
+UMLCreationWizard_DomainModelFilePageTitle=Create PapyrusUMLTimingDiagram Domain Model
+UMLCreationWizard_DomainModelFilePageDescription=Select file that will contain domain model.
+UMLCreationWizardOpenEditorError=Error opening diagram editor
+UMLCreationWizardCreationError=Creation Problems
+UMLCreationWizardPageExtensionError=File name should have {0} extension.
+UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle=Error
+UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage=Failed to load model file {0}
+UMLDiagramEditorUtil_CreateDiagramProgressTask=Creating diagram and model files
+UMLDiagramEditorUtil_CreateDiagramCommandLabel=Creating diagram and model
+UMLDocumentProvider_isModifiable=Updating cache failed
+UMLDocumentProvider_handleElementContentChanged=Failed to refresh hierarchy for changed resource
+UMLDocumentProvider_IncorrectInputError={1}
+UMLDocumentProvider_NoDiagramInResourceError=Diagram is not present in resource
+UMLDocumentProvider_DiagramLoadingError=Error loading diagram
+UMLDocumentProvider_UnsynchronizedFileSaveError=The file has been changed on the file system
+UMLDocumentProvider_SaveDiagramTask=Saving diagram
+UMLDocumentProvider_SaveNextResourceTask=Saving {0}
+UMLDocumentProvider_SaveAsOperation=Saving {0} diagram as
+InitDiagramFile_ResourceErrorDialogTitle=Error
+InitDiagramFile_ResourceErrorDialogMessage=Model file loading failed
+InitDiagramFile_WizardTitle=Initialize new {0} diagram file
+InitDiagramFile_OpenModelFileDialogTitle=Select domain model
+UMLNewDiagramFileWizard_CreationPageName=Initialize new diagram file
+UMLNewDiagramFileWizard_CreationPageTitle=Diagram file
+UMLNewDiagramFileWizard_CreationPageDescription=Create new diagram based on {0} model content
+UMLNewDiagramFileWizard_RootSelectionPageName=Select diagram root element
+UMLNewDiagramFileWizard_RootSelectionPageTitle=Diagram root element
+UMLNewDiagramFileWizard_RootSelectionPageDescription=Select semantic model element to be depicted on diagram
+UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle=Select diagram root element:
+UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage=Diagram root element is not selected
+UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage=Invalid diagram root element is selected
+UMLNewDiagramFileWizard_InitDiagramCommand=Initializing diagram contents
+UMLNewDiagramFileWizard_IncorrectRootError=Incorrect model object stored as a root resource object
+UMLDiagramEditor_SavingDeletedFile=The original file "{0}" has been deleted.
+UMLDiagramEditor_SaveAsErrorTitle=Problem During Save As...
+UMLDiagramEditor_SaveAsErrorMessage=Save could not be completed. Target file is already open in another editor.
+UMLDiagramEditor_SaveErrorTitle=Save Problems
+UMLDiagramEditor_SaveErrorMessage=Could not save file.
+UMLElementChooserDialog_SelectModelElementTitle=Select model element
+ModelElementSelectionPageMessage=Select model element:
+ValidateActionMessage=Validate
+createNodesGroup_title=Nodes
+createEdgesGroup_title=Edges
+createInteractionCreationTool_title=Interaction
+createInteractionCreationTool_desc=Interaction
+createLifelineCreationTool_title=Lifeline
+createLifelineCreationTool_desc=Lifeline
+createStateDefinitionCreationTool_title=State Definition
+createStateDefinitionCreationTool_desc=State Definition
+createTimeObservationCreationTool_title=TimeObservation
+createTimeObservationCreationTool_desc=TimeObservation
+createTimeConstraintCreationTool_title=TimeConstraint
+createTimeConstraintCreationTool_desc=TimeConstraint
+createDurationObservationCreationTool_title=DurationObservation
+createDurationObservationCreationTool_desc=DurationObservation
+createDurationConstraintCreationTool_title=DurationConstraint
+createDurationConstraintCreationTool_desc=DurationConstraint
+createOccurrenceSpecificationCreationTool_title=Event (OccurrenceSpecification)
+createOccurrenceSpecificationCreationTool_desc=Event (OccurrenceSpecification)
+createTickCreationTool_title=Tick
+createTickCreationTool_desc=Tick
+createDestructionOccurrenceSpecificationCreationTool_title=DestructionOccurrenceSpecification
+createDestructionOccurrenceSpecificationCreationTool_desc=DestructionOccurrenceSpecification
+InteractionCompartmentEditPartTN_title=InteractionCompartment
+FullLifelineStateDefinitionCompartmentEditPartCN_title=FullLifelineStateDefinitionCompartment
+FullLifelineTimelineCompartmentEditPartCN_title=FullLifelineTimelineCompartment
+CompactLifelineCompartmentEditPartCN_title=CompactLifelineCompartment
+TimeRulerCompartmentEditPartCN_title=TimeRulerCompartment
+
+CommandName_OpenDiagram=Open Diagram
+NavigatorActionProvider_OpenDiagramActionName=Open Diagram
+AbstractParser_UnexpectedValueType=Value of type {0} is expected
+AbstractParser_WrongStringConversion=String value does not convert to {0} value
+AbstractParser_UnknownLiteral=Unknown literal: {0}
+
+MessageFormatParser_InvalidInputError=Invalid input at {0}
+UMLModelingAssistantProviderTitle=Select domain model element
+UMLModelingAssistantProviderMessage=Available domain model elements:
+
+createMessageSyncCreationTool_title=Sync Message
+createMessageSyncCreationTool_desc=Sync Message
+createMessageAsyncCreationTool_title=Async Message
+createMessageAsyncCreationTool_desc=Async Message
+createMessageReplyCreationTool_title=Message Reply
+createMessageReplyCreationTool_desc=Message Reply
+createCreateMessageCreationTool_title=Create Message
+createCreateMessageCreationTool_desc=Create Message
+createDeleteMessageCreationTool_title=Delete Message
+createDeleteMessageCreationTool_desc=Delete Message
+createLostMessageCreationTool_title=Lost Message
+createLostMessageCreationTool_desc=Lost Message
+createFoundMessageCreationTool_title=Found Message
+createFoundMessageCreationTool_desc=Found Message
+createGeneralOrderingCreationTool_title=General Ordering
+createGeneralOrderingCreationTool_desc=General Ordering
+createGateCreationTool_title=Gate
+createGateCreationTool_desc=Gate
+
+FreeTimeRulerCompartmentEditPart_title=FreeTimeRulerCompartment
+LinearTimeRulerCompartmentEditPart_title=LinearTimeRulerCompartment
+
+FullLifelineTimeRulerCompartmentEditPartCN_title=FullLifelineTimeRuler
+CompactLifelineTimeRulerCompartmentEditPartCN_title=CompactLifelineTimeRuler
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen b/incoming/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen
new file mode 100644
index 00000000000..19281e162a3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen
@@ -0,0 +1,2164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel"
+ xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension">
+ <gmfgen:GenEditorGenerator
+ packageNamePrefix="org.eclipse.papyrus.uml.diagram.timing"
+ modelID="PapyrusUMLTimingDiagram"
+ diagramFileExtension="PapyrusUMLTiming_diagram"
+ domainFileExtension="PapyrusUMLTiming"
+ dynamicTemplates="true"
+ templateDirectory="/org.eclipse.papyrus.def/dynamic-templates3.5/codegen"
+ copyrightText="Copyright (c) 2012 CEA LIST.&#xD;&#xA;&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html"
+ pluginDirectory="/org.eclipse.papyrus.uml.diagram.timing/src">
+ <diagram
+ visualID="1"
+ editPartClassName="TimingDiagramEditPart"
+ itemSemanticEditPolicyClassName="TimingDiagramEditPartFactoryItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="TimingDiagramCanonicalEditPolicy"
+ validationEnabled="true"
+ validationDecorators="true"
+ liveValidationUIFeedback="true"
+ synchronized="false">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ displayName="TimingDiagram"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomTimingDiagramCreationEditPolicy"/>
+ <domainDiagramElement href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
+ <childNodes
+ visualID="19"
+ editPartClassName="FullLifelineEditPartCN"
+ itemSemanticEditPolicyClassName="FullLifelineItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="FullLifelineCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.1 /0/@diagram/@compartments.2 /0/@diagram/@compartments.5"
+ graphicalNodeEditPolicyClassName="FullLifelineGraphicalNodeEditPolicyCN"
+ createCommandClassName="FullLifelineCreateCommandCN"
+ containers="/0/@diagram/@compartments.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="FullLifeline"
+ metamodelType="/0/@diagram/@childNodes.17/@elementType"
+ editHelperAdviceClassName="FullLifelineEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullLifelineFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineItemSemanticEditPolicyCN"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimeRulerVisibilityRefreshEditPolicy.ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimeRulerVisibilityRefreshEditPolicy"/>
+ <modelFacet modelElementSelector="/0/@expressionProviders/@providers.2/@expressions.0">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/lifeline"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/lifeline"/>
+ </modelFacet>
+ <labels
+ visualID="21"
+ editPartClassName="FullLifelineNameEditPart"
+ itemSemanticEditPolicyClassName="FullLifelineNameItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getLifelineLabelFigure"
+ figureQualifiedClassName=" org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineNameEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="20"
+ editPartClassName="CompactLifelineEditPartCN"
+ itemSemanticEditPolicyClassName="CompactLifelineItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="CompactLifelineCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.3 /0/@diagram/@compartments.6"
+ graphicalNodeEditPolicyClassName="CompactLifelineGraphicalNodeEditPolicyCN"
+ createCommandClassName="CompactLifelineCreateCommandCN"
+ containers="/0/@diagram/@compartments.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="CompactLifeline"
+ metamodelType="/0/@diagram/@childNodes.17/@elementType"
+ editHelperAdviceClassName="CompactLifelineEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactLifelineFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactLifelineItemSemanticEditPolicyCN"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimeRulerVisibilityRefreshEditPolicy.ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimeRulerVisibilityRefreshEditPolicy"/>
+ <modelFacet modelElementSelector="/0/@expressionProviders/@providers.2/@expressions.1">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/lifeline"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/lifeline"/>
+ </modelFacet>
+ <labels
+ visualID="22"
+ editPartClassName="CompactLifelineNameEditPart"
+ itemSemanticEditPolicyClassName="CompactLifelineNameItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getLifelineLabelFigure"
+ figureQualifiedClassName=" org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineNameEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="11"
+ editPartClassName="FullStateInvariantEditPartCN"
+ itemSemanticEditPolicyClassName="FullStateInvariantItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="FullStateInvariantCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="FullStateInvariantGraphicalNodeEditPolicyCN"
+ createCommandClassName="FullStateInvariantCreateCommandCN"
+ containers="/0/@diagram/@compartments.2">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.FullStateInvariant_11"
+ displayName="FullStateInvariant"
+ editHelperClassName="FullStateInvariantEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullStateFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullStateInvariantItemSemanticEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateInvariant"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="62"
+ editPartClassName="FullStateInvariantAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="FullStateInvariantAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="28"
+ editPartClassName="CompactStateInvariantEditPartCN"
+ itemSemanticEditPolicyClassName="CompactStateInvariantItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="CompactStateInvariantCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="CompactStateInvariantGraphicalNodeEditPolicyCN"
+ createCommandClassName="CompactStateInvariantCreateCommandCN"
+ containers="/0/@diagram/@compartments.3">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.CompactStateInvariant_28"
+ displayName="CompactStateInvariant"
+ metamodelType="/0/@diagram/@childNodes.2/@elementType"
+ editHelperAdviceClassName="CompactStateInvariantEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactStateFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactStateInvariantItemSemanticEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateInvariant"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/fragment"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/fragment"/>
+ </modelFacet>
+ <labels
+ visualID="31"
+ editPartClassName="CompactStateInvariantNameEditPart"
+ itemSemanticEditPolicyClassName="CompactStateInvariantNameItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompactStateInvariantLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="64"
+ editPartClassName="StateInvariantAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="StateInvariantAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="12"
+ editPartClassName="OccurrenceSpecificationEditPartCN"
+ itemSemanticEditPolicyClassName="OccurrenceSpecificationItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="OccurrenceSpecificationCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="OccurrenceSpecificationGraphicalNodeEditPolicyCN"
+ createCommandClassName="OccurrenceSpecificationCreateCommandCN"
+ containers="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.OccurrenceSpecification_12"
+ displayName="OccurrenceSpecification"
+ editHelperClassName="OccurrenceSpecificationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="4"
+ height="4"/>
+ <attributes
+ xsi:type="gmfgen:ColorAttributes"
+ foregroundColor="darkGreen"
+ backgroundColor="darkGreen"/>
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedForeground="true"
+ fixedBackground="true"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomOccurrenceSpecificationItemSemanticEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/OccurrenceSpecification"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="10"
+ editPartClassName="OccurrenceSpecificationLabelEditPart"
+ itemSemanticEditPolicyClassName="OccurrenceSpecificationLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="18"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="58"
+ editPartClassName="OccurrenceSpecificationAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="OccurrenceSpecificationAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="13"
+ editPartClassName="MessageOccurrenceSpecificationEditPartCN"
+ itemSemanticEditPolicyClassName="MessageOccurrenceSpecificationItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="MessageOccurrenceSpecificationCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="MessageOccurrenceSpecificationGraphicalNodeEditPolicyCN"
+ createCommandClassName="MessageOccurrenceSpecificationCreateCommandCN"
+ containers="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageOccurrenceSpecification_13"
+ displayName="MessageOccurrenceSpecification"
+ editHelperClassName="MessageOccurrenceSpecificationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomMessageOccurrenceSpecificationItemSemanticEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/MessageOccurrenceSpecification"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="14"
+ editPartClassName="MessageOccurrenceSpecificationLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageOccurrenceSpecificationLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="18"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="59"
+ editPartClassName="MessageOccurrenceSpecificationAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageOccurrenceSpecificationAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="9"
+ editPartClassName="StateDefinitionEditPart"
+ itemSemanticEditPolicyClassName="StateDefinitionItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="StateDefinitionCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="StateDefinitionGraphicalNodeEditPolicy"
+ createCommandClassName="StateDefinitionCreateCommand"
+ containers="/0/@diagram/@compartments.1">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ displayName="StateDefinition"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.StateDefinitionFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <labels
+ visualID="38"
+ editPartClassName="StateDefinitionLabelEditPart"
+ itemSemanticEditPolicyClassName="StateDefinitionLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ displayName="StateDefinitionLabel"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:DesignLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.3"/>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="39"
+ editPartClassName="FullStateInvariantVerticalLineEditPart"
+ itemSemanticEditPolicyClassName="FullStateInvariantVerticalLineItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="FullStateInvariantVerticalLineCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="FullStateInvariantVerticalLineGraphicalNodeEditPolicy"
+ createCommandClassName="FullStateInvariantVerticalLineCreateCommand"
+ containers="/0/@diagram/@compartments.2">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ displayName="VerticalLineStateInvariant"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullStateInvariantVerticalLineFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ </childNodes>
+ <childNodes
+ visualID="15"
+ editPartClassName="TimeConstraintEditPart"
+ itemSemanticEditPolicyClassName="TimeConstraintItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="TimeConstraintCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="TimeConstraintGraphicalNodeEditPolicy"
+ createCommandClassName="TimeConstraintCreateCommand"
+ containers="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.TimeConstraint_15"
+ displayName="TimeConstraint"
+ editHelperClassName="TimeConstraintEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.FirstEventRefreshEditPolicy.VIEW_REFRESH_ROLE"
+ editPolicyQualifiedClassName=" org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.FirstEventRefreshEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/TimeConstraint"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="30">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="-5"
+ y="-15"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.2">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="65"
+ editPartClassName="TimeConstraintAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="TimeConstraintAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="16"
+ editPartClassName="TimeObservationEditPart"
+ itemSemanticEditPolicyClassName="TimeObservationItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="TimeObservationCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="TimeObservationGraphicalNodeEditPolicy"
+ createCommandClassName="TimeObservationCreateCommand"
+ containers="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.TimeObservation_16"
+ displayName="TimeObservation"
+ editHelperClassName="TimeObservationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.FirstEventRefreshEditPolicy.VIEW_REFRESH_ROLE"
+ editPolicyQualifiedClassName=" org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.FirstEventRefreshEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/TimeObservation"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="34">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="-5"
+ y="-15"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="66"
+ editPartClassName="TimeObservationAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="TimeObservationAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="18"
+ editPartClassName="DurationConstraintEditPartCN"
+ itemSemanticEditPolicyClassName="DurationConstraintItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="DurationConstraintCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="DurationConstraintGraphicalNodeEditPolicyCN"
+ createCommandClassName="DurationConstraintCreateCommandCN"
+ containers="/0/@diagram/@compartments.3 /0/@diagram/@compartments.2">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.DurationConstraint_18"
+ displayName="DurationConstraint"
+ editHelperClassName="DurationConstraintEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.DimensioningArrowFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationConstraint"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="33">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="15"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.2">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="17"
+ editPartClassName="DurationObservationEditPartCN"
+ itemSemanticEditPolicyClassName="DurationObservationItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="DurationObservationCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="DurationObservationGraphicalNodeEditPolicyCN"
+ createCommandClassName="DurationObservationCreateCommandCN"
+ containers="/0/@diagram/@compartments.3 /0/@diagram/@compartments.2">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.DurationObservation_17"
+ displayName="DurationObservation"
+ editHelperClassName="DurationObservationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.DimensioningArrowFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationObservation"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="35">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="15"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="67"
+ editPartClassName="GeneralOrderingEditPart"
+ itemSemanticEditPolicyClassName="GeneralOrderingItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="GeneralOrderingCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="GeneralOrderingGraphicalNodeEditPolicy"
+ createCommandClassName="GeneralOrderingCreateCommand"
+ containers="/0/@diagram/@compartments.3 /0/@diagram/@compartments.2">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.GeneralOrdering_67"
+ displayName="GeneralOrdering"
+ editHelperClassName="GeneralOrderingEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.GeneralOrderingHorizontalFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/GeneralOrdering"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InteractionFragment/generalOrdering"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InteractionFragment/generalOrdering"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="68">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="-5"
+ y="-15"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="24"
+ editPartClassName="FreeTimingRulerEditPartCN"
+ itemSemanticEditPolicyClassName="FreeTimingRulerItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="FreeTimingRulerCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.7"
+ graphicalNodeEditPolicyClassName="FreeTimingRulerGraphicalNodeEditPolicyCN"
+ createCommandClassName="FreeTimingRulerCreateCommandCN"
+ containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.5 /0/@diagram/@compartments.6">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ displayName="FreeTimingRuler"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.TimingRulerFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ </childNodes>
+ <childNodes
+ visualID="25"
+ editPartClassName="LinearTimingRulerEditPartCN"
+ itemSemanticEditPolicyClassName="LinearTimingRulerItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="LinearTimingRulerCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.8"
+ graphicalNodeEditPolicyClassName="LinearTimingRulerGraphicalNodeEditPolicyCN"
+ createCommandClassName="LinearTimingRulerCreateCommandCN"
+ containers="/0/@diagram/@compartments.4">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ displayName="LinearTimingRuler"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.TimingRulerFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ </childNodes>
+ <childNodes
+ visualID="26"
+ editPartClassName="TickEditPart"
+ itemSemanticEditPolicyClassName="TickItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="TickCanonicalEditPolicy"
+ primaryDragEditPolicyQualifiedClassName=""
+ graphicalNodeEditPolicyClassName="TickGraphicalNodeEditPolicy"
+ createCommandClassName="TickCreateCommand"
+ containers="/0/@diagram/@compartments.7 /0/@diagram/@compartments.8">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ displayName="Tick"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="5"
+ height="12"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="36"
+ editPartClassName="TickNameEditPart"
+ itemSemanticEditPolicyClassName="TickNameItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="12"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:DesignLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.1"/>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="27"
+ editPartClassName="DestructionOccurrenceSpecificationEditPartCN"
+ itemSemanticEditPolicyClassName="DestructionOccurrenceSpecificationItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="DestructionOccurrenceSpecificationCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="DestructionOccurrenceSpecificationGraphicalNodeEditPolicyCN"
+ createCommandClassName="DestructionOccurrenceSpecificationCreateCommandCN"
+ containers="/0/@diagram/@compartments.3 /0/@diagram/@compartments.2">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.DestructionOccurrenceSpecification_27"
+ displayName="DestructionOccurrenceSpecification"
+ editHelperClassName="DestructionOccurrenceSpecificationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.CrossFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DestructionOccurrenceSpecification"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline/coveredBy"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="32"
+ editPartClassName="DestructionOccurrenceSpecificationLabelEditPart"
+ itemSemanticEditPolicyClassName="DestructionOccurrenceSpecificationLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="18"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="63"
+ editPartClassName="DestructionOccurrenceSpecificationAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="DestructionOccurrenceSpecificationAppliedStereotypeItemSemanticEditPolicy"
+ readOnly="true">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.4"
+ viewPattern="&lt;&lt;{0}>>"
+ editorPattern="&lt;&lt;{0}>>"
+ editPattern="&lt;&lt;{0}>>">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="40"
+ editPartClassName="LifelineEditPart"
+ itemSemanticEditPolicyClassName="LifelineItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="LifelineCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="LifelineGraphicalNodeEditPolicy"
+ createCommandClassName="LifelineCreateCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.Lifeline_40"
+ editHelperClassName="LifelineEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineFigure"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Lifeline"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/lifeline"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/lifeline"/>
+ </modelFacet>
+ </childNodes>
+ <childNodes
+ xsi:type="gmfgen:GenChildSideAffixedNode"
+ visualID="69"
+ containers="/0/@diagram/@topLevelNodes.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ displayName="Gate"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.GateFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomGateItemSemanticEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Gate"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/formalGate"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="70"
+ editPartClassName="GateLabelEditPart"
+ itemSemanticEditPolicyClassName="GateLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="20"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <topLevelNodes
+ visualID="2"
+ editPartClassName="InteractionEditPartTN"
+ itemSemanticEditPolicyClassName="InteractionNodeItemSemanticEditPolicyTN"
+ canonicalEditPolicyClassName="InteractionNodeCanonicalEditPolicyTN"
+ childNodes="/0/@diagram/@childNodes.18"
+ compartments="/0/@diagram/@compartments.0 /0/@diagram/@compartments.4"
+ graphicalNodeEditPolicyClassName="InteractionNodeGraphicalNodeEditPolicyTN"
+ createCommandClassName="InteractionCreateCommandTN">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.Interaction_2"
+ displayName="Interaction"
+ editHelperClassName="InteractionEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.CustomInteractionRectangleFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="600"
+ height="400"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCreationEditPolicy"/>
+ <modelFacet>
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ </modelFacet>
+ <labels visualID="37">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getHeaderLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <links
+ visualID="3"
+ editPartClassName="MessageSyncEditPart"
+ itemSemanticEditPolicyClassName="MessageSyncItemSemanticEditPolicy"
+ createCommandClassName="MessageSyncCreateCommand"
+ reorientCommandClassName="MessageSyncReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"
+ displayName="MessageSync"
+ editHelperClassName="MessageSyncEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageSyncFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.0">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/receiveEvent"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/sendEvent"/>
+ </modelFacet>
+ <labels
+ visualID="56"
+ editPartClassName="MessageSyncNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageSyncNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="57"
+ editPartClassName="MessageSyncAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageSyncAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <links
+ visualID="4"
+ editPartClassName="MessageAsyncEditPart"
+ itemSemanticEditPolicyClassName="MessageAsyncItemSemanticEditPolicy"
+ createCommandClassName="MessageAsyncCreateCommand"
+ reorientCommandClassName="MessageAsyncReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageAsync_4"
+ displayName="MessageAsync"
+ metamodelType="/0/@diagram/@links.0/@elementType"
+ editHelperAdviceClassName="MessageAsyncEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageAsyncFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.1">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/receiveEvent"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/sendEvent"/>
+ </modelFacet>
+ <labels
+ visualID="60"
+ editPartClassName="MessageAsyncNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageAsyncNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="61"
+ editPartClassName="MessageAsyncAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageAsyncAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <links
+ visualID="41"
+ editPartClassName="MessageReplyEditPart"
+ itemSemanticEditPolicyClassName="MessageReplyItemSemanticEditPolicy"
+ createCommandClassName="MessageReplyCreateCommand"
+ reorientCommandClassName="MessageReplyReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageReply_41"
+ displayName="MessageReply"
+ metamodelType="/0/@diagram/@links.0/@elementType"
+ editHelperAdviceClassName="MessageReplyEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageReplyFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.2">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/receiveEvent"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/sendEvent"/>
+ </modelFacet>
+ <labels
+ visualID="42"
+ editPartClassName="MessageReplyNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageReplyNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="43"
+ editPartClassName="MessageReplyAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageReplyAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <links
+ visualID="44"
+ editPartClassName="MessageCreateEditPart"
+ itemSemanticEditPolicyClassName="MessageCreateItemSemanticEditPolicy"
+ createCommandClassName="MessageCreateCreateCommand"
+ reorientCommandClassName="MessageCreateReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageCreate_44"
+ displayName="MessageCreate"
+ metamodelType="/0/@diagram/@links.0/@elementType"
+ editHelperAdviceClassName="MessageCreateEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageCreateFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.3">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/receiveEvent"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/sendEvent"/>
+ </modelFacet>
+ <labels
+ visualID="45"
+ editPartClassName="MessageCreateNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageCreateNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="46"
+ editPartClassName="MessageCreateAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageCreateAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <links
+ visualID="47"
+ editPartClassName="MessageDeleteEditPart"
+ itemSemanticEditPolicyClassName="MessageDeleteItemSemanticEditPolicy"
+ createCommandClassName="MessageDeleteCreateCommand"
+ reorientCommandClassName="MessageDeleteReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageDelete_47"
+ displayName="MessageDelete"
+ metamodelType="/0/@diagram/@links.0/@elementType"
+ editHelperAdviceClassName="MessageDeleteEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageDeleteFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.4">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/receiveEvent"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/sendEvent"/>
+ </modelFacet>
+ <labels
+ visualID="48"
+ editPartClassName="MessageDeleteNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageDeleteNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="49"
+ editPartClassName="MessageDeleteAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageDeleteAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <links
+ visualID="50"
+ editPartClassName="MessageLostEditPart"
+ itemSemanticEditPolicyClassName="MessageLostItemSemanticEditPolicy"
+ createCommandClassName="MessageLostCreateCommand"
+ reorientCommandClassName="MessageLostReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageLost_50"
+ displayName="MessageLost"
+ metamodelType="/0/@diagram/@links.0/@elementType"
+ editHelperAdviceClassName="MessageLostEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageLostFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.5">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/receiveEvent"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/owner"/>
+ </modelFacet>
+ <labels
+ visualID="51"
+ editPartClassName="MessageLostNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageLostNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="52"
+ editPartClassName="MessageLostAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageLostAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <links
+ visualID="53"
+ editPartClassName="MessageFoundEditPart"
+ itemSemanticEditPolicyClassName="MessageFoundItemSemanticEditPolicy"
+ createCommandClassName="MessageFoundCreateCommand"
+ reorientCommandClassName="MessageFoundReorientCommand">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.timing.MessageFound_53"
+ displayName="MessageFound"
+ metamodelType="/0/@diagram/@links.0/@elementType"
+ editHelperAdviceClassName="MessageFoundEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageFoundFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet"
+ modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.6">
+ <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message"/>
+ <containmentMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <childMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Interaction/message"/>
+ <sourceMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/owner"/>
+ <targetMetaFeature href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Message/sendEvent"/>
+ </modelFacet>
+ <labels
+ visualID="54"
+ editPartClassName="MessageFoundNameLabelEditPart"
+ itemSemanticEditPolicyClassName="MessageFoundNameLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getMessageLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-10"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern="">
+ <metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="55"
+ editPartClassName="MessageFoundAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="MessageFoundAppliedStereotypeItemSemanticEditPolicy">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getAppliedStereotypeLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
+ <attributes
+ xsi:type="gmfgen:StyleAttributes"
+ fixedFont="true"/>
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ y="-30"/>
+ </viewmap>
+ <modelFacet parser="/0/@labelParsers/@implementations.4"/>
+ </labels>
+ </links>
+ <compartments
+ visualID="5"
+ editPartClassName="InteractionCompartmentEditPartTN"
+ itemSemanticEditPolicyClassName="InteractionCompartmentItemSemanticEditPolicyTN"
+ childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1"
+ title="InteractionCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@topLevelNodes.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCompartmentCreationEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCompartmentLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCompartmentItemSemanticEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="7"
+ editPartClassName="FullLifelineStateDefinitionCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="FullLifelineStateDefinitionCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.6"
+ title="FullLifelineStateDefinitionCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getStateDefinitionContainerFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="8"
+ editPartClassName="FullLifelineTimelineCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="FullLifelineTimelineCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="FullLifelineTimelineCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.12"
+ title="FullLifelineTimelineCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.0"
+ listLayout="false">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getTimelineContainerFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomTimelineCompartmentLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineCompartmentGraphicalNodeEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="23"
+ editPartClassName="CompactLifelineCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="CompactLifelineCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="CompactLifelineCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.12"
+ title="CompactLifelineCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.1"
+ listLayout="false">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getTimelineContainerFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactLifelineCompartmentLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactLifelineCompartmentItemSemanticEditPolicyCN"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineCompartmentGraphicalNodeEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="29"
+ editPartClassName="TimeRulerCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="TimeRulerCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="TimeRulerCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14"
+ title="TimeRulerCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@topLevelNodes.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getTimeRulerContainerFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="82"
+ editPartClassName="FullLifelineTimeRulerCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="FullLifelineTimeRulerCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.13"
+ title="FullLifelineTimeRuler"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.0">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getTimeRulerContainerFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="83"
+ editPartClassName="CompactLifelineTimeRulerCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="CompactLifelineTimeRulerCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.13"
+ title="CompactLifelineTimeRuler"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.1">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getTimeRulerContainerFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="80"
+ editPartClassName="FreeTimeRulerCompartmentEditPart"
+ itemSemanticEditPolicyClassName="FreeTimeRulerCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="FreeTimeRulerCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.15"
+ title="FreeTimeRulerCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.13"
+ listLayout="false">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFreeTimeRulerContainerFigure"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.InvisibleRectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.SelectionOnlyLayoutEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="81"
+ editPartClassName="LinearTimeRulerCompartmentEditPart"
+ itemSemanticEditPolicyClassName="LinearTimeRulerCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="LinearTimeRulerCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.15"
+ title="LinearTimeRulerCompartment"
+ canCollapse="false"
+ hideIfEmpty="false"
+ needsTitle="false"
+ node="/0/@diagram/@childNodes.14"
+ listLayout="false">
+ <diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getLinearTimeRulerContainerFigure"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.timing.custom.figures.InvisibleRectangleFigure"/>
+ </compartments>
+ <palette>
+ <groups
+ title="Nodes"
+ largeIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ smallIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ createMethodName="createNodesGroup"
+ stack="true"
+ collapse="true">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Interaction"
+ description="Interaction"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif"
+ createMethodName="createInteractionCreationTool"
+ genNodes="/0/@diagram/@topLevelNodes.0"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Lifeline"
+ description="Lifeline"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Lifeline.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Lifeline.gif"
+ createMethodName="createLifelineCreationTool"
+ genNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="State Definition"
+ description="State Definition"
+ largeIconPath="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png"
+ smallIconPath="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png"
+ createMethodName="createStateDefinitionCreationTool"
+ genNodes="/0/@diagram/@childNodes.6"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="TimeObservation"
+ description="TimeObservation"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeObservation.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeObservation.gif"
+ createMethodName="createTimeObservationCreationTool"
+ genNodes="/0/@diagram/@childNodes.9"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="TimeConstraint"
+ description="TimeConstraint"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeConstraint.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeConstraint.gif"
+ createMethodName="createTimeConstraintCreationTool"
+ genNodes="/0/@diagram/@childNodes.8"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="DurationObservation"
+ description="DurationObservation"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationObservation.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationObservation.gif"
+ createMethodName="createDurationObservationCreationTool"
+ genNodes="/0/@diagram/@childNodes.11"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="DurationConstraint"
+ description="DurationConstraint"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationConstraint.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationConstraint.gif"
+ createMethodName="createDurationConstraintCreationTool"
+ genNodes="/0/@diagram/@childNodes.10"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Event (OccurrenceSpecification)"
+ description="Event (OccurrenceSpecification)"
+ largeIconPath="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png"
+ smallIconPath="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png"
+ createMethodName="createOccurrenceSpecificationCreationTool"
+ genNodes="/0/@diagram/@childNodes.4"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="DestructionOccurrenceSpecification"
+ description="DestructionOccurrenceSpecification"
+ largeIconPath="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png"
+ smallIconPath="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png"
+ createMethodName="createDestructionOccurrenceSpecificationCreationTool"
+ genNodes="/0/@diagram/@childNodes.16"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Gate"
+ description="Gate"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Gate.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Gate.gif"
+ createMethodName="createGateCreationTool"
+ genNodes="/0/@diagram/@childNodes.18"/>
+ </groups>
+ <groups
+ title="Edges"
+ largeIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ smallIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ createMethodName="createEdgesGroup"
+ stack="true"
+ collapse="true">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="GeneralOrdering"
+ description="GeneralOrdering"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/GeneralOrdering.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/GeneralOrdering.gif"
+ createMethodName="createGeneralOrderingCreationTool"
+ genNodes="/0/@diagram/@childNodes.12"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Sync Message"
+ description="Sync Message"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_synchCall.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_synchCall.gif"
+ createMethodName="createMessageSyncCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.0"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Async Message"
+ description="Async Message"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_asynchCall.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_asynchCall.gif"
+ createMethodName="createMessageAsyncCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.1"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Message Reply"
+ description="Message Reply"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_reply.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_reply.gif"
+ createMethodName="createMessageReplyCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.2"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Create Message"
+ description="Create Message"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_createMessage.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_createMessage.gif"
+ createMethodName="createCreateMessageCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.3"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Delete Message"
+ description="Delete Message"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_deleteMessage.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_deleteMessage.gif"
+ createMethodName="createDeleteMessageCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.4"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Lost Message"
+ description="Lost Message"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif"
+ createMethodName="createLostMessageCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.5"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Found Message"
+ description="Found Message"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif"
+ createMethodName="createFoundMessageCreationTool"
+ qualifiedToolName=""
+ genLinks="/0/@diagram/@links.6"/>
+ </groups>
+ </palette>
+ <preferencePages
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.general"
+ name="UML Diagram">
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.appearance"
+ name="Appearance"
+ kind="Appearance"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.connections"
+ name="Connections"
+ kind="Connections"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.printing"
+ name="Printing"
+ kind="Printing"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.rulersAndGrid"
+ name="Rulers And Grid"
+ kind="RulersAndGrid"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.pathmaps"
+ name="Pathmaps"
+ kind="Pathmaps"/>
+ </preferencePages>
+ </diagram>
+ <plugin
+ iD="org.eclipse.papyrus.uml.diagram.timing"
+ name="Papyrus Timing Diagram (Incubation)"
+ provider="Eclipse Modeling Project"
+ version="0.10.0.qualifier">
+ <requiredPlugins>org.eclipse.draw2d</requiredPlugins>
+ <requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
+ </plugin>
+ <editor/>
+ <navigator/>
+ <diagramUpdater/>
+ <propertySheet>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="appearance"
+ label="Appearance"/>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="diagram"/>
+ <tabs
+ xsi:type="gmfgen:GenCustomPropertyTab"
+ iD="domain"
+ label="Core">
+ <filter xsi:type="gmfgen:TypeTabFilter">
+ <types>org.eclipse.gmf.runtime.notation.View</types>
+ <types>org.eclipse.gef.EditPart</types>
+ <generatedTypes>abstractNavigatorItem</generatedTypes>
+ </filter>
+ </tabs>
+ </propertySheet>
+ <domainGenModel href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#/"/>
+ <expressionProviders>
+ <providers xsi:type="gmfgen:GenLiteralExpressionProvider">
+ <expressions body="&quot;d&quot;"/>
+ <expressions body="&quot;dmin&quot;"/>
+ <expressions body="&quot;dmax&quot;"/>
+ <expressions body="&quot;t&quot;"/>
+ <expressions body="&quot;tmin&quot;"/>
+ <expressions body="&quot;tmax&quot;"/>
+ </providers>
+ <providers xsi:type="gmfgen:GenExpressionInterpreter">
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageSort=MessageSort::synchCall and self.messageKind&lt;>MessageKind::lost and self.messageKind&lt;>MessageKind::found"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageSort=MessageSort::asynchCall or self.messageSort=MessageSort::asynchSignal"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageSort=MessageSort::reply"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageSort=MessageSort::createMessage"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageSort=MessageSort::deleteMessage"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageKind=MessageKind::lost"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="self.messageKind=MessageKind::found"/>
+ </providers>
+ <providers
+ xsi:type="gmfgen:GenJavaExpressionProvider"
+ injectExpressionBody="true">
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="return org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.getLifelineType(domainElement) == org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType.full;"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="return org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.getLifelineType(domainElement) == org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType.compact;"/>
+ </providers>
+ </expressionProviders>
+ <labelParsers extensibleViaService="true">
+ <implementations
+ xsi:type="gmfgen:PredefinedParser"
+ uses="/0/@diagram/@childNodes.0/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@childNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.11/@labels.0/@modelFacet /0/@diagram/@childNodes.16/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@links.0/@labels.0/@modelFacet /0/@diagram/@links.1/@labels.0/@modelFacet /0/@diagram/@links.2/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.0/@modelFacet /0/@diagram/@links.5/@labels.0/@modelFacet /0/@diagram/@links.6/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.18/@labels.0/@modelFacet"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@childNodes.15/@labels.0/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.timing.custom.parsers.TickParser"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.timing.custom.parsers.ConstraintParser"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@childNodes.6/@labels.0/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.timing.custom.parsers.StateDefinitionParser"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@links.0/@labels.1/@modelFacet /0/@diagram/@links.4/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.1/@modelFacet /0/@diagram/@links.2/@labels.1/@modelFacet /0/@diagram/@links.1/@labels.1/@modelFacet /0/@diagram/@links.5/@labels.1/@modelFacet /0/@diagram/@links.6/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.1/@modelFacet /0/@diagram/@childNodes.5/@labels.1/@modelFacet /0/@diagram/@childNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.16/@labels.1/@modelFacet /0/@diagram/@childNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser"/>
+ </labelParsers>
+ </gmfgen:GenEditorGenerator>
+ <papyrusgmfgenextension:PapyrusExtensionRootNode comment="Papyrus-specific extensions to GMFGen">
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="FullLifelineTimelineCompartment (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@compartments.2"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="CompactLifelineTimelineCompartment (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@compartments.3"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="OccurrenceSpecification (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@childNodes.4"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="MessageOccurrenceSpecification (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@childNodes.5"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="DestructionOccurrenceSpecification (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@childNodes.16"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="FullStateInvariant (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@childNodes.2"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
+ comment="CompactStateInvariant (Part) custom DiagramUpdater"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater"
+ genNode="/0/@diagram/@childNodes.3"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:EditPartUsingDeleteService"
+ comment="EditParts for which the Papyrus DeleteService must be used"
+ name="EditParts for which the Papyrus DeleteService must be used"
+ genView="/0/@diagram /0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@topLevelNodes.0 /0/@diagram/@links.0 /0/@diagram/@links.1 /0/@diagram/@links.2 /0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel"
+ comment="Lets the user position labels to wherever they want"
+ classpath="org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator"
+ genExternalNodeLabel="/0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.16/@labels.0 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.11/@labels.0 /0/@diagram/@childNodes.12/@labels.0 /0/@diagram/@childNodes.18/@labels.0 /0/@diagram/@childNodes.15/@labels.0"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="Specifies EditParts that must extend NodeEditPart"
+ genView="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.17"
+ name="EditParts which must extend NodeEditPart"
+ superOwnedEditPart="org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="Compact and Full LifelineEditParts must extend LifelineEditPart"
+ genView="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.0"
+ name="EditParts which must extend LifelineEditPart"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="Manages stereotype shown with External Label"
+ genView="/0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.2/@labels.0 /0/@diagram/@childNodes.16/@labels.1 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.1"
+ name="EP_Stereotypes_EXT_NODE"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:CompartmentVisibilityPreference"
+ comment="Allow FreeTimingRulerCompartmentEditPart to be visible"
+ compartments="/0/@diagram/@compartments.7 /0/@diagram/@compartments.8"/>
+ </papyrusgmfgenextension:PapyrusExtensionRootNode>
+</xmi:XMI>
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.properties b/incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.properties
new file mode 100644
index 00000000000..8e027316e83
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.properties
@@ -0,0 +1,71 @@
+###############################################################################
+# Copyright (c) 2012 CEA LIST.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+pluginName = Eclipse Modeling Project
+providerName = Papyrus Timing Diagram (Incubation)
+
+editorName=Timing Diagram Editor
+context.description=Timing Diagram Editing
+context.name=In Papyrus Timing Diagram Editor
+newWizardName=Timing Diagram
+newWizardDesc=Creates a Papyrus Timing diagram.
+
+initDiagramActionLabel=Initialize Timing diagram file
+
+
+navigatorContentName=*.PapyrusUMLTiming_diagram diagram contents
+domainNavigatorContentName=*.PapyrusUMLTiming model contents
+update.diagram.name=Update PapyrusUMLTimingDiagram diagram
+update.diagram.description=Perform PapyrusUMLTimingDiagram diagram update
+
+
+# Property Sheet
+tab.appearance=Appearance
+tab.diagram=Rulers & Grid
+tab.domain=Core
+
+# Preferences
+
+
+# Providers
+metatype.name.Package_1=TimingDiagram
+metatype.name.Interaction_2=Interaction
+metatype.name.Lifeline_19=FullLifeline
+metatype.name.Lifeline_20=CompactLifeline
+metatype.name.StateInvariant_11=StateInvariant
+metatype.name.StateInvariant_28=StateInvariant
+metatype.name.OccurrenceSpecification_12=OccurrenceSpecification
+metatype.name.MessageOccurrenceSpecification_13=MessageOccurrenceSpecification
+metatype.name.StateDefinition_9=StateDefinition
+metatype.name.TimeConstraint_15=TimeConstraint
+metatype.name.TimeObservation_16=TimeObservation
+metatype.name.DurationConstraint_18=DurationConstraint
+metatype.name.DurationObservation_17=DurationObservation
+metatype.name.Node_24=FreeTimingRuler
+metatype.name.Node_25=LinearTimingRuler
+metatype.name.Node_26=Tick
+metatype.name.DestructionOccurrenceSpecification_27=DestructionOccurrenceSpecification
+metatype.name.Node_9=StateDefinition
+metatype.name.Node_39=VerticalLineStateInvariant
+metatype.name.Message_3=Sync Message
+metatype.name.Message_4=Async Message
+metatype.name.Message_41=MessageReply
+metatype.name.Message_44=MessageCreate
+metatype.name.Message_47=MessageDelete
+metatype.name.Message_50=MessageLost
+metatype.name.Message_53=MessageFound
+metatype.name.GeneralOrdering_67=GeneralOrdering
+prefpage.org.eclipse.uml2.uml.diagram.general=UML Diagram
+prefpage.org.eclipse.uml2.uml.diagram.appearance=Appearance
+prefpage.org.eclipse.uml2.uml.diagram.connections=Connections
+prefpage.org.eclipse.uml2.uml.diagram.printing=Printing
+prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid=Rulers And Grid
+prefpage.org.eclipse.uml2.uml.diagram.pathmaps=Pathmaps
+metatype.name.Lifeline_40=Lifeline
+
+metatype.name.Gate_69=Gate
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.xml b/incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.xml
new file mode 100644
index 00000000000..cc0b721f8c2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/plugin.xml
@@ -0,0 +1,1516 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension point="org.eclipse.ui.contexts" id="ui-context">
+ <?gmfgen generated="true"?>
+ <context
+ description="%context.description"
+ id="org.eclipse.papyrus.uml.diagram.timing.ui.diagramContext"
+ name="%context.name"
+ parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
+ </context>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders" id="markers-navigation">
+ <?gmfgen generated="true"?>
+ <MarkerNavigationProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLMarkerNavigationProvider">
+ <MarkerType name="org.eclipse.papyrus.uml.diagram.timing.diagnostic"/>
+ <Priority name="Lowest"/>
+ </MarkerNavigationProvider>
+ </extension>
+
+ <extension id="diagnostic" name="Papyrus Timing Diagram (Incubation) problems" point="org.eclipse.core.resources.markers">
+ <?gmfgen generated="true"?>
+ <super type="org.eclipse.core.resources.problemmarker"/>
+ <super type="org.eclipse.gmf.runtime.common.ui.services.marker"/>
+ <persistent value="true"/>
+ </extension>
+
+ <extension id="validationDecoratorProvider" name="ValidationDecorations" point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
+ <?gmfgen generated="true"?>
+ <decoratorProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLValidationDecoratorProvider">
+ <Priority name="Lowest"/>
+ <object class="org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui)" id="PRIMARY_VIEW"/>
+ <context decoratorTargets="PRIMARY_VIEW"/>
+ </decoratorProvider>
+ </extension>
+
+
+ <?gmfgen generated="true"?>
+ <extension
+ id="org.eclipse.papyrus.uml.diagram.timing.palettedefinition"
+ name="Papyrus Timing Diagram (Incubation) Predefined Entries"
+ point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
+
+ <?gmfgen generated="false"?>
+ <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
+ <Priority name="Lowest"/>
+ <contribution
+ factoryClass="org.eclipse.papyrus.uml.diagram.timing.custom.parts.CustomPaletteFactory">
+ <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
+
+ <entry
+ defineOnly="true"
+ description="Interaction"
+ id="createInteractionCreationTool"
+ kind="tool"
+ label="Interaction"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Lifeline"
+ id="createLifelineCreationTool"
+ kind="tool"
+ label="Lifeline"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Lifeline.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Lifeline.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="State Definition"
+ id="createStateDefinitionCreationTool"
+ kind="tool"
+ label="State Definition"
+ large_icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/stateDefinition.png">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="TimeObservation"
+ id="createTimeObservationCreationTool"
+ kind="tool"
+ label="TimeObservation"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeObservation.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeObservation.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="TimeConstraint"
+ id="createTimeConstraintCreationTool"
+ kind="tool"
+ label="TimeConstraint"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeConstraint.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeConstraint.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="DurationObservation"
+ id="createDurationObservationCreationTool"
+ kind="tool"
+ label="DurationObservation"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationObservation.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationObservation.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="DurationConstraint"
+ id="createDurationConstraintCreationTool"
+ kind="tool"
+ label="DurationConstraint"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationConstraint.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationConstraint.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Event (OccurrenceSpecification)"
+ id="createOccurrenceSpecificationCreationTool"
+ kind="tool"
+ label="Event (OccurrenceSpecification)"
+ large_icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/event.png">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="DestructionOccurrenceSpecification"
+ id="createDestructionOccurrenceSpecificationCreationTool"
+ kind="tool"
+ label="DestructionOccurrenceSpecification"
+ large_icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/destruction.png">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Gate"
+ id="createGateCreationTool"
+ kind="tool"
+ label="Gate"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Gate.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Gate.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="GeneralOrdering"
+ id="createGeneralOrderingCreationTool"
+ kind="tool"
+ label="GeneralOrdering"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/GeneralOrdering.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/GeneralOrdering.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Sync Message"
+ id="createMessageSyncCreationTool"
+ kind="tool"
+ label="Sync Message"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_synchCall.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_synchCall.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Async Message"
+ id="createMessageAsyncCreationTool"
+ kind="tool"
+ label="Async Message"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_asynchCall.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_asynchCall.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Message Reply"
+ id="createMessageReplyCreationTool"
+ kind="tool"
+ label="Message Reply"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_reply.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_reply.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Create Message"
+ id="createCreateMessageCreationTool"
+ kind="tool"
+ label="Create Message"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_createMessage.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_createMessage.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Delete Message"
+ id="createDeleteMessageCreationTool"
+ kind="tool"
+ label="Delete Message"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_deleteMessage.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message_deleteMessage.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Lost Message"
+ id="createLostMessageCreationTool"
+ kind="tool"
+ label="Lost Message"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif">
+ </entry>
+
+ <entry
+ defineOnly="true"
+ description="Found Message"
+ id="createFoundMessageCreationTool"
+ kind="tool"
+ label="Found Message"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif"
+ path=""
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Message.gif">
+ </entry>
+
+ </contribution>
+ </paletteProvider>
+
+ </extension>
+
+ <?gmfgen generated="true"?>
+ <extension
+ id="org.eclipse.papyrus.uml.diagram.timing.palettedefinition.standard"
+ name="Papyrus Timing Diagram (Incubation) Standard Palette"
+ point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
+
+ <?gmfgen generated="false"?>
+ <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
+ <Priority name="Low"/>
+ <contribution
+ factoryClass="org.eclipse.papyrus.uml.diagram.timing.custom.parts.CustomPaletteFactory">
+ <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
+
+ <entry
+ description=""
+ id="createNodesGroup"
+ kind="drawer"
+ label="Nodes"
+ large_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ path="/"
+ small_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
+ <expand force="true"/>
+ </entry>
+
+
+ <predefinedEntry
+ id="createInteractionCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createLifelineCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createStateDefinitionCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createTimeObservationCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createTimeConstraintCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createDurationObservationCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createDurationConstraintCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createOccurrenceSpecificationCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createDestructionOccurrenceSpecificationCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createGateCreationTool"
+ path="/createNodesGroup">
+ </predefinedEntry>
+
+
+ <entry
+ description=""
+ id="createEdgesGroup"
+ kind="drawer"
+ label="Edges"
+ large_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
+ path="/"
+ small_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
+ <expand force="true"/>
+ </entry>
+
+
+ <predefinedEntry
+ id="createGeneralOrderingCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createMessageSyncCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createMessageAsyncCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createMessageReplyCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createCreateMessageCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createDeleteMessageCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createLostMessageCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+ <predefinedEntry
+ id="createFoundMessageCreationTool"
+ path="/createEdgesGroup">
+ </predefinedEntry>
+
+
+ </contribution>
+ <editor id="org.eclipse.papyrus.uml.diagram.timing"/>
+ </paletteProvider>
+
+ </extension>
+
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor" id="prop-contrib">
+ <?gmfgen generated="true"?>
+ <propertyContributor
+ contributorId="org.eclipse.papyrus.uml.diagram.timing"
+ labelProvider="org.eclipse.papyrus.uml.diagram.timing.sheet.UMLSheetLabelProvider">
+ <propertyCategory category="domain"/>
+ <propertyCategory category="visual"/>
+ <propertyCategory category="extra"/>
+ </propertyContributor>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs" id="proptabs">
+ <?gmfgen generated="true"?>
+ <propertyTabs contributorId="org.eclipse.papyrus.uml.diagram.timing">
+ <propertyTab
+ category="visual"
+ id="property.tab.AppearancePropertySection"
+ label="%tab.appearance"/>
+ <propertyTab
+ category="visual"
+ id="property.tab.DiagramPropertySection"
+ label="%tab.diagram"/>
+ <propertyTab
+ category="domain"
+ id="property.tab.domain"
+ label="%tab.domain"/>
+ </propertyTabs>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections" id="propsections">
+ <?gmfgen generated="true"?>
+ <propertySections contributorId="org.eclipse.papyrus.uml.diagram.timing">
+ <propertySection id="property.section.ConnectorAppearancePropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ConnectionEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ConnectionAppearancePropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+ <propertySection id="property.section.ShapeColorAndFontPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ShapeEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+ <propertySection id="property.section.DiagramColorsAndFontsPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.DiagramColorsAndFontsPropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+ <propertySection id="property.section.RulerGridPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection"
+ tab="property.tab.DiagramPropertySection">
+ </propertySection>
+ <propertySection
+ id="property.section.domain"
+ tab="property.tab.domain"
+ class="org.eclipse.papyrus.uml.diagram.timing.sheet.UMLPropertySection">
+ <input type="org.eclipse.gmf.runtime.notation.View"/>
+ <input type="org.eclipse.gef.EditPart"/>
+ <input type="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem"/>
+ </propertySection>
+ </propertySections>
+ </extension>
+
+<extension point="org.eclipse.ui.preferencePages" id="prefpages">
+ <?gmfgen generated="true"?>
+ <page
+ id="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ name="PapyrusUMLTimingDiagram Diagram"
+ category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramGeneralPreferencePage">
+ </page>
+
+
+
+ <page
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramPrintingPreferencePage"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.printing"
+ category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramPrintingPreferencePage">
+ </page>
+
+ <page
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramRulersAndGridPreferencePage"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid"
+ category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramRulersAndGridPreferencePage">
+ </page>
+
+
+ </extension>
+
+ <?gmfgen generated="true"?>
+<extension point="org.eclipse.ui.preferencePages">
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.InteractionPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.InteractionPreferencePage"
+ name="Interaction Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.TimeConstraintPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.TimeConstraintPreferencePage"
+ name="TimeConstraint Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.TimeObservationPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.TimeObservationPreferencePage"
+ name="TimeObservation Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.VerticalLineStateInvariantPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.VerticalLineStateInvariantPreferencePage"
+ name="VerticalLineStateInvariant Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.GeneralOrderingPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.GeneralOrderingPreferencePage"
+ name="GeneralOrdering Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.CompactStateInvariantPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.CompactStateInvariantPreferencePage"
+ name="CompactStateInvariant Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.LinearTimingRulerPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.LinearTimingRulerPreferencePage"
+ name="LinearTimingRuler Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.LifelinePreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.LifelinePreferencePage"
+ name="Lifeline Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.DurationConstraintPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.DurationConstraintPreferencePage"
+ name="DurationConstraint Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.DurationObservationPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.DurationObservationPreferencePage"
+ name="DurationObservation Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.TickPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.TickPreferencePage"
+ name="Tick Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.FreeTimingRulerPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.FreeTimingRulerPreferencePage"
+ name="FreeTimingRuler Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.FullLifelinePreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.FullLifelinePreferencePage"
+ name="FullLifeline Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageOccurrenceSpecificationPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageOccurrenceSpecificationPreferencePage"
+ name="MessageOccurrenceSpecification Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.OccurrenceSpecificationPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.OccurrenceSpecificationPreferencePage"
+ name="OccurrenceSpecification Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.DestructionOccurrenceSpecificationPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.DestructionOccurrenceSpecificationPreferencePage"
+ name="DestructionOccurrenceSpecification Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.FullStateInvariantPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.FullStateInvariantPreferencePage"
+ name="FullStateInvariant Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.CompactLifelinePreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.CompactLifelinePreferencePage"
+ name="CompactLifeline Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.GatePreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.GatePreferencePage"
+ name="Gate Node" />
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.StateDefinitionPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.StateDefinitionPreferencePage"
+ name="StateDefinition Node" />
+
+
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageAsyncPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageAsyncPreferencePage"
+ name="MessageAsync Link" />
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageSyncPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageSyncPreferencePage"
+ name="MessageSync Link" />
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageReplyPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageReplyPreferencePage"
+ name="MessageReply Link" />
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageDeletePreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageDeletePreferencePage"
+ name="MessageDelete Link" />
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageCreatePreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageCreatePreferencePage"
+ name="MessageCreate Link" />
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageLostPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageLostPreferencePage"
+ name="MessageLost Link" />
+
+
+
+ <?gmfgen generated="true"?>
+ <page category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLTimingDiagram"
+ class="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageFoundPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.timing.preferences.MessageFoundPreferencePage"
+ name="MessageFound Link" />
+
+
+</extension>
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ <?gmfgen generated="true"?>
+ <initializer class="org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramPreferenceInitializer"/>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
+ <?gmfgen generated="true"?>
+ <viewProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider">
+ <Priority name="Lowest"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLTimingDiagram"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2,19,20,11,28,12,13,9,39,15,16,18,17,67,24,25,26,27,40,69"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="3,4,41,44,47,50,53"/>
+ </viewProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider">
+ <?gmfgen generated="true"?>
+ <editpartProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLEditPartProvider">
+ <Priority name="Lowest"/>
+ <object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram">
+ <method name="getType()" value="PapyrusUMLTimingDiagram"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes">
+ <method name="getType()" value="2,19,20,11,28,12,13,9,39,15,16,18,17,67,24,25,26,27,40,69"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links">
+ <method name="getType()" value="3,4,41,44,47,50,53"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels">
+ <method name="getType()" value="37,21,22,62,31,64,10,58,14,59,38,30,65,34,66,33,35,68,36,32,63,70"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments">
+ <method name="getType()" value="5,7,8,23,29,82,83,80,81"/>
+ </object>
+ <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
+ </editpartProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider">
+ <?gmfgen generated="true"?>
+ <modelingAssistantProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLModelingAssistantProvider">
+ <Priority name="Lowest"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart" id="Package_1"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN" id="Interaction_2"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN" id="Lifeline_19"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN" id="Lifeline_20"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditPartCN" id="StateInvariant_11"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantEditPartCN" id="StateInvariant_28"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN" id="OccurrenceSpecification_12"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN" id="MessageOccurrenceSpecification_13"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart" id="Node_9"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart" id="Node_39"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart" id="TimeConstraint_15"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart" id="TimeObservation_16"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN" id="DurationConstraint_18"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN" id="DurationObservation_17"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart" id="GeneralOrdering_67"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimingRulerEditPartCN" id="Node_24"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimingRulerEditPartCN" id="Node_25"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart" id="Node_26"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN" id="DestructionOccurrenceSpecification_27"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart" id="Lifeline_40"/>
+ <object class="org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart" id="Gate_69"/>
+ <context elements="Package_1,Interaction_2,Lifeline_19,Lifeline_20,StateInvariant_11,StateInvariant_28,OccurrenceSpecification_12,MessageOccurrenceSpecification_13,Node_9,Node_39,TimeConstraint_15,TimeObservation_16,DurationConstraint_18,DurationObservation_17,GeneralOrdering_67,Node_24,Node_25,Node_26,DestructionOccurrenceSpecification_27,Lifeline_40,Gate_69"/>
+ </modelingAssistantProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
+ <?gmfgen generated="true"?>
+ <IconProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLIconProvider">
+ <Priority name="Lowest"/>
+ </IconProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider">
+ <?gmfgen generated="true"?>
+ <ParserProvider class="org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider">
+ <Priority name="Lowest"/>
+ </ParserProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
+ <?gmfgen generated="true"?>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.Package_1"
+ name="%metatype.name.Package_1"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="Package"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.PackageEditHelper">
+ <param name="semanticHint" value="1"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.Interaction_2"
+ name="%metatype.name.Interaction_2"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="Interaction"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.InteractionEditHelper">
+ <param name="semanticHint" value="2"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Lifeline_19"
+ name="%metatype.name.Lifeline_19"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.FullLifelineEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.Lifeline_40"/>
+ <param name="semanticHint" value="19"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Lifeline_20"
+ name="%metatype.name.Lifeline_20"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.CompactLifelineEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.Lifeline_40"/>
+ <param name="semanticHint" value="20"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.FullStateInvariant_11"
+ name="%metatype.name.StateInvariant_11"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="StateInvariant"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.FullStateInvariantEditHelper">
+ <param name="semanticHint" value="11"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.CompactStateInvariant_28"
+ name="%metatype.name.StateInvariant_28"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.CompactStateInvariantEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.FullStateInvariant_11"/>
+ <param name="semanticHint" value="28"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.OccurrenceSpecification_12"
+ name="%metatype.name.OccurrenceSpecification_12"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="OccurrenceSpecification"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.OccurrenceSpecificationEditHelper">
+ <param name="semanticHint" value="12"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageOccurrenceSpecification_13"
+ name="%metatype.name.MessageOccurrenceSpecification_13"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="MessageOccurrenceSpecification"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageOccurrenceSpecificationEditHelper">
+ <param name="semanticHint" value="13"/>
+ </metamodelType>
+ </metamodel>
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Node_9"
+ name="%metatype.name.Node_9"
+ kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="9"/>
+ </specializationType>
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Node_39"
+ name="%metatype.name.Node_39"
+ kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="39"/>
+ </specializationType>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.TimeConstraint_15"
+ name="%metatype.name.TimeConstraint_15"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="TimeConstraint"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.TimeConstraintEditHelper">
+ <param name="semanticHint" value="15"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.TimeObservation_16"
+ name="%metatype.name.TimeObservation_16"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="TimeObservation"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.TimeObservationEditHelper">
+ <param name="semanticHint" value="16"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.DurationConstraint_18"
+ name="%metatype.name.DurationConstraint_18"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="DurationConstraint"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.DurationConstraintEditHelper">
+ <param name="semanticHint" value="18"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.DurationObservation_17"
+ name="%metatype.name.DurationObservation_17"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="DurationObservation"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.DurationObservationEditHelper">
+ <param name="semanticHint" value="17"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.GeneralOrdering_67"
+ name="%metatype.name.GeneralOrdering_67"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="GeneralOrdering"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.GeneralOrderingEditHelper">
+ <param name="semanticHint" value="67"/>
+ </metamodelType>
+ </metamodel>
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Node_24"
+ name="%metatype.name.Node_24"
+ kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="24"/>
+ </specializationType>
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Node_25"
+ name="%metatype.name.Node_25"
+ kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="25"/>
+ </specializationType>
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.Node_26"
+ name="%metatype.name.Node_26"
+ kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="26"/>
+ </specializationType>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.DestructionOccurrenceSpecification_27"
+ name="%metatype.name.DestructionOccurrenceSpecification_27"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="DestructionOccurrenceSpecification"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.DestructionOccurrenceSpecificationEditHelper">
+ <param name="semanticHint" value="27"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.Lifeline_40"
+ name="%metatype.name.Lifeline_40"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="Lifeline"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.LifelineEditHelper">
+ <param name="semanticHint" value="40"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.Gate_69"
+ name="%metatype.name.Gate_69"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="Gate"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.GateEditHelper">
+ <param name="semanticHint" value="69"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <metamodelType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"
+ name="%metatype.name.Message_3"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="Message"
+ edithelper="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageSyncEditHelper">
+ <param name="semanticHint" value="3"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageAsync_4"
+ name="%metatype.name.Message_4"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageAsyncEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <param name="semanticHint" value="4"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageReply_41"
+ name="%metatype.name.Message_41"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageReplyEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <param name="semanticHint" value="41"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageCreate_44"
+ name="%metatype.name.Message_44"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageCreateEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <param name="semanticHint" value="44"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageDelete_47"
+ name="%metatype.name.Message_47"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageDeleteEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <param name="semanticHint" value="47"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageLost_50"
+ name="%metatype.name.Message_50"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageLostEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <param name="semanticHint" value="50"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
+ <specializationType
+ id="org.eclipse.papyrus.uml.diagram.timing.MessageFound_53"
+ name="%metatype.name.Message_53"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ edithelperadvice="org.eclipse.papyrus.uml.diagram.timing.edit.helpers.MessageFoundEditHelper">
+ <specializes id="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <param name="semanticHint" value="53"/>
+ </specializationType>
+ </metamodel>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
+ <?gmfgen generated="true"?>
+ <clientContext id="org.eclipse.papyrus.uml.diagram.timing.TypeContext">
+ <enablement>
+ <test
+ property="org.eclipse.gmf.runtime.emf.core.editingDomain"
+ value="org.eclipse.papyrus.uml.diagram.timing.EditingDomain"/>
+ </enablement>
+ </clientContext>
+ <binding context="org.eclipse.papyrus.uml.diagram.timing.TypeContext">
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Package_1"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Interaction_2"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Lifeline_19"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Lifeline_20"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.FullStateInvariant_11"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.CompactStateInvariant_28"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.OccurrenceSpecification_12"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageOccurrenceSpecification_13"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Node_9"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Node_39"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.TimeConstraint_15"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.TimeObservation_16"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.DurationConstraint_18"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.DurationObservation_17"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.GeneralOrdering_67"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Node_24"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Node_25"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Node_26"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.DestructionOccurrenceSpecification_27"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Lifeline_40"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.Gate_69"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageAsync_4"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageReply_41"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageCreate_44"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageDelete_47"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageLost_50"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageFound_53"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ </binding>
+ </extension>
+ <extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
+ <?gmfgen generated="true"?>
+ <propertyTester
+ id="org.eclipse.papyrus.uml.diagram.timing.URIEditorInputPropertyTester"
+ type="org.eclipse.emf.common.ui.URIEditorInput"
+ namespace="org.eclipse.papyrus.uml.diagram.timing"
+ properties="isURIEditorInput"
+ class="org.eclipse.papyrus.uml.diagram.timing.part.UMLUriEditorInputTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.viewer" id="navigator-viewbinding">
+ <?gmfgen generated="true"?>
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="org.eclipse.papyrus.uml.diagram.timing.resourceContent"/>
+ <contentExtension pattern="org.eclipse.papyrus.uml.diagram.timing.domainResourceContent"/>
+ <contentExtension pattern="org.eclipse.papyrus.uml.diagram.timing.navigatorLinkHelper"/>
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension pattern="org.eclipse.papyrus.uml.diagram.timing.navigatorActionProvider"/>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent" id="navigator-content">
+ <?gmfgen generated="true"?>
+ <navigatorContent
+ id="org.eclipse.papyrus.uml.diagram.timing.resourceContent"
+ name="%navigatorContentName"
+ priority="normal"
+ contentProvider="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorContentProvider"
+ labelProvider="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorLabelProvider"
+ icon="icons/obj16/UMLDiagramFile.gif"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="PapyrusUMLTiming_diagram"/>
+ </and>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem"/>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem"/>
+ </or>
+ </possibleChildren>
+ <commonSorter
+ id="org.eclipse.papyrus.uml.diagram.timing.navigatorSorter"
+ class="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorSorter">
+ <parentExpression>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="PapyrusUMLTiming_diagram"/>
+ </and>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem"/>
+ </or>
+ </parentExpression>
+ </commonSorter>
+ </navigatorContent>
+ <navigatorContent
+ id="org.eclipse.papyrus.uml.diagram.timing.domainResourceContent"
+ name="%domainNavigatorContentName"
+ priority="normal"
+ contentProvider="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorContentProvider"
+ labelProvider="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorLabelProvider"
+ icon="icons/obj16/UMLDiagramFile.gif"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="PapyrusUMLTiming"/>
+ </and>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem"/>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem"/>
+ </possibleChildren>
+ </navigatorContent>
+ <actionProvider
+ id="org.eclipse.papyrus.uml.diagram.timing.navigatorActionProvider"
+ class="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem"/>
+ </or>
+ </enablement>
+ </actionProvider>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.linkHelper" id="navigator-linkhelper">
+ <?gmfgen generated="true"?>
+ <linkHelper
+ id="org.eclipse.papyrus.uml.diagram.timing.navigatorLinkHelper"
+ class="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorLinkHelper">
+ <editorInputEnablement>
+ <and>
+ <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
+ <test property="org.eclipse.papyrus.uml.diagram.timing.isURIEditorInput"/>
+ </and>
+ </editorInputEnablement>
+ <selectionEnablement>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem"/>
+ </selectionEnablement>
+ </linkHelper>
+ </extension>
+ <extension point="org.eclipse.ui.commands" id="update-cmd">
+ <?gmfgen generated="true"?>
+ <command
+ categoryId="org.eclipse.ui.category.edit"
+ defaultHandler="org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramUpdateCommand"
+ description="%update.diagram.description"
+ id="org.eclipse.papyrus.uml.diagram.timing.updateDiagram"
+ name="%update.diagram.name"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings" id="update-cmd-binding">
+ <?gmfgen generated="true"?>
+ <key
+ commandId="org.eclipse.papyrus.uml.diagram.timing.updateDiagram"
+ contextId="org.eclipse.papyrus.uml.diagram.timing.ui.diagramContext"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F5"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.menus" id="context-menus">
+ <?gmfgen generated="true"?>
+ <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=">
+ </menuContribution>
+ <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=">
+ </menuContribution -->
+ </extension>
+
+
+
+ <!-- optionally, specify keybindings -->
+
+
+ <!-- **************************************** non-generated extensions **************************************** -->
+
+ <extension point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ description="Create a new Timing Diagram"
+ id="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand"
+ name="Create a new Class Diagram">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.SwitchLifelineCommand"
+ description="Switch Lifeline"
+ id="org.eclipse.papyrus.uml.diagram.timing.custom.switchLifeline"
+ name="Switch Lifeline"/>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CreateTickCommand"
+ description="Attach a tick to an Occurence Specification"
+ id="org.eclipse.papyrus.uml.diagram.timing.custom.createTick"
+ name="Attach Tick"/>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.ToggleTimeRulerVisibility"
+ description="Toggle time ruler visibility"
+ id="org.eclipse.papyrus.uml.diagram.timing.custom.toggleTimeRulerVisibility"
+ name="Toggle Time Ruler Visibility"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.uml.diagram.timing.custom.CreateTimingDiagramWithNavigationHandler"
+ commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand">
+ <activeWhen>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.bindings"
+ id="update-cmd-binding">
+ <key
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.switchLifeline"
+ contextId="org.eclipse.papyrus.uml.diagram.timing.ui.diagramContext"
+ sequence="M1+F9"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings"
+ id="update-cmd-binding">
+ <key
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.createTick"
+ contextId="org.eclipse.papyrus.uml.diagram.timing.ui.diagramContext"
+ sequence="M1+F10"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings"
+ id="update-cmd-binding">
+ <key
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.toggleTimeRulerVisibility"
+ contextId="org.eclipse.papyrus.uml.diagram.timing.ui.diagramContext"
+ sequence="M1+F11"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.menus">
+
+ <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
+ <menu
+ id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
+ label="Diagrams">
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand"
+ icon="icons/obj16/Diagram_Timing.gif"
+ label="Create a new Timing Diagram"
+ style="push"
+ tooltip="Create a new Timing Diagram">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </menu>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand"
+ icon="icons/obj16/Diagram_Timing.gif"
+ label="Create a new Timing Diagram"
+ style="push"
+ tooltip="Create a new Timing Diagram">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </toolbar>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand"
+ icon="icons/obj16/Diagram_Timing.gif"
+ label="Create a new Timing Diagram"
+ style="push"
+ tooltip="Create a new Timing Diagram">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution locationURI="popup:popup:org.eclipse.ui.popup.any?after=additions">
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.switchLifeline"
+ label="Switch Lifeline to Compact"
+ style="push"
+ tooltip="Switch Lifeline to Compact">
+ <visibleWhen>
+ <iterate>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN">
+ </instanceof>
+ </iterate>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.toggleTimeRulerVisibility"
+ label="Toggle Time Ruler Visibility"
+ style="push"
+ tooltip="Toggle time ruler visibility">
+ <visibleWhen>
+ <iterate>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart">
+ </instanceof>
+ </iterate>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.switchLifeline"
+ label="Switch Lifeline to Full"
+ style="push"
+ tooltip="Switch Lifeline to Full">
+ <visibleWhen>
+ <iterate>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineEditPartCN">
+ </instanceof>
+ </iterate>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.uml.diagram.timing.custom.createTick"
+ label="Attach a tick"
+ style="push"
+ tooltip="Attach a tick">
+ <visibleWhen>
+ <iterate>
+ <or>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN">
+ </instanceof>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN">
+ </instanceof>
+ <instanceof value="org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN">
+ </instanceof>
+ </or>
+ </iterate>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+ <!-- register editor in Papyrus -->
+ <extension point="org.eclipse.papyrus.infra.core.papyrusDiagram">
+ <editorDiagram
+ actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
+ factoryClass="org.eclipse.papyrus.uml.diagram.timing.custom.TimingDiagramEditorFactory"
+ icon="icons/obj16/Diagram_Timing.gif">
+ </editorDiagram>
+ <creationCommand
+ creationCommandClass="org.eclipse.papyrus.uml.diagram.timing.custom.CreateTimingDiagramCommand"
+ creationCondition="org.eclipse.papyrus.uml.diagram.timing.custom.TimingDiagramCreationCondition"
+ icon="icons/obj16/Diagram_Timing.gif"
+ id="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand"
+ language="uml"
+ label="UML Timing Diagram">
+ </creationCommand>
+ </extension>
+
+ <!-- Diagram specific advices -->
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
+ <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
+ <adviceBinding id="org.eclipse.papyrus.uml.diagram.timing.StateInvariantHelperAdvice"
+ class="org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice.StateInvariantHelperAdvice"
+ inheritance="all" typeId="org.eclipse.papyrus.uml.StateInvariant">
+ </adviceBinding>
+ <adviceBinding id="org.eclipse.papyrus.uml.diagram.timing.OccurrenceSpecificationHelperAdvice"
+ class="org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice.OccurrenceSpecificationHelperAdvice"
+ inheritance="all" typeId="org.eclipse.papyrus.uml.OccurrenceSpecification">
+ </adviceBinding>
+ <adviceBinding id="org.eclipse.papyrus.uml.diagram.timing.GateHelperAdvice"
+ class="org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice.GateHelperAdvice"
+ inheritance="all" typeId="org.eclipse.papyrus.uml.Gate">
+ </adviceBinding>
+ <adviceBinding id="org.eclipse.papyrus.uml.diagram.timing.DefaultTypeHelperAdvice"
+ class="org.eclipse.papyrus.uml.diagram.timing.custom.helper.advice.DefaultTypeHelperAdvice"
+ inheritance="all" typeId="org.eclipse.gmf.runtime.emf.type.core.default">
+ </adviceBinding>
+ </metamodel>
+ </extension>
+
+ <!-- Bindings to the shared Papyrus context -->
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+ <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.StateInvariantHelperAdvice"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.OccurrenceSpecificationHelperAdvice"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.GateHelperAdvice"/>
+ <elementType ref="org.eclipse.papyrus.uml.diagram.timing.DefaultTypeHelperAdvice"/>
+ </binding>
+ </extension>
+
+
+ <!-- custom editpart provider (see also org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomUMLEditPartFactory#createEditPart) -->
+ <extension
+ id="custom-ep-provider"
+ point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ <editpartProvider
+ class="org.eclipse.papyrus.uml.diagram.timing.custom.providers.CustomUMLEditPartProvider">
+ <Priority name="Medium"/>
+ <object
+ class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
+ id="customized-edit-parts">
+ <!-- 1 = TimingDiagramEditPart -->
+ <!-- 2 = InteractionEditPartTN -->
+ <!-- 5 = InteractionCompartmentEditPartTN -->
+ <!-- 7 = FullLifelineStateDefinitionCompartmentEditPartCN -->
+ <!-- 8 = FullLifelineTimelineCompartmentEditPartCN -->
+ <!-- 9 = StateDefinitionEditPart -->
+ <!-- 10 = OccurrenceSpecificationLabelEditPart -->
+ <!-- 11 = FullStateInvariantEditPartCN -->
+ <!-- 12 = OccurrenceSpecificationEditPartCN -->
+ <!-- 13 = MessageOccurrenceSpecificationEditPartCN -->
+ <!-- 14 = MessageOccurrenceSpecificationLabelEditPart -->
+ <!-- 15 = TimeConstraintEditPart -->
+ <!-- 16 = TimeObservationEditPart -->
+ <!-- 17 = DurationObservationEditPartCN -->
+ <!-- 18 = DurationConstraintEditPartCN -->
+ <!-- 19 = FullLifelineEditPartCN -->
+ <!-- 20 = CompactLifelineEditPartCN -->
+ <!-- 23 = CompactLifelineCompartmentEditPartCN -->
+ <!-- 24 = FreeTimingRulerEditPartCN -->
+ <!-- 26 = TickEditPart -->
+ <!-- 27 = DestructionOccurrenceSpecificationEditPartCN -->
+ <!-- 28 = CompactStateInvariantEditPartCN -->
+ <!-- 29 = TimeRulerCompartmentEditPartCN -->
+ <!-- 31 = CompactStateInvariantNameEditPart -->
+ <!-- 32 = DestructionOccurrenceSpecificationLabelEditPart -->
+ <!-- 38 = StateDefinitionLabelEditPart -->
+ <!-- 39 = FullStateInvariantVerticalLineEditPart -->
+ <!-- 50 = MessageLostEditPart -->
+ <!-- 53 = MessageFoundEditPart -->
+ <!-- 67 = GeneralOrderingEditPart -->
+ <!-- 69 = GateEditPart -->
+ <!-- 80 = FreeTimeRulerCompartmentEditPart -->
+ <!-- 82 = FullLifelineTimeRulerCompartmentEditPartCN -->
+ <!-- 83 = CompactLifelineTimeRulerCompartmentEditPartCN -->
+ <method name="getType()" value="1,2,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,23,24,26,27,28,29,31,32,38,39,50,53,67,69,80,82,83"/>
+ </object>
+ <context views="customized-edit-parts"/>
+ </editpartProvider>
+ </extension>
+
+
+ <extension
+ id="stereotype-ep-provider"
+ point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ <editpartProvider
+ class="org.eclipse.papyrus.uml.diagram.clazz.custom.providers.StereotypePropertiesEditPartProvider">
+ <Priority name="Medium"/>
+
+ <object
+ class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
+ id="org.eclipse.papyrus.uml.diagram.clazz.editpart.AppliedStereotypeContainer">
+ <method name="getType()" value="AppliedStereotypeContainer,AppliedStereotypeProperty,AppliedStereotypesComment,AppliedStereotypesCommentLink"/>
+ </object>
+ </editpartProvider>
+ </extension>
+</plugin>
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java
new file mode 100644
index 00000000000..3cc7965c6e4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public CompactLifelineCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static CompactLifelineCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new CompactLifelineCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public CompactLifelineCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
+
+ final Interaction owner = (Interaction) getElementToEdit();
+ owner.getLifelines().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java
new file mode 100644
index 00000000000..d3387922155
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactStateInvariantCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public CompactStateInvariantCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static CompactStateInvariantCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new CompactStateInvariantCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public CompactStateInvariantCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
+
+ final Interaction owner = (Interaction) getElementToEdit();
+ owner.getFragments().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final StateInvariant newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java
new file mode 100644
index 00000000000..122e6290ae9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static DestructionOccurrenceSpecificationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new DestructionOccurrenceSpecificationCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification();
+
+ final Lifeline owner = (Lifeline) getElementToEdit();
+ owner.getCoveredBys().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final DestructionOccurrenceSpecification newElement, final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java
new file mode 100644
index 00000000000..ce2d2be1a46
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationConstraintCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public DurationConstraintCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static DurationConstraintCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new DurationConstraintCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public DurationConstraintCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
+
+ final Namespace owner = (Namespace) getElementToEdit();
+ owner.getOwnedRules().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final DurationConstraint newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java
new file mode 100644
index 00000000000..9ad854967fa
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationObservationCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public DurationObservationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static DurationObservationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new DurationObservationCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public DurationObservationCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
+
+ final Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final DurationObservation newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java
new file mode 100644
index 00000000000..3ce2df7254a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public FullLifelineCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static FullLifelineCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new FullLifelineCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public FullLifelineCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
+
+ final Interaction owner = (Interaction) getElementToEdit();
+ owner.getLifelines().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java
new file mode 100644
index 00000000000..aa3326fa3bf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static FullStateInvariantCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new FullStateInvariantCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
+
+ final Lifeline owner = (Lifeline) getElementToEdit();
+ owner.getCoveredBys().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final StateInvariant newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java
new file mode 100644
index 00000000000..ff66eca0743
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Gate;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GateCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public GateCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static GateCreateCommand create(final CreateElementRequest req, final EObject eObject) {
+ return new GateCreateCommand(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public GateCreateCommand(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final Gate newElement = UMLFactory.eINSTANCE.createGate();
+
+ final Interaction owner = (Interaction) getElementToEdit();
+ owner.getFormalGates().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Gate newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java
new file mode 100644
index 00000000000..eddd140d472
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.GeneralOrdering;
+import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GeneralOrderingCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static GeneralOrderingCreateCommand create(final CreateElementRequest req, final EObject eObject) {
+ return new GeneralOrderingCreateCommand(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingCreateCommand(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final GeneralOrdering newElement = UMLFactory.eINSTANCE.createGeneralOrdering();
+
+ final InteractionFragment owner = (InteractionFragment) getElementToEdit();
+ owner.getGeneralOrderings().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final GeneralOrdering newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java
new file mode 100644
index 00000000000..68e868c863a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionCreateCommandTN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public InteractionCreateCommandTN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static InteractionCreateCommandTN create(final CreateElementRequest req, final EObject eObject) {
+ return new InteractionCreateCommandTN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public InteractionCreateCommandTN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
+
+ final Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Interaction newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java
new file mode 100644
index 00000000000..523833e0ced
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LifelineCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public LifelineCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static LifelineCreateCommand create(final CreateElementRequest req, final EObject eObject) {
+ return new LifelineCreateCommand(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public LifelineCreateCommand(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
+
+ final Interaction owner = (Interaction) getElementToEdit();
+ owner.getLifelines().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java
new file mode 100644
index 00000000000..4e738e5e138
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageAsyncCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof MessageEnd) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof MessageEnd) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_4(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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 Message newElement = UMLFactory.eINSTANCE.createMessage();
+ getContainer().getMessages().add(newElement);
+ newElement.setReceiveEvent(getSource());
+ newElement.setSendEvent(getTarget());
+ doConfigure(newElement, monitor, info);
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getSource() {
+ return (MessageEnd) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getTarget() {
+ return (MessageEnd) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java
new file mode 100644
index 00000000000..e1ce43db959
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageAsyncReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd target = getLink().getSendEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_4(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd source = getLink().getReceiveEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_4(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceiveEvent(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setSendEvent(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldSource() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewSource() {
+ return (MessageEnd) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldTarget() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewTarget() {
+ return (MessageEnd) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java
new file mode 100644
index 00000000000..59fc0499a8f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageCreateCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof MessageEnd) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof MessageEnd) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_44(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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 Message newElement = UMLFactory.eINSTANCE.createMessage();
+ getContainer().getMessages().add(newElement);
+ newElement.setReceiveEvent(getSource());
+ newElement.setSendEvent(getTarget());
+ doConfigure(newElement, monitor, info);
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getSource() {
+ return (MessageEnd) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getTarget() {
+ return (MessageEnd) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java
new file mode 100644
index 00000000000..0d2b84f179f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageCreateReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd target = getLink().getSendEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_44(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd source = getLink().getReceiveEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_44(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceiveEvent(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setSendEvent(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldSource() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewSource() {
+ return (MessageEnd) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldTarget() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewTarget() {
+ return (MessageEnd) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java
new file mode 100644
index 00000000000..440c28d8405
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageDeleteCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof MessageEnd) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof MessageEnd) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_47(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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 Message newElement = UMLFactory.eINSTANCE.createMessage();
+ getContainer().getMessages().add(newElement);
+ newElement.setReceiveEvent(getSource());
+ newElement.setSendEvent(getTarget());
+ doConfigure(newElement, monitor, info);
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getSource() {
+ return (MessageEnd) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getTarget() {
+ return (MessageEnd) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java
new file mode 100644
index 00000000000..667cbc86985
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageDeleteReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd target = getLink().getSendEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_47(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd source = getLink().getReceiveEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_47(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceiveEvent(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setSendEvent(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldSource() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewSource() {
+ return (MessageEnd) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldTarget() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewTarget() {
+ return (MessageEnd) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java
new file mode 100644
index 00000000000..30ce7b4824f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageFoundCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof Element) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof MessageEnd) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_53(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+
+ throw new UnsupportedOperationException();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getSource() {
+ return (Element) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getTarget() {
+ return (MessageEnd) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java
new file mode 100644
index 00000000000..7a71c73a713
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageFoundReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof Element && this.newEnd instanceof Element)) {
+ return false;
+ }
+ final MessageEnd target = getLink().getSendEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_53(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final Element source = getLink().getOwner();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_53(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setSendEvent(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getOldSource() {
+ return (Element) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getNewSource() {
+ return (Element) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldTarget() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewTarget() {
+ return (MessageEnd) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java
new file mode 100644
index 00000000000..39c53b6dd2a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageLostCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof MessageEnd) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof Element) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_50(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+
+ throw new UnsupportedOperationException();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getSource() {
+ return (MessageEnd) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getTarget() {
+ return (Element) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java
new file mode 100644
index 00000000000..cc736b8a9f0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageLostReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final Element target = getLink().getOwner();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_50(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof Element && this.newEnd instanceof Element)) {
+ return false;
+ }
+ final MessageEnd source = getLink().getReceiveEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_50(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceiveEvent(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldSource() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewSource() {
+ return (MessageEnd) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getOldTarget() {
+ return (Element) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected Element getNewTarget() {
+ return (Element) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java
new file mode 100644
index 00000000000..99175014ac5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static MessageOccurrenceSpecificationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new MessageOccurrenceSpecificationCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final MessageOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
+
+ final Lifeline owner = (Lifeline) getElementToEdit();
+ owner.getCoveredBys().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final MessageOccurrenceSpecification newElement, final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java
new file mode 100644
index 00000000000..e48156b63d1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageReplyCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof MessageEnd) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof MessageEnd) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_41(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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 Message newElement = UMLFactory.eINSTANCE.createMessage();
+ getContainer().getMessages().add(newElement);
+ newElement.setReceiveEvent(getSource());
+ newElement.setSendEvent(getTarget());
+ doConfigure(newElement, monitor, info);
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getSource() {
+ return (MessageEnd) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getTarget() {
+ return (MessageEnd) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java
new file mode 100644
index 00000000000..b9577a2406b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageReplyReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd target = getLink().getSendEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_41(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd source = getLink().getReceiveEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_41(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceiveEvent(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setSendEvent(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldSource() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewSource() {
+ return (MessageEnd) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldTarget() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewTarget() {
+ return (MessageEnd) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java
new file mode 100644
index 00000000000..c31439773fd
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ protected final EObject source;
+
+ /**
+ * @generated
+ */
+ protected final EObject target;
+
+ /**
+ * @generated
+ */
+ protected Interaction container;
+
+ /**
+ * @generated
+ */
+ public MessageSyncCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ this.container = deduceContainer(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (this.source == null && this.target == null) {
+ return false;
+ }
+ if (this.source != null && false == this.source instanceof MessageEnd) {
+ return false;
+ }
+ if (this.target != null && false == this.target instanceof MessageEnd) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ if (getContainer() == null) {
+ return false;
+ }
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateMessage_3(getContainer(), getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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 Message newElement = UMLFactory.eINSTANCE.createMessage();
+ getContainer().getMessages().add(newElement);
+ newElement.setReceiveEvent(getSource());
+ newElement.setSendEvent(getTarget());
+ doConfigure(newElement, monitor, info);
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setElementToEdit(final EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getSource() {
+ return (MessageEnd) this.source;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getTarget() {
+ return (MessageEnd) this.target;
+ }
+
+ /**
+ * @generated
+ */
+ public Interaction getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container. Modify with appropriate
+ * logic.
+ *
+ * @generated
+ */
+ protected Interaction deduceContainer(final EObject source, final EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ return (Interaction) element;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java
new file mode 100644
index 00000000000..9818d39ad61
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public MessageSyncReorientCommand(final ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ this.reorientDirection = request.getDirection();
+ this.oldEnd = request.getOldRelationshipEnd();
+ this.newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Message) {
+ return false;
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd target = getLink().getSendEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_3(container, getLink(), getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ return false;
+ }
+ final MessageEnd source = getLink().getReceiveEvent();
+ if (!(getLink().eContainer() instanceof Interaction)) {
+ return false;
+ }
+ final Interaction container = (Interaction) getLink().eContainer();
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_3(container, getLink(), source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ @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$
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().setReceiveEvent(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setSendEvent(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected Message getLink() {
+ return (Message) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldSource() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewSource() {
+ return (MessageEnd) this.newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getOldTarget() {
+ return (MessageEnd) this.oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageEnd getNewTarget() {
+ return (MessageEnd) this.newEnd;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java
new file mode 100644
index 00000000000..2daa0405e09
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static OccurrenceSpecificationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
+ return new OccurrenceSpecificationCreateCommandCN(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationCreateCommandCN(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final OccurrenceSpecification newElement = UMLFactory.eINSTANCE.createOccurrenceSpecification();
+
+ final Lifeline owner = (Lifeline) getElementToEdit();
+ owner.getCoveredBys().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final OccurrenceSpecification newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java
new file mode 100644
index 00000000000..3af03ff8294
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.TimeConstraint;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public TimeConstraintCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static TimeConstraintCreateCommand create(final CreateElementRequest req, final EObject eObject) {
+ return new TimeConstraintCreateCommand(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public TimeConstraintCreateCommand(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
+
+ final Namespace owner = (Namespace) getElementToEdit();
+ owner.getOwnedRules().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final TimeConstraint newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java
new file mode 100644
index 00000000000..eded4611960
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.TimeObservation;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private EClass eClass = null;
+ /**
+ * @generated
+ */
+ private EObject eObject = null;
+
+ /**
+ * @generated
+ */
+ public TimeObservationCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.eClass = eObject != null ? eObject.eClass() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static TimeObservationCreateCommand create(final CreateElementRequest req, final EObject eObject) {
+ return new TimeObservationCreateCommand(req, eObject);
+ }
+
+ /**
+ * @generated
+ */
+ public TimeObservationCreateCommand(final CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ *
+ * @generated
+ */
+ @Override
+ protected EObject getElementToEdit() {
+
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ if (container != null) {
+ return container;
+ }
+ return this.eObject;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean canExecute() {
+
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+
+ final TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
+
+ final Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(final TimeObservation newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
+ final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactLifelineEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactLifelineEditHelper.java
new file mode 100644
index 00000000000..5928f37e7c5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactLifelineEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactStateInvariantEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactStateInvariantEditHelper.java
new file mode 100644
index 00000000000..e9983d66549
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactStateInvariantEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactStateInvariantEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DestructionOccurrenceSpecificationEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DestructionOccurrenceSpecificationEditHelper.java
new file mode 100644
index 00000000000..abf46f7cbf4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DestructionOccurrenceSpecificationEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationConstraintEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationConstraintEditHelper.java
new file mode 100644
index 00000000000..b4f79b42c73
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationConstraintEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationConstraintEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationObservationEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationObservationEditHelper.java
new file mode 100644
index 00000000000..cc27d0bba92
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationObservationEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationObservationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullLifelineEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullLifelineEditHelper.java
new file mode 100644
index 00000000000..ecda27db17d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullLifelineEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullStateInvariantEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullStateInvariantEditHelper.java
new file mode 100644
index 00000000000..666473b0780
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullStateInvariantEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GateEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GateEditHelper.java
new file mode 100644
index 00000000000..7a584ff74e8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GateEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GateEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GeneralOrderingEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GeneralOrderingEditHelper.java
new file mode 100644
index 00000000000..2dfe4422f8f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GeneralOrderingEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GeneralOrderingEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/InteractionEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/InteractionEditHelper.java
new file mode 100644
index 00000000000..cd34189f7dc
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/InteractionEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/LifelineEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/LifelineEditHelper.java
new file mode 100644
index 00000000000..8c7a3ac3b4c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/LifelineEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LifelineEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageAsyncEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageAsyncEditHelper.java
new file mode 100644
index 00000000000..853cd611ad2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageAsyncEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageCreateEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageCreateEditHelper.java
new file mode 100644
index 00000000000..5ce886e0fc9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageCreateEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageDeleteEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageDeleteEditHelper.java
new file mode 100644
index 00000000000..5c2ef2f31eb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageDeleteEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageFoundEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageFoundEditHelper.java
new file mode 100644
index 00000000000..8faf0483921
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageFoundEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageLostEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageLostEditHelper.java
new file mode 100644
index 00000000000..30ea266e0a8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageLostEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageOccurrenceSpecificationEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageOccurrenceSpecificationEditHelper.java
new file mode 100644
index 00000000000..21771df566c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageOccurrenceSpecificationEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageReplyEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageReplyEditHelper.java
new file mode 100644
index 00000000000..5e95f7df97b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageReplyEditHelper.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyEditHelper extends AbstractEditHelperAdvice {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageSyncEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageSyncEditHelper.java
new file mode 100644
index 00000000000..d544b9679e1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageSyncEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/OccurrenceSpecificationEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/OccurrenceSpecificationEditHelper.java
new file mode 100644
index 00000000000..e7253446eaf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/OccurrenceSpecificationEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/PackageEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/PackageEditHelper.java
new file mode 100644
index 00000000000..2f71ad2b22e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/PackageEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class PackageEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeConstraintEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeConstraintEditHelper.java
new file mode 100644
index 00000000000..9165b3555f4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeConstraintEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeObservationEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeObservationEditHelper.java
new file mode 100644
index 00000000000..9258c54d23e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeObservationEditHelper.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationEditHelper extends UMLBaseEditHelper {
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/UMLBaseEditHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/UMLBaseEditHelper.java
new file mode 100644
index 00000000000..70acf0b5deb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/UMLBaseEditHelper.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.helpers;
+
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLBaseEditHelper extends GeneratedEditHelperBase {
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java
new file mode 100644
index 00000000000..5d42f05cb5f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactLifelineCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactLifelineCompartmentLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineCompartmentGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactLifelineCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineCompartmentEditPartCN
+
+extends ShapeCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 23;
+
+ /**
+ * @generated
+ */
+ public CompactLifelineCompartmentEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.CompactLifelineCompartmentEditPartCN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CompactLifelineCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomCompactLifelineCompartmentLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomCompactLifelineCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomLifelineCompartmentGraphicalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java
new file mode 100644
index 00000000000..084319eadc8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java
@@ -0,0 +1,459 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactLifelineItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimeRulerVisibilityRefreshEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactLifelineFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactLifelineItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineEditPartCN extends
+
+LifelineEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 20;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public CompactLifelineEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CompactLifelineItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomCompactLifelineItemSemanticEditPolicyCN());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(TimeRulerVisibilityRefreshEditPolicy.ROLE, new TimeRulerVisibilityRefreshEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new CompactLifelineFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public CompactLifelineFigure getPrimaryShape() {
+ return (CompactLifelineFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof CompactLifelineNameEditPart) {
+ ((CompactLifelineNameEditPart) childEditPart).setLabel(getPrimaryShape().getLifelineLabelFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof CompactLifelineCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimelineContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((CompactLifelineCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof CompactLifelineTimeRulerCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimeRulerContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((CompactLifelineTimeRulerCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof CompactLifelineNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof CompactLifelineCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimelineContainerFigure();
+ pane.remove(((CompactLifelineCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof CompactLifelineTimeRulerCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimeRulerContainerFigure();
+ pane.remove(((CompactLifelineTimeRulerCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ if (editPart instanceof CompactLifelineCompartmentEditPartCN) {
+ return getPrimaryShape().getTimelineContainerFigure();
+ }
+ if (editPart instanceof CompactLifelineTimeRulerCompartmentEditPartCN) {
+ return getPrimaryShape().getTimeRulerContainerFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "CompactLifeline";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CompactLifelineNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getTargetEditPart(final Request request) {
+ if (request instanceof CreateViewAndElementRequest) {
+ final CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ final IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Node_24) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID));
+ }
+ }
+ return super.getTargetEditPart(request);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("CompactLifeline", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("CompactLifeline", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("CompactLifeline", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("CompactLifeline", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java
new file mode 100644
index 00000000000..a3ecfaf846a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java
@@ -0,0 +1,808 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineNameEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 22;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public CompactLifelineNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.NodeLabelDragPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new CustomLifelineNameEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final LifelineVerticalLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Lifeline_20, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ CompactLifelineNameEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ refreshLabel();
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.java
new file mode 100644
index 00000000000..46446afbf0d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineTimeRulerCompartmentEditPartCN
+
+extends ListCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 83;
+
+ /**
+ * @generated
+ */
+ public CompactLifelineTimeRulerCompartmentEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean hasModelChildrenChanged(final Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.CompactLifelineTimeRulerCompartmentEditPartCN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java
new file mode 100644
index 00000000000..55b479fe079
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java
@@ -0,0 +1,450 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+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.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomCompactStateInvariantItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CompactStateFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.CompactStateInvariantItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactStateInvariantEditPartCN extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 28;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public CompactStateInvariantEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CompactStateInvariantItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomCompactStateInvariantItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the
+ * Label from the EditPart Registry. After that, we can't reset the visibility to true (using the Show/Hide
+ * Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ final Object notifier = event.getNotifier();
+ final List<?> modelChildren = ((View) getModel()).getChildren();
+ if (!(notifier instanceof Edge)) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case StateInvariantAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new CompactStateFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public CompactStateFigure getPrimaryShape() {
+ return (CompactStateFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof CompactStateInvariantNameEditPart) {
+ ((CompactStateInvariantNameEditPart) childEditPart).setLabel(getPrimaryShape().getCompactStateInvariantLabel());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof CompactStateInvariantNameEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ if (editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof StateInvariantAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "CompactStateInvariant";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CompactStateInvariantNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("CompactStateInvariant", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("CompactStateInvariant", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("CompactStateInvariant", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("CompactStateInvariant", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java
new file mode 100644
index 00000000000..c8c7879e4fd
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java
@@ -0,0 +1,805 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactStateInvariantNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 31;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public CompactStateInvariantNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.NodeLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.StateInvariant_28, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ CompactStateInvariantNameEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ refreshLabel();
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..e63dfff1c88
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java
@@ -0,0 +1,791 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 63;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry
+ .getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.DestructionOccurrenceSpecification_27, getParserElement(), UMLVisualIDRegistry
+ .getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ DestructionOccurrenceSpecificationAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java
new file mode 100644
index 00000000000..b55331dcc9b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,542 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CrossFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.DestructionOccurrenceSpecificationItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationEditPartCN extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 27;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DestructionOccurrenceSpecificationItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ case DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new CrossFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public CrossFigure getPrimaryShape() {
+ return (CrossFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof DestructionOccurrenceSpecificationAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else if (borderItemEditPart instanceof DestructionOccurrenceSpecificationLabelEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "DestructionOccurrenceSpecification";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(7);
+ types.add(UMLElementTypes.Message_3);
+ types.add(UMLElementTypes.Message_4);
+ types.add(UMLElementTypes.Message_41);
+ types.add(UMLElementTypes.Message_44);
+ types.add(UMLElementTypes.Message_47);
+ types.add(UMLElementTypes.Message_50);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof InteractionEditPartTN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof FullLifelineEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof CompactLifelineEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof TimeConstraintEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof TimeObservationEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DurationConstraintEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DurationObservationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof GeneralOrderingEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof LifelineEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_3) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_4) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_41) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_44) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_47) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.Interaction_2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Lifeline_40);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(7);
+ types.add(UMLElementTypes.Message_3);
+ types.add(UMLElementTypes.Message_4);
+ types.add(UMLElementTypes.Message_41);
+ types.add(UMLElementTypes.Message_44);
+ types.add(UMLElementTypes.Message_47);
+ types.add(UMLElementTypes.Message_50);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_3) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_4) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_41) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_44) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_47) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.Interaction_2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Lifeline_40);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DestructionOccurrenceSpecification", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DestructionOccurrenceSpecification", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DestructionOccurrenceSpecification", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("DestructionOccurrenceSpecification",
+ PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java
new file mode 100644
index 00000000000..d51ac4d755a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,794 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationLabelEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 32;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.DestructionOccurrenceSpecification_27, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ DestructionOccurrenceSpecificationLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java
new file mode 100644
index 00000000000..de79fb32a26
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.DimensioningArrowFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.DurationConstraintItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationConstraintEditPartCN extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 18;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DurationConstraintEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DurationConstraintItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case DurationConstraintSpecificationEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new DimensioningArrowFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public DimensioningArrowFigure getPrimaryShape() {
+ return (DimensioningArrowFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof DurationConstraintSpecificationEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "DurationConstraint";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DurationConstraintSpecificationEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DurationConstraint", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DurationConstraint", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DurationConstraint", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("DurationConstraint", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java
new file mode 100644
index 00000000000..17b63f0c2b5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java
@@ -0,0 +1,794 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationConstraintSpecificationEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 33;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintSpecificationEditPart.VISUAL_ID), new Point(0,
+ 0));
+ }
+
+ /**
+ * @generated
+ */
+ public DurationConstraintSpecificationEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.DurationConstraint_18, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintSpecificationEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ DurationConstraintSpecificationEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java
new file mode 100644
index 00000000000..8a69a1ec842
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.DimensioningArrowFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.DurationObservationItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationObservationEditPartCN extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 17;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DurationObservationEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DurationObservationItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case DurationObservationNameEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new DimensioningArrowFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public DimensioningArrowFigure getPrimaryShape() {
+ return (DimensioningArrowFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof DurationObservationNameEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "DurationObservation";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DurationObservationNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DurationObservation", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DurationObservation", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("DurationObservation", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("DurationObservation", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java
new file mode 100644
index 00000000000..a3d5a2c1a1a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationObservationNameEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 35;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationNameEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public DurationObservationNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.DurationObservation_17, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ DurationObservationNameEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java
new file mode 100644
index 00000000000..306fb93a75a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.SelectionOnlyLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FreeTimeRulerCompartmentEditPart
+
+extends ShapeCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 80;
+
+ /**
+ * @generated
+ */
+ public FreeTimeRulerCompartmentEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.FreeTimeRulerCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new SelectionOnlyLayoutEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java
new file mode 100644
index 00000000000..0b37795cd3b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.TimingRulerFigure;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FreeTimingRulerEditPartCN extends
+
+ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 24;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public FreeTimingRulerEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new TimingRulerFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public TimingRulerFigure getPrimaryShape() {
+ return (TimingRulerFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+
+ if (childEditPart instanceof FreeTimeRulerCompartmentEditPart) {
+ final IFigure pane = getPrimaryShape().getFreeTimeRulerContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((FreeTimeRulerCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof FreeTimeRulerCompartmentEditPart) {
+ final IFigure pane = getPrimaryShape().getFreeTimeRulerContainerFigure();
+ pane.remove(((FreeTimeRulerCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ if (editPart instanceof FreeTimeRulerCompartmentEditPart) {
+ return getPrimaryShape().getFreeTimeRulerContainerFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "FreeTimingRuler";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FreeTimingRuler", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FreeTimingRuler", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FreeTimingRuler", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("FreeTimingRuler", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java
new file mode 100644
index 00000000000..ebeeaa9e0b3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java
@@ -0,0 +1,477 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimeRulerVisibilityRefreshEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullLifelineFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullLifelineItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineEditPartCN extends
+
+LifelineEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 19;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public FullLifelineEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FullLifelineItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomFullLifelineItemSemanticEditPolicyCN());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(TimeRulerVisibilityRefreshEditPolicy.ROLE, new TimeRulerVisibilityRefreshEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new FullLifelineFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public FullLifelineFigure getPrimaryShape() {
+ return (FullLifelineFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof FullLifelineNameEditPart) {
+ ((FullLifelineNameEditPart) childEditPart).setLabel(getPrimaryShape().getLifelineLabelFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof FullLifelineStateDefinitionCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getStateDefinitionContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((FullLifelineStateDefinitionCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof FullLifelineTimelineCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimelineContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((FullLifelineTimelineCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof FullLifelineTimeRulerCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimeRulerContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((FullLifelineTimeRulerCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof FullLifelineNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof FullLifelineStateDefinitionCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getStateDefinitionContainerFigure();
+ pane.remove(((FullLifelineStateDefinitionCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof FullLifelineTimelineCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimelineContainerFigure();
+ pane.remove(((FullLifelineTimelineCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof FullLifelineTimeRulerCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimeRulerContainerFigure();
+ pane.remove(((FullLifelineTimeRulerCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ if (editPart instanceof FullLifelineStateDefinitionCompartmentEditPartCN) {
+ return getPrimaryShape().getStateDefinitionContainerFigure();
+ }
+ if (editPart instanceof FullLifelineTimelineCompartmentEditPartCN) {
+ return getPrimaryShape().getTimelineContainerFigure();
+ }
+ if (editPart instanceof FullLifelineTimeRulerCompartmentEditPartCN) {
+ return getPrimaryShape().getTimeRulerContainerFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "FullLifeline";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(FullLifelineNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getTargetEditPart(final Request request) {
+ if (request instanceof CreateViewAndElementRequest) {
+ final CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ final IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Node_9) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID));
+ }
+ if (type == UMLElementTypes.Node_24) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID));
+ }
+ }
+ return super.getTargetEditPart(request);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FullLifeline", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FullLifeline", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FullLifeline", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("FullLifeline", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java
new file mode 100644
index 00000000000..65e73f2d03e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java
@@ -0,0 +1,807 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineNameEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 21;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public FullLifelineNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.NodeLabelDragPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new CustomLifelineNameEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final LifelineVerticalLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Lifeline_19, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ FullLifelineNameEditPart.this.configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ refreshLabel();
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java
new file mode 100644
index 00000000000..2b7758d9b1a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineStateDefinitionCompartmentEditPartCN
+
+extends ListCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7;
+
+ /**
+ * @generated
+ */
+ public FullLifelineStateDefinitionCompartmentEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean hasModelChildrenChanged(final Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.FullLifelineStateDefinitionCompartmentEditPartCN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.java
new file mode 100644
index 00000000000..4f7d07d63c8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineTimeRulerCompartmentEditPartCN
+
+extends ListCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 82;
+
+ /**
+ * @generated
+ */
+ public FullLifelineTimeRulerCompartmentEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean hasModelChildrenChanged(final Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.FullLifelineTimeRulerCompartmentEditPartCN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java
new file mode 100644
index 00000000000..d4bd80556f4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomLifelineCompartmentGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomTimelineCompartmentLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullLifelineTimelineCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineTimelineCompartmentEditPartCN
+
+extends ShapeCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 8;
+
+ /**
+ * @generated
+ */
+ public FullLifelineTimelineCompartmentEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.FullLifelineTimelineCompartmentEditPartCN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FullLifelineTimelineCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomTimelineCompartmentLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomLifelineCompartmentGraphicalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..14aa46fc279
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java
@@ -0,0 +1,790 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 62;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.StateInvariant_11, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ FullStateInvariantAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java
new file mode 100644
index 00000000000..03f86f7e7a6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+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.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomFullStateInvariantItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullStateFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.FullStateInvariantItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantEditPartCN extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 11;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FullStateInvariantItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomFullStateInvariantItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the
+ * Label from the EditPart Registry. After that, we can't reset the visibility to true (using the Show/Hide
+ * Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ final Object notifier = event.getNotifier();
+ final List<?> modelChildren = ((View) getModel()).getChildren();
+ if (!(notifier instanceof Edge)) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new FullStateFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public FullStateFigure getPrimaryShape() {
+ return (FullStateFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof FullStateInvariantAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "FullStateInvariant";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FullStateInvariant", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FullStateInvariant", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("FullStateInvariant", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("FullStateInvariant", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java
new file mode 100644
index 00000000000..b983b3790cd
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.FullStateInvariantVerticalLineFigure;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantVerticalLineEditPart extends
+
+ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 39;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantVerticalLineEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new FullStateInvariantVerticalLineFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantVerticalLineFigure getPrimaryShape() {
+ return (FullStateInvariantVerticalLineFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "VerticalLineStateInvariant";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("VerticalLineStateInvariant", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("VerticalLineStateInvariant", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("VerticalLineStateInvariant", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("VerticalLineStateInvariant", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java
new file mode 100644
index 00000000000..d32e5ab1b31
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java
@@ -0,0 +1,536 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomGateItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.GateFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.GateItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GateEditPart extends
+
+BorderedBorderItemEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 69;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public GateEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new GateItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomGateItemSemanticEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case GateLabelEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new GateFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public GateFigure getPrimaryShape() {
+ return (GateFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof GateLabelEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "Gate";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ // FIXME: workaround for #154536
+ result.getBounds().setSize(result.getPreferredSize());
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(GateLabelEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(7);
+ types.add(UMLElementTypes.Message_3);
+ types.add(UMLElementTypes.Message_4);
+ types.add(UMLElementTypes.Message_41);
+ types.add(UMLElementTypes.Message_44);
+ types.add(UMLElementTypes.Message_47);
+ types.add(UMLElementTypes.Message_50);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof InteractionEditPartTN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof FullLifelineEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof CompactLifelineEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof TimeConstraintEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof TimeObservationEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DurationConstraintEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DurationObservationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof GeneralOrderingEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof LifelineEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_3) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_4) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_41) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_44) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_47) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.Interaction_2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Lifeline_40);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(7);
+ types.add(UMLElementTypes.Message_3);
+ types.add(UMLElementTypes.Message_4);
+ types.add(UMLElementTypes.Message_41);
+ types.add(UMLElementTypes.Message_44);
+ types.add(UMLElementTypes.Message_47);
+ types.add(UMLElementTypes.Message_50);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_3) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_4) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_41) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_44) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_47) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.Interaction_2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Lifeline_40);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Gate", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Gate", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Gate", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("Gate", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java
new file mode 100644
index 00000000000..d0696077a8e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java
@@ -0,0 +1,791 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GateLabelEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 70;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateLabelEditPart.VISUAL_ID), new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public GateLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Gate_69, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ GateLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java
new file mode 100644
index 00000000000..759dcc76b63
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.GeneralOrderingHorizontalFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.GeneralOrderingItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GeneralOrderingEditPart extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 67;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new GeneralOrderingItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case GeneralOrderingNameEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new GeneralOrderingHorizontalFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingHorizontalFigure getPrimaryShape() {
+ return (GeneralOrderingHorizontalFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof GeneralOrderingNameEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "GeneralOrdering";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(GeneralOrderingNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("GeneralOrdering", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("GeneralOrdering", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("GeneralOrdering", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("GeneralOrdering", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java
new file mode 100644
index 00000000000..f506e6e9448
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GeneralOrderingNameEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 68;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingNameEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.GeneralOrdering_67, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ GeneralOrderingNameEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java
new file mode 100644
index 00000000000..db83ae6745f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCompartmentCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCompartmentItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCompartmentLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.InteractionCompartmentItemSemanticEditPolicyTN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionCompartmentEditPartTN
+
+extends ListCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5;
+
+ /**
+ * @generated
+ */
+ public InteractionCompartmentEditPartTN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean hasModelChildrenChanged(final Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.InteractionCompartmentEditPartTN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InteractionCompartmentItemSemanticEditPolicyTN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomInteractionCompartmentCreationEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomInteractionCompartmentLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomInteractionCompartmentItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java
new file mode 100644
index 00000000000..9fb607c0313
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomInteractionCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.CustomInteractionRectangleFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.InteractionNodeItemSemanticEditPolicyTN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionEditPartTN extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public InteractionEditPartTN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InteractionNodeItemSemanticEditPolicyTN());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomInteractionCreationEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case GateEditPart.VISUAL_ID:
+
+ return new BorderItemResizableEditPolicy();
+
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new CustomInteractionRectangleFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public CustomInteractionRectangleFigure getPrimaryShape() {
+ return (CustomInteractionRectangleFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof InteractionNameEditPart) {
+ ((InteractionNameEditPart) childEditPart).setLabel(getPrimaryShape().getHeaderLabel());
+ return true;
+ }
+
+ if (childEditPart instanceof InteractionCompartmentEditPartTN) {
+ final IFigure pane = getPrimaryShape().getCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InteractionCompartmentEditPartTN) childEditPart).getFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof TimeRulerCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimeRulerContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((TimeRulerCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ if (childEditPart instanceof GateEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.NONE);
+ getBorderedFigure().getBorderItemContainer().add(((GateEditPart) childEditPart).getFigure(), locator);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof InteractionNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof InteractionCompartmentEditPartTN) {
+ final IFigure pane = getPrimaryShape().getCompartmentFigure();
+ pane.remove(((InteractionCompartmentEditPartTN) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof TimeRulerCompartmentEditPartCN) {
+ final IFigure pane = getPrimaryShape().getTimeRulerContainerFigure();
+ pane.remove(((TimeRulerCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ if (childEditPart instanceof GateEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((GateEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ if (editPart instanceof InteractionCompartmentEditPartTN) {
+ return getPrimaryShape().getCompartmentFigure();
+ }
+ if (editPart instanceof TimeRulerCompartmentEditPartCN) {
+ return getPrimaryShape().getTimeRulerContainerFigure();
+ }
+ if (editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "Interaction";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InteractionNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getTargetEditPart(final Request request) {
+ if (request instanceof CreateViewAndElementRequest) {
+ final CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ final IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == UMLElementTypes.Lifeline_19) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InteractionCompartmentEditPartTN.VISUAL_ID));
+ }
+ if (type == UMLElementTypes.Lifeline_20) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(InteractionCompartmentEditPartTN.VISUAL_ID));
+ }
+ if (type == UMLElementTypes.Node_24) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(TimeRulerCompartmentEditPartCN.VISUAL_ID));
+ }
+ if (type == UMLElementTypes.Node_25) {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(TimeRulerCompartmentEditPartCN.VISUAL_ID));
+ }
+ }
+ return super.getTargetEditPart(request);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Interaction", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Interaction", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Interaction", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("Interaction", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java
new file mode 100644
index 00000000000..a7df6a3348e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java
@@ -0,0 +1,804 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 37;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public InteractionNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.NodeLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Interaction_2, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ InteractionNameEditPart.this.configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ refreshLabel();
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java
new file mode 100644
index 00000000000..9136ff38009
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.LifelineItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LifelineEditPart extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 40;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public LifelineEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new LifelineItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new LifelineFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public LifelineFigure getPrimaryShape() {
+ return (LifelineFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "Lifeline";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Lifeline", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Lifeline", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Lifeline", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("Lifeline", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java
new file mode 100644
index 00000000000..2cb39f8c575
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LinearTimeRulerCompartmentEditPart
+
+extends ShapeCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 81;
+
+ /**
+ * @generated
+ */
+ public LinearTimeRulerCompartmentEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.LinearTimeRulerCompartmentEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java
new file mode 100644
index 00000000000..cd133dfa46d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.TimingRulerFigure;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LinearTimingRulerEditPartCN extends
+
+ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 25;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public LinearTimingRulerEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new TimingRulerFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public TimingRulerFigure getPrimaryShape() {
+ return (TimingRulerFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+
+ if (childEditPart instanceof LinearTimeRulerCompartmentEditPart) {
+ final IFigure pane = getPrimaryShape().getLinearTimeRulerContainerFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((LinearTimeRulerCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof LinearTimeRulerCompartmentEditPart) {
+ final IFigure pane = getPrimaryShape().getLinearTimeRulerContainerFigure();
+ pane.remove(((LinearTimeRulerCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ if (editPart instanceof LinearTimeRulerCompartmentEditPart) {
+ return getPrimaryShape().getLinearTimeRulerContainerFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "LinearTimingRuler";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("LinearTimingRuler", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("LinearTimingRuler", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("LinearTimingRuler", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("LinearTimingRuler", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..599de9d58ee
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 61;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageAsyncAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_4, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageAsyncAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java
new file mode 100644
index 00000000000..7e078a66eda
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageAsyncFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageAsyncItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4;
+
+ /**
+ * @generated
+ */
+ public MessageAsyncEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageAsyncItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageAsyncNameLabelEditPart) {
+ ((MessageAsyncNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageAsyncAppliedStereotypeEditPart) {
+ ((MessageAsyncAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageAsyncNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageAsyncAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageAsyncFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageAsyncFigure getPrimaryShape() {
+ return (MessageAsyncFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java
new file mode 100644
index 00000000000..ec89e5c7192
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 60;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageAsyncNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_4, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageAsyncNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..e9f91e47d4d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 46;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageCreateAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_44, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageCreateAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java
new file mode 100644
index 00000000000..05405a0aef8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageCreateFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageCreateItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 44;
+
+ /**
+ * @generated
+ */
+ public MessageCreateEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageCreateItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageCreateNameLabelEditPart) {
+ ((MessageCreateNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageCreateAppliedStereotypeEditPart) {
+ ((MessageCreateAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageCreateNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageCreateAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageCreateFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageCreateFigure getPrimaryShape() {
+ return (MessageCreateFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java
new file mode 100644
index 00000000000..058582d8ebc
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 45;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageCreateNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_44, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageCreateNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..a7863c5f85b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 49;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageDeleteAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_47, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageDeleteAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java
new file mode 100644
index 00000000000..57799a56e80
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageDeleteFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageDeleteItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 47;
+
+ /**
+ * @generated
+ */
+ public MessageDeleteEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageDeleteItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageDeleteNameLabelEditPart) {
+ ((MessageDeleteNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageDeleteAppliedStereotypeEditPart) {
+ ((MessageDeleteAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageDeleteNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageDeleteAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageDeleteFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageDeleteFigure getPrimaryShape() {
+ return (MessageDeleteFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java
new file mode 100644
index 00000000000..58034bb7ac0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 48;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageDeleteNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_47, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageDeleteNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..8871c8cc4ab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 55;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageFoundAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_53, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageFoundAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java
new file mode 100644
index 00000000000..2d1e1048fc5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageFoundFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageFoundItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 53;
+
+ /**
+ * @generated
+ */
+ public MessageFoundEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageFoundItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageFoundNameLabelEditPart) {
+ ((MessageFoundNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageFoundAppliedStereotypeEditPart) {
+ ((MessageFoundAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageFoundNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageFoundAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageFoundFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageFoundFigure getPrimaryShape() {
+ return (MessageFoundFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java
new file mode 100644
index 00000000000..88d19babdab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 54;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageFoundNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_53, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageFoundNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..d4eb416b7bf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 52;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostAppliedStereotypeEditPart.VISUAL_ID),
+ new Point(0, -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageLostAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_50, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageLostAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java
new file mode 100644
index 00000000000..08a681e4c14
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageLostFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageLostItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 50;
+
+ /**
+ * @generated
+ */
+ public MessageLostEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageLostItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageLostNameLabelEditPart) {
+ ((MessageLostNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageLostAppliedStereotypeEditPart) {
+ ((MessageLostAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageLostNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageLostAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageLostFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageLostFigure getPrimaryShape() {
+ return (MessageLostFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java
new file mode 100644
index 00000000000..61b85fc53d3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 51;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageLostNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_50, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageLostNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..a49c72c2cdb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java
@@ -0,0 +1,791 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 59;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry
+ .getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.MessageOccurrenceSpecification_13, getParserElement(), UMLVisualIDRegistry
+ .getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageOccurrenceSpecificationAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java
new file mode 100644
index 00000000000..ddfe283b8cc
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,569 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+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.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomMessageOccurrenceSpecificationItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageOccurrenceSpecificationItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationEditPartCN extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 13;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageOccurrenceSpecificationItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomMessageOccurrenceSpecificationItemSemanticEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the
+ * Label from the EditPart Registry. After that, we can't reset the visibility to true (using the Show/Hide
+ * Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ final Object notifier = event.getNotifier();
+ final List<?> modelChildren = ((View) getModel()).getChildren();
+ if (!(notifier instanceof Edge)) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ case MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new SmallSquareFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public SmallSquareFigure getPrimaryShape() {
+ return (SmallSquareFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof MessageOccurrenceSpecificationAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else if (borderItemEditPart instanceof MessageOccurrenceSpecificationLabelEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "MessageOccurrenceSpecification";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(7);
+ types.add(UMLElementTypes.Message_3);
+ types.add(UMLElementTypes.Message_4);
+ types.add(UMLElementTypes.Message_41);
+ types.add(UMLElementTypes.Message_44);
+ types.add(UMLElementTypes.Message_47);
+ types.add(UMLElementTypes.Message_50);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_3);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_4);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_41);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_44);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_47);
+ }
+ if (targetEditPart instanceof InteractionEditPartTN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof FullLifelineEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof CompactLifelineEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof TimeConstraintEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof TimeObservationEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DurationConstraintEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DurationObservationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof GeneralOrderingEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof LifelineEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_50);
+ }
+ if (targetEditPart instanceof org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_3) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_4) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_41) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_44) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_47) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.Interaction_2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Lifeline_40);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(7);
+ types.add(UMLElementTypes.Message_3);
+ types.add(UMLElementTypes.Message_4);
+ types.add(UMLElementTypes.Message_41);
+ types.add(UMLElementTypes.Message_44);
+ types.add(UMLElementTypes.Message_47);
+ types.add(UMLElementTypes.Message_50);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_3) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_4) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_41) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_44) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_47) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ } else if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.Interaction_2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Lifeline_40);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("MessageOccurrenceSpecification", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("MessageOccurrenceSpecification", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("MessageOccurrenceSpecification", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("MessageOccurrenceSpecification", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java
new file mode 100644
index 00000000000..6492f01becb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,794 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationLabelEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 14;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.MessageOccurrenceSpecification_13, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageOccurrenceSpecificationLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..7e26c3852ca
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 43;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageReplyAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_41, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageReplyAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java
new file mode 100644
index 00000000000..eb4fdb400be
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageReplyFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageReplyItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 41;
+
+ /**
+ * @generated
+ */
+ public MessageReplyEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageReplyItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageReplyNameLabelEditPart) {
+ ((MessageReplyNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageReplyAppliedStereotypeEditPart) {
+ ((MessageReplyAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageReplyNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageReplyAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageReplyFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageReplyFigure getPrimaryShape() {
+ return (MessageReplyFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java
new file mode 100644
index 00000000000..89cf8f99236
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 42;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageReplyNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_41, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageReplyNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..fb3e36e5c57
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 57;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncAppliedStereotypeEditPart.VISUAL_ID),
+ new Point(0, -30));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageSyncAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_3, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageSyncAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java
new file mode 100644
index 00000000000..f43b9d9a606
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.MessageSyncFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageSyncItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncEditPart extends ConnectionEditPart
+
+implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3;
+
+ /**
+ * @generated
+ */
+ public MessageSyncEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MessageSyncItemSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageSyncNameLabelEditPart) {
+ ((MessageSyncNameLabelEditPart) childEditPart).setLabel(getPrimaryShape().getMessageLabel());
+ return true;
+ }
+ if (childEditPart instanceof MessageSyncAppliedStereotypeEditPart) {
+ ((MessageSyncAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof MessageSyncNameLabelEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof MessageSyncAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new MessageSyncFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public MessageSyncFigure getPrimaryShape() {
+ return (MessageSyncFigure) getFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java
new file mode 100644
index 00000000000..df0dba7c53c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncNameLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 56;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncNameLabelEditPart.VISUAL_ID),
+ new Point(0, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public MessageSyncNameLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.LinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Message_3, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncNameLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ MessageSyncNameLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return (View) getModel();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..89309de8bb9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java
@@ -0,0 +1,790 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 58;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.OccurrenceSpecification_12, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ OccurrenceSpecificationAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java
new file mode 100644
index 00000000000..aa3856bc93c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+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.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomOccurrenceSpecificationItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.SmallSquareFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.OccurrenceSpecificationItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationEditPartCN extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 12;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OccurrenceSpecificationItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomOccurrenceSpecificationItemSemanticEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the
+ * Label from the EditPart Registry. After that, we can't reset the visibility to true (using the Show/Hide
+ * Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ final Object notifier = event.getNotifier();
+ final List<?> modelChildren = ((View) getModel()).getChildren();
+ if (!(notifier instanceof Edge)) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case OccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ case OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new SmallSquareFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public SmallSquareFigure getPrimaryShape() {
+ return (SmallSquareFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof OccurrenceSpecificationAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else if (borderItemEditPart instanceof OccurrenceSpecificationLabelEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "OccurrenceSpecification";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(OccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("OccurrenceSpecification", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("OccurrenceSpecification", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("OccurrenceSpecification", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("OccurrenceSpecification", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java
new file mode 100644
index 00000000000..077d7e77b6c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationLabelEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 10;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.OccurrenceSpecification_12, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ OccurrenceSpecificationLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java
new file mode 100644
index 00000000000..bd77c1a86bb
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.StateDefinitionFigure;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class StateDefinitionEditPart extends
+
+NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 9;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public StateDefinitionEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ 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) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new StateDefinitionFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public StateDefinitionFigure getPrimaryShape() {
+ return (StateDefinitionFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof StateDefinitionLabelEditPart) {
+ ((StateDefinitionLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(final EditPart childEditPart) {
+ if (childEditPart instanceof StateDefinitionLabelEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(final EditPart childEditPart, final int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(final EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(final IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "StateDefinition";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ final ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(StateDefinitionLabelEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("StateDefinition", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("StateDefinition", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("StateDefinition", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("StateDefinition", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java
new file mode 100644
index 00000000000..55fa0a49067
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java
@@ -0,0 +1,804 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class StateDefinitionLabelEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 38;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public StateDefinitionLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TimingDiagramEditPart.NodeLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Node_9, getParserElement(), CommonParserHint.DESCRIPTION);
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ StateDefinitionLabelEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ refreshLabel();
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..e804c7f155e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java
@@ -0,0 +1,790 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class StateInvariantAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 64;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateInvariantAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ 0));
+ }
+
+ /**
+ * @generated
+ */
+ public StateInvariantAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.StateInvariant_28, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateInvariantAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ StateInvariantAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java
new file mode 100644
index 00000000000..25bc8549b2c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TickEditPart extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 26;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public TickEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case TickNameEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new VerticalMarkFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public VerticalMarkFigure getPrimaryShape() {
+ return (VerticalMarkFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof TickNameEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "Tick";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(TickNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Tick", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Tick", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("Tick", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("Tick", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java
new file mode 100644
index 00000000000..b73fe5603b3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java
@@ -0,0 +1,791 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TickNameEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 36;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickNameEditPart.VISUAL_ID), new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public TickNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return (View) getModel();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.Node_26, getParserElement(), CommonParserHint.DESCRIPTION);
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ TickNameEditPart.this.configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..556ef796535
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java
@@ -0,0 +1,790 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 65;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ 0));
+ }
+
+ /**
+ * @generated
+ */
+ public TimeConstraintAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.TimeConstraint_15, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ TimeConstraintAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java
new file mode 100644
index 00000000000..774bf2a2d0b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.FirstEventRefreshEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.TimeConstraintItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintEditPart extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 15;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public TimeConstraintEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TimeConstraintItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(FirstEventRefreshEditPolicy.VIEW_REFRESH_ROLE, new FirstEventRefreshEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case TimeConstraintSpecificationEditPart.VISUAL_ID:
+ case TimeConstraintAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new VerticalMarkFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public VerticalMarkFigure getPrimaryShape() {
+ return (VerticalMarkFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof TimeConstraintAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else if (borderItemEditPart instanceof TimeConstraintSpecificationEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "TimeConstraint";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(TimeConstraintSpecificationEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("TimeConstraint", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("TimeConstraint", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("TimeConstraint", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("TimeConstraint", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java
new file mode 100644
index 00000000000..86db74aebad
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintSpecificationEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 30;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintSpecificationEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public TimeConstraintSpecificationEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.TimeConstraint_15, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintSpecificationEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ TimeConstraintSpecificationEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..3c307a40d68
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java
@@ -0,0 +1,790 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationAppliedStereotypeEditPart
+
+extends AbstractLabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 66;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationAppliedStereotypeEditPart.VISUAL_ID), new Point(0,
+ 0));
+ }
+
+ /**
+ * @generated
+ */
+ public TimeObservationAppliedStereotypeEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.TimeObservation_16, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ TimeObservationAppliedStereotypeEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new AppliedStereotypeWrappingLabelFigure();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java
new file mode 100644
index 00000000000..0ec219104b5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.FirstEventRefreshEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.VerticalMarkFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.locator.LabelInCompartmentLocator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.TimeObservationItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationEditPart extends
+
+AbstractBorderedShapeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 16;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public TimeObservationEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TimeObservationItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(FirstEventRefreshEditPolicy.VIEW_REFRESH_ROLE, new FirstEventRefreshEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable
+ // editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ 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();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case TimeObservationNameEditPart.VISUAL_ID:
+ case TimeObservationAppliedStereotypeEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ };
+ }
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(final Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(final CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return this.primaryShape = new VerticalMarkFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public VerticalMarkFigure getPrimaryShape() {
+ return (VerticalMarkFigure) this.primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof TimeObservationAppliedStereotypeEditPart) {
+ final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else if (borderItemEditPart instanceof TimeObservationNameEditPart) {
+ final IBorderItemLocator locator = new LabelInCompartmentLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ final String prefElementId = "TimeObservation";
+ final IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ final String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.WIDTH);
+ final String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId,
+ PreferenceConstantHelper.HEIGHT);
+ final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
+
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so you may safely remove <i>generated</i> tag
+ * and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ final NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ final IFigure shape = createNodeShape();
+ figure.add(shape);
+ this.contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects layout one may have set for generated
+ * figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(final IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (this.contentPane != null) {
+ return this.contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(final Color color) {
+ if (this.primaryShape != null) {
+ this.primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(final int width) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(final int style) {
+ if (this.primaryShape instanceof Shape) {
+ ((Shape) this.primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(TimeObservationNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSource() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnSourceAndTarget(final IGraphicalEditPart targetEditPart) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ types.add(UMLElementTypes.Message_53);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForTarget(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_53) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMARelTypesOnTarget() {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ public List<IElementType> getMATypesForSource(final IElementType relationshipType) {
+ final LinkedList<IElementType> types = new LinkedList<IElementType>();
+ if (relationshipType == UMLElementTypes.Message_50) {
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.Gate_69);
+ }
+ return types;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getPreferredValue(final EStructuralFeature feature) {
+ final IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
+ Object result = null;
+
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
+ || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ String prefColor = null;
+ if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("TimeObservation", PreferenceConstantHelper.COLOR_LINE);
+ } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("TimeObservation", PreferenceConstantHelper.COLOR_FONT);
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
+ prefColor = PreferenceConstantHelper.getElementConstant("TimeObservation", PreferenceConstantHelper.COLOR_FILL);
+ }
+ result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(preferenceStore, prefColor));
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ final String prefGradient = PreferenceConstantHelper.getElementConstant("TimeObservation", PreferenceConstantHelper.COLOR_GRADIENT);
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
+ if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
+ result = new Integer(gradientPreferenceConverter.getTransparency());
+ } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
+ result = gradientPreferenceConverter.getGradientData();
+ }
+ }
+
+ if (result == null) {
+ result = getStructuralFeatureValue(feature);
+ }
+ return result;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java
new file mode 100644
index 00000000000..0334dadc83c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationNameEditPart
+
+extends LabelEditPart
+
+implements ITextAwareEditPart, IBorderItemEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 34;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationNameEditPart.VISUAL_ID),
+ new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public TimeObservationNameEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public IBorderItemLocator getBorderItemLocator() {
+ final IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ final Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshBounds() {
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(final IFigure figure, final String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(final IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(final IFigure figure, final Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(final IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ this.defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(final String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ final EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = this.defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(final String text) {
+ setLabelTextHelper(getFigure(), text);
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ final IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (final InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (this.parser == null) {
+ this.parser = UMLParserProvider.getParser(UMLElementTypes.TimeObservation_16, getParserElement(),
+ UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationNameEditPart.VISUAL_ID));
+ }
+ return this.parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (this.manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return this.manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(final DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(final Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(final char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performDirectEditRequest(final Request request) {
+
+ final Request theRequest = request;
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == this.directEditionMode) {
+ this.directEditionMode = getDirectEditionType();
+ }
+ switch (this.directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (this.configuration == null || this.configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ this.configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (this.configuration instanceof IPopupEditorConfiguration) {
+ final IPopupEditorHelper helper = ((IPopupEditorConfiguration) this.configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if (this.configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) this.configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ resolveSemanticElement(), this.configuration.getTextToEdit(resolveSemanticElement()));
+ } else if (this.configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(),
+ this.configuration.getTextToEdit(resolveSemanticElement()), this.configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ final RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ TimeObservationNameEditPart.this.configuration.postEditAction(resolveSemanticElement(),
+ ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ final EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshFont() {
+ final FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ final FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setFontColor(final Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ final EObject element = resolveSemanticElement();
+ this.parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) this.parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (this.parserElements != null) {
+ for (int i = 0; i < this.parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (this.accessibleEP == null) {
+ this.accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(final AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return this.accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see
+ * org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (this.configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass()
+ .getInstanceClassName());
+ }
+ }
+ }
+
+ /**
+ * Updates the preference configuration
+ *
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore()
+ .getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != this.configuration.getLanguage()) {
+ this.configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ this.configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ final Character initialChar = (Character) theRequest.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ final DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification event) {
+ final Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ final Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ final ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ this.defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.java
new file mode 100644
index 00000000000..ee2132f9a62
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.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.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.TimeRulerCompartmentItemSemanticEditPolicyCN;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeRulerCompartmentEditPartCN
+
+extends ListCompartmentEditPart
+
+{
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 29;
+
+ /**
+ * @generated
+ */
+ public TimeRulerCompartmentEditPartCN(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean hasModelChildrenChanged(final Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getCompartmentName() {
+ return Messages.TimeRulerCompartmentEditPartCN_title;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure createFigure() {
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TimeRulerCompartmentItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setRatio(final Double ratio) {
+ if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(final Notification notification) {
+ final Object feature = notification.getFeature();
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshBounds() {
+ final int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ final int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ final Dimension size = new Dimension(width, height);
+ final int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ final int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ final Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java
new file mode 100644
index 00000000000..599c0da8923
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.CustomTimingDiagramCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.TimingDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.TimingDiagramEditPartFactoryItemSemanticEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimingDiagramEditPart extends PapyrusDiagramEditPart {
+
+ /**
+ * @generated
+ */
+ public final static String MODEL_ID = "PapyrusUMLTimingDiagram"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1;
+
+ /**
+ * @generated
+ */
+ public TimingDiagramEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TimingDiagramEditPartFactoryItemSemanticEditPolicy());
+
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TimingDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomTimingDiagramCreationEditPolicy());
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ /* package-local */static class NodeLabelDragPolicy extends NonResizableEditPolicy {
+
+ /**
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected List createSelectionHandles() {
+ final MoveHandle h = new MoveHandle((GraphicalEditPart) getHost());
+ h.setBorder(null);
+ return Collections.singletonList(h);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Command getCommand(final Request request) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean understandsRequest(final Request request) {
+ return false;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ /* package-local */static class LinkLabelDragPolicy extends NonResizableLabelEditPolicy {
+
+ /**
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected List createSelectionHandles() {
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java
new file mode 100644
index 00000000000..4dc65b51cb4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.parts;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.directedit.locator.LabelCellEditorLocator;
+import org.eclipse.gmf.tooling.runtime.directedit.locator.TextCellEditorLocator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.LifelineVerticalLabelCellEditorLocator;
+import org.eclipse.papyrus.uml.diagram.timing.custom.figures.LifelineVerticalLabel;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLEditPartFactory implements EditPartFactory {
+
+ /**
+ * @generated
+ */
+ public EditPart createEditPart(final EditPart context, final Object model) {
+ if (model instanceof View) {
+ final View view = (View) model;
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ case TimingDiagramEditPart.VISUAL_ID:
+ return new TimingDiagramEditPart(view);
+
+ case InteractionEditPartTN.VISUAL_ID:
+ return new InteractionEditPartTN(view);
+
+ case InteractionNameEditPart.VISUAL_ID:
+ return new InteractionNameEditPart(view);
+
+ case FullLifelineEditPartCN.VISUAL_ID:
+ return new FullLifelineEditPartCN(view);
+
+ case FullLifelineNameEditPart.VISUAL_ID:
+ return new FullLifelineNameEditPart(view);
+
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return new CompactLifelineEditPartCN(view);
+
+ case CompactLifelineNameEditPart.VISUAL_ID:
+ return new CompactLifelineNameEditPart(view);
+
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ return new FullStateInvariantEditPartCN(view);
+
+ case FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID:
+ return new FullStateInvariantAppliedStereotypeEditPart(view);
+
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ return new CompactStateInvariantEditPartCN(view);
+
+ case CompactStateInvariantNameEditPart.VISUAL_ID:
+ return new CompactStateInvariantNameEditPart(view);
+
+ case StateInvariantAppliedStereotypeEditPart.VISUAL_ID:
+ return new StateInvariantAppliedStereotypeEditPart(view);
+
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return new OccurrenceSpecificationEditPartCN(view);
+
+ case OccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ return new OccurrenceSpecificationLabelEditPart(view);
+
+ case OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return new OccurrenceSpecificationAppliedStereotypeEditPart(view);
+
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return new MessageOccurrenceSpecificationEditPartCN(view);
+
+ case MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ return new MessageOccurrenceSpecificationLabelEditPart(view);
+
+ case MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageOccurrenceSpecificationAppliedStereotypeEditPart(view);
+
+ case StateDefinitionEditPart.VISUAL_ID:
+ return new StateDefinitionEditPart(view);
+
+ case StateDefinitionLabelEditPart.VISUAL_ID:
+ return new StateDefinitionLabelEditPart(view);
+
+ case FullStateInvariantVerticalLineEditPart.VISUAL_ID:
+ return new FullStateInvariantVerticalLineEditPart(view);
+
+ case TimeConstraintEditPart.VISUAL_ID:
+ return new TimeConstraintEditPart(view);
+
+ case TimeConstraintSpecificationEditPart.VISUAL_ID:
+ return new TimeConstraintSpecificationEditPart(view);
+
+ case TimeConstraintAppliedStereotypeEditPart.VISUAL_ID:
+ return new TimeConstraintAppliedStereotypeEditPart(view);
+
+ case TimeObservationEditPart.VISUAL_ID:
+ return new TimeObservationEditPart(view);
+
+ case TimeObservationNameEditPart.VISUAL_ID:
+ return new TimeObservationNameEditPart(view);
+
+ case TimeObservationAppliedStereotypeEditPart.VISUAL_ID:
+ return new TimeObservationAppliedStereotypeEditPart(view);
+
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ return new DurationConstraintEditPartCN(view);
+
+ case DurationConstraintSpecificationEditPart.VISUAL_ID:
+ return new DurationConstraintSpecificationEditPart(view);
+
+ case DurationObservationEditPartCN.VISUAL_ID:
+ return new DurationObservationEditPartCN(view);
+
+ case DurationObservationNameEditPart.VISUAL_ID:
+ return new DurationObservationNameEditPart(view);
+
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return new GeneralOrderingEditPart(view);
+
+ case GeneralOrderingNameEditPart.VISUAL_ID:
+ return new GeneralOrderingNameEditPart(view);
+
+ case FreeTimingRulerEditPartCN.VISUAL_ID:
+ return new FreeTimingRulerEditPartCN(view);
+
+ case LinearTimingRulerEditPartCN.VISUAL_ID:
+ return new LinearTimingRulerEditPartCN(view);
+
+ case TickEditPart.VISUAL_ID:
+ return new TickEditPart(view);
+
+ case TickNameEditPart.VISUAL_ID:
+ return new TickNameEditPart(view);
+
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return new DestructionOccurrenceSpecificationEditPartCN(view);
+
+ case DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ return new DestructionOccurrenceSpecificationLabelEditPart(view);
+
+ case DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return new DestructionOccurrenceSpecificationAppliedStereotypeEditPart(view);
+
+ case LifelineEditPart.VISUAL_ID:
+ return new LifelineEditPart(view);
+
+ case GateEditPart.VISUAL_ID:
+ return new GateEditPart(view);
+
+ case GateLabelEditPart.VISUAL_ID:
+ return new GateLabelEditPart(view);
+
+ case InteractionCompartmentEditPartTN.VISUAL_ID:
+ return new InteractionCompartmentEditPartTN(view);
+
+ case FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID:
+ return new FullLifelineStateDefinitionCompartmentEditPartCN(view);
+
+ case FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID:
+ return new FullLifelineTimelineCompartmentEditPartCN(view);
+
+ case CompactLifelineCompartmentEditPartCN.VISUAL_ID:
+ return new CompactLifelineCompartmentEditPartCN(view);
+
+ case TimeRulerCompartmentEditPartCN.VISUAL_ID:
+ return new TimeRulerCompartmentEditPartCN(view);
+
+ case FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ return new FullLifelineTimeRulerCompartmentEditPartCN(view);
+
+ case CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ return new CompactLifelineTimeRulerCompartmentEditPartCN(view);
+
+ case FreeTimeRulerCompartmentEditPart.VISUAL_ID:
+ return new FreeTimeRulerCompartmentEditPart(view);
+
+ case LinearTimeRulerCompartmentEditPart.VISUAL_ID:
+ return new LinearTimeRulerCompartmentEditPart(view);
+
+ case MessageSyncEditPart.VISUAL_ID:
+ return new MessageSyncEditPart(view);
+
+ case MessageSyncNameLabelEditPart.VISUAL_ID:
+ return new MessageSyncNameLabelEditPart(view);
+
+ case MessageSyncAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageSyncAppliedStereotypeEditPart(view);
+
+ case MessageAsyncEditPart.VISUAL_ID:
+ return new MessageAsyncEditPart(view);
+
+ case MessageAsyncNameLabelEditPart.VISUAL_ID:
+ return new MessageAsyncNameLabelEditPart(view);
+
+ case MessageAsyncAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageAsyncAppliedStereotypeEditPart(view);
+
+ case MessageReplyEditPart.VISUAL_ID:
+ return new MessageReplyEditPart(view);
+
+ case MessageReplyNameLabelEditPart.VISUAL_ID:
+ return new MessageReplyNameLabelEditPart(view);
+
+ case MessageReplyAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageReplyAppliedStereotypeEditPart(view);
+
+ case MessageCreateEditPart.VISUAL_ID:
+ return new MessageCreateEditPart(view);
+
+ case MessageCreateNameLabelEditPart.VISUAL_ID:
+ return new MessageCreateNameLabelEditPart(view);
+
+ case MessageCreateAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageCreateAppliedStereotypeEditPart(view);
+
+ case MessageDeleteEditPart.VISUAL_ID:
+ return new MessageDeleteEditPart(view);
+
+ case MessageDeleteNameLabelEditPart.VISUAL_ID:
+ return new MessageDeleteNameLabelEditPart(view);
+
+ case MessageDeleteAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageDeleteAppliedStereotypeEditPart(view);
+
+ case MessageLostEditPart.VISUAL_ID:
+ return new MessageLostEditPart(view);
+
+ case MessageLostNameLabelEditPart.VISUAL_ID:
+ return new MessageLostNameLabelEditPart(view);
+
+ case MessageLostAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageLostAppliedStereotypeEditPart(view);
+
+ case MessageFoundEditPart.VISUAL_ID:
+ return new MessageFoundEditPart(view);
+
+ case MessageFoundNameLabelEditPart.VISUAL_ID:
+ return new MessageFoundNameLabelEditPart(view);
+
+ case MessageFoundAppliedStereotypeEditPart.VISUAL_ID:
+ return new MessageFoundAppliedStereotypeEditPart(view);
+
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart createUnrecognizedEditPart(final EditPart context, final Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+
+ /**
+ * @generated NOT
+ */
+ public static CellEditorLocator getTextCellEditorLocator(final ITextAwareEditPart source) {
+ if (source.getFigure() instanceof IMultilineEditableFigure) {
+ return new MultilineCellEditorLocator((IMultilineEditableFigure) source.getFigure());
+ } else if (source.getFigure() instanceof WrappingLabel) {
+ return new TextCellEditorLocator((WrappingLabel) source.getFigure());
+ } else if (source.getFigure() instanceof LifelineVerticalLabel) {
+ return new LifelineVerticalLabelCellEditorLocator((LifelineVerticalLabel) source.getFigure());
+ } else {
+ return new LabelCellEditorLocator((Label) source.getFigure());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static private class MultilineCellEditorLocator implements CellEditorLocator {
+
+ /**
+ * @generated
+ */
+ private final IMultilineEditableFigure multilineEditableFigure;
+
+ /**
+ * @generated
+ */
+ public MultilineCellEditorLocator(final IMultilineEditableFigure figure) {
+ this.multilineEditableFigure = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public IMultilineEditableFigure getMultilineEditableFigure() {
+ return this.multilineEditableFigure;
+ }
+
+ /**
+ * @generated
+ */
+ public void relocate(final CellEditor celleditor) {
+ final Text text = (Text) celleditor.getControl();
+ final Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
+ rect.x = getMultilineEditableFigure().getEditionLocation().x;
+ rect.y = getMultilineEditableFigure().getEditionLocation().y;
+ getMultilineEditableFigure().translateToAbsolute(rect);
+ if (getMultilineEditableFigure().getText().length() > 0) {
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ }
+ 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/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..ccc02883ae4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.CompactStateInvariantCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DestructionOccurrenceSpecificationCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationConstraintCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationObservationCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.GeneralOrderingCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageOccurrenceSpecificationCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.OccurrenceSpecificationCreateCommandCN;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public CompactLifelineCompartmentItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_20);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.StateInvariant_28 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new CompactStateInvariantCreateCommandCN(req));
+ }
+ if (UMLElementTypes.OccurrenceSpecification_12 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.MessageOccurrenceSpecification_13 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.DestructionOccurrenceSpecification_27 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.DurationConstraint_18 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ }
+ if (UMLElementTypes.DurationObservation_17 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new DurationObservationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.TimeConstraint_15 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ }
+ if (UMLElementTypes.TimeObservation_16 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new TimeObservationCreateCommand(req));
+ }
+ if (UMLElementTypes.GeneralOrdering_67 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new GeneralOrderingCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..a25f062cecf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public CompactLifelineItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_20);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..7f71534d9d6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_20);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..258d8a28ba2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public CompactStateInvariantItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.StateInvariant_28);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..b546a75cdbd
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageAsyncCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageAsyncReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageCreateCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageCreateReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageDeleteCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageDeleteReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageReplyCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageReplyReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageSyncCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageSyncReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_3 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageSyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_4 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageAsyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_41 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageReplyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_44 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageCreateCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_47 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageDeleteCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_3 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageSyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_4 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageAsyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_41 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageReplyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_44 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageCreateCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_47 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageDeleteCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageSyncEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageSyncReorientCommand(req));
+ case MessageAsyncEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageAsyncReorientCommand(req));
+ case MessageReplyEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageReplyReorientCommand(req));
+ case MessageCreateEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageCreateReorientCommand(req));
+ case MessageDeleteEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageDeleteReorientCommand(req));
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..826605a0792
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public DurationConstraintItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.DurationConstraint_18);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..f0562dca714
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public DurationObservationItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.DurationObservation_17);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..dbc1ec2b98d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public FullLifelineItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_19);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..18b36e7aa9a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_19);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..63659b53b0a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_19);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..300890fbfb6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DestructionOccurrenceSpecificationCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationConstraintCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationObservationCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.FullStateInvariantCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.GeneralOrderingCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageOccurrenceSpecificationCreateCommandCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.OccurrenceSpecificationCreateCommandCN;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelineTimelineCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public FullLifelineTimelineCompartmentItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Lifeline_19);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.StateInvariant_11 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new FullStateInvariantCreateCommandCN(req));
+ }
+ if (UMLElementTypes.OccurrenceSpecification_12 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.MessageOccurrenceSpecification_13 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.DestructionOccurrenceSpecification_27 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.DurationConstraint_18 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ }
+ if (UMLElementTypes.DurationObservation_17 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new DurationObservationCreateCommandCN(req));
+ }
+ if (UMLElementTypes.TimeConstraint_15 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ }
+ if (UMLElementTypes.TimeObservation_16 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new TimeObservationCreateCommand(req));
+ }
+ if (UMLElementTypes.GeneralOrdering_67 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new GeneralOrderingCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..dbd676d1920
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.StateInvariant_11);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ba44d608190
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageAsyncCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageAsyncReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageCreateCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageCreateReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageDeleteCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageDeleteReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageReplyCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageReplyReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageSyncCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageSyncReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public GateItemSemanticEditPolicy() {
+ super(UMLElementTypes.Gate_69);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_3 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageSyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_4 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageAsyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_41 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageReplyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_44 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageCreateCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_47 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageDeleteCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_3 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageSyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_4 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageAsyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_41 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageReplyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_44 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageCreateCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_47 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageDeleteCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageSyncEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageSyncReorientCommand(req));
+ case MessageAsyncEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageAsyncReorientCommand(req));
+ case MessageReplyEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageReplyReorientCommand(req));
+ case MessageCreateEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageCreateReorientCommand(req));
+ case MessageDeleteEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageDeleteReorientCommand(req));
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..72a79a6d734
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingItemSemanticEditPolicy() {
+ super(UMLElementTypes.GeneralOrdering_67);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java
new file mode 100644
index 00000000000..e50a6dd3b90
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionCompartmentItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public InteractionCompartmentItemSemanticEditPolicyTN() {
+ super(UMLElementTypes.Interaction_2);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Lifeline_19 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new FullLifelineCreateCommandCN(req));
+ }
+ if (UMLElementTypes.Lifeline_20 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new CompactLifelineCreateCommandCN(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java
new file mode 100644
index 00000000000..bdad32666c9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.GateCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public InteractionNodeItemSemanticEditPolicyTN() {
+ super(UMLElementTypes.Interaction_2);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Gate_69 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new GateCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..722fcbc8238
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public LifelineItemSemanticEditPolicy() {
+ super(UMLElementTypes.Lifeline_40);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..40b6d5f07d6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageAsyncItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_4);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..6423e9432c3
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageCreateItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_44);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..a2d49bac40e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageDeleteItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_47);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..c07e917b342
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageFoundItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_53);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..51ae5a91af1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageLostItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_50);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..b928582f332
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageAsyncCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageAsyncReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageCreateCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageCreateReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageDeleteCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageDeleteReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageReplyCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageReplyReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageSyncCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageSyncReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.MessageOccurrenceSpecification_13);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_3 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageSyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_4 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageAsyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_41 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageReplyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_44 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageCreateCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_47 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageDeleteCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_3 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageSyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_4 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageAsyncCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_41 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageReplyCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_44 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageCreateCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_47 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageDeleteCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageSyncEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageSyncReorientCommand(req));
+ case MessageAsyncEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageAsyncReorientCommand(req));
+ case MessageReplyEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageReplyReorientCommand(req));
+ case MessageCreateEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageCreateReorientCommand(req));
+ case MessageDeleteEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageDeleteReorientCommand(req));
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..60b0e95b90b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageReplyItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_41);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..b510e04d31a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public MessageSyncItemSemanticEditPolicy() {
+ super(UMLElementTypes.Message_3);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..a1aef4b9b62
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.OccurrenceSpecification_12);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..69ddf97aba6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public TimeConstraintItemSemanticEditPolicy() {
+ super(UMLElementTypes.TimeConstraint_15);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..7653ff1860e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageFoundReorientCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostCreateCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageLostReorientCommand;
+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.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public TimeObservationItemSemanticEditPolicy() {
+ super(UMLElementTypes.TimeObservation_16);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ final EObject selectedEObject = req.getElementToDestroy();
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ if (provider != null) {
+ // Retrieve delete command from the Element Edit service
+ final ICommand deleteCommand = provider.getEditCommand(req);
+
+ if (deleteCommand != null) {
+ return new ICommandProxy(deleteCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ return null;
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageFoundCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return null;
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Message_50 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new MessageLostCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (UMLElementTypes.Message_53 == baseElementType) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source should be the domain model element
+ * associated with this node.
+ *
+ * @generated
+ */
+ @Override
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case MessageLostEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageLostReorientCommand(req));
+ case MessageFoundEditPart.VISUAL_ID:
+ return getGEFWrapper(new MessageFoundReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..b4d5e9c47b7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.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.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeRulerCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public TimeRulerCompartmentItemSemanticEditPolicyCN() {
+ super(UMLElementTypes.Interaction_2);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ return super.getCreateCommand(req);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..fe26695c515
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
+import org.eclipse.papyrus.uml.diagram.timing.edit.commands.InteractionCreateCommandTN;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimingDiagramEditPartFactoryItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public TimingDiagramEditPartFactoryItemSemanticEditPolicy() {
+ super(UMLElementTypes.Package_1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ final IElementType requestElementType = req.getElementType();
+ if (requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+ IElementType baseElementType = requestElementType;
+ boolean isExtendedType = false;
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
+ if (baseElementType != null) {
+ isExtendedType = true;
+ } else {
+ // no reference element type ID. using the closest super element type to give more opportunities, but
+ // can lead to bugs.
+ baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
+ isExtendedType = true;
+ }
+ }
+ if (UMLElementTypes.Interaction_2 == baseElementType) {
+ if (isExtendedType) {
+ return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
+ }
+ return getGEFWrapper(new InteractionCreateCommandTN(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getDuplicateCommand(final DuplicateElementsRequest req) {
+ final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ Diagram currentDiagram = null;
+ if (getHost() instanceof IGraphicalEditPart) {
+ currentDiagram = ((IGraphicalEditPart) getHost()).getNotationView().getDiagram();
+ }
+ return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req, currentDiagram));
+ }
+
+ /**
+ * @generated
+ */
+ private static class DuplicateAnythingCommand extends DuplicateNamedElementCommand {
+ /**
+ * @generated
+ */
+ private final Diagram diagram;
+
+ /**
+ * @generated
+ */
+ public DuplicateAnythingCommand(final TransactionalEditingDomain editingDomain, final DuplicateElementsRequest req, final Diagram currentDiagram) {
+ super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap(), currentDiagram);
+ this.diagram = currentDiagram;
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ec1a76a1564
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -0,0 +1,489 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+ /**
+ * Extended request data key to hold editpart visual id.
+ *
+ * @generated
+ */
+ public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+ /**
+ * Extended request data key to hold the edge view during a reconnect request.
+ *
+ * @generated
+ */
+ public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final IElementType myElementType;
+
+ /**
+ * @generated
+ */
+ protected UMLBaseItemSemanticEditPolicy(final IElementType elementType) {
+ this.myElementType = elementType;
+ }
+
+ /**
+ * Extended request data key to hold editpart visual id. Add visual id of edited editpart to extended data of the
+ * request so command switch can decide what kind of diagram element is being edited. It is done in those cases when
+ * it's not possible to deduce diagram element kind from domain element. Add the reoriented view to the request
+ * extended data so that the view currently edited can be distinguished from other views of the same element and
+ * these latter possibly removed if they become inconsistent after reconnect
+ *
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Command getCommand(final Request request) {
+ if (request instanceof ReconnectRequest) {
+ final Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel();
+ if (view instanceof View) {
+ final Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View) view));
+ request.getExtendedData().put(VISUAL_ID_KEY, id);
+ request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * Returns visual id from request parameters.
+ *
+ * @generated
+ */
+ protected int getVisualID(final IEditCommandRequest request) {
+ final Object id = request.getParameter(VISUAL_ID_KEY);
+ return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Command getSemanticCommand(final IEditCommandRequest request) {
+ final IEditCommandRequest completedRequest = completeRequest(request);
+ Command semanticCommand = getSemanticCommandSwitch(completedRequest);
+ semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
+ if (completedRequest instanceof DestroyRequest) {
+ final DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
+ return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
+ }
+ return semanticCommand;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command addDeleteViewCommand(final Command mainCommand, final DestroyRequest completedRequest) {
+ final Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
+ return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
+ }
+
+ /**
+ * @generated
+ */
+ private Command getEditHelperCommand(final IEditCommandRequest request, final Command editPolicyCommand) {
+ if (editPolicyCommand != null) {
+ final ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(
+ editPolicyCommand);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
+ }
+ final IElementType requestContextElementType = getContextElementType(request);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
+ ICommand command = requestContextElementType.getEditCommand(request);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
+ }
+ return new ICommandProxy(command);
+ }
+ return editPolicyCommand;
+ }
+
+ /**
+ * @generated
+ */
+ protected IElementType getContextElementType(final IEditCommandRequest request) {
+ final IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : this.myElementType;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommandSwitch(final IEditCommandRequest req) {
+ if (req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest) req);
+ } else if (req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest) req);
+ } else if (req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest) req);
+ } else if (req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest) req);
+ } else if (req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest) req);
+ } else if (req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest) req);
+ } else if (req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest) req);
+ } else if (req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest) req);
+ } else if (req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
+ } else if (req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
+ } else if (req instanceof SetRequest) {
+ return getSetCommand((SetRequest) req);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getConfigureCommand(final ConfigureRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(final CreateElementRequest req) {
+ // no more usage of the extended types here.
+ return null;
+ }
+
+ // RS: add code for extended types
+ /**
+ * @generated
+ */
+ protected Command getExtendedTypeCreationCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
+ if (provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve create command from the Element Edit service
+ final ICommand createGMFCommand = provider.getEditCommand(request);
+ return getGEFWrapper(createGMFCommand);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getExtendedStartCreateRelationshipCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ if (provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve create command from the Element Edit service
+ final ICommand createGMFCommand = provider.getEditCommand(request);
+ return getGEFWrapper(createGMFCommand);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getExtendedCompleteCreateRelationshipCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ if (provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve create command from the Element Edit service
+ final ICommand createGMFCommand = provider.getEditCommand(request);
+ return getGEFWrapper(createGMFCommand);
+ }
+
+ // RS: End of add code for extended types
+ /**
+ * @generated
+ */
+ protected Command getSetCommand(final SetRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getEditContextCommand(final GetEditContextRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(final DestroyReferenceRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(final DuplicateElementsRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getMoveCommand(final MoveRequest req) {
+
+ final EObject targetCEObject = req.getTargetContainer();
+ if (targetCEObject != null) {
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
+ if (provider != null) {
+ final ICommand moveCommand = provider.getEditCommand(req);
+ if (moveCommand != null) {
+ return new ICommandProxy(moveCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ } else {
+ return getGEFWrapper(new MoveElementsCommand(req));
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(final ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected final Command getGEFWrapper(final ICommand cmd) {
+ return new ICommandProxy(cmd);
+ }
+
+ /**
+ * Returns editing domain from the host edit part.
+ *
+ * @generated
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ /**
+ * Clean all shortcuts to the host element from the same diagram
+ *
+ * @generated
+ */
+ protected void addDestroyShortcutsCommand(final ICompositeCommand cmd, final View view) {
+ assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
+ for (final Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ final View nextView = (View) it.next();
+ if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ continue;
+ }
+ cmd.add(new DeleteCommand(getEditingDomain(), nextView));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static LinkConstraints getLinkConstraints() {
+ LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
+ if (cached == null) {
+ UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
+ }
+ return cached;
+ }
+
+ /**
+ * @generated
+ */
+ public static class LinkConstraints {
+
+ /**
+ * @generated
+ */
+ public LinkConstraints() {
+ // use static method #getLinkConstraints() to access instance
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_3(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ return canExistMessage_3(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_4(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ return canExistMessage_4(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_41(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ return canExistMessage_41(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_44(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ return canExistMessage_44(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_47(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ return canExistMessage_47(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_50(final Interaction container, final MessageEnd source, final Element target) {
+ return canExistMessage_50(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateMessage_53(final Interaction container, final Element source, final MessageEnd target) {
+ return canExistMessage_53(container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_3(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_4(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_41(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_44(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_47(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_50(final Interaction container, final Message linkInstance, final MessageEnd source, final Element target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistMessage_53(final Interaction container, final Message linkInstance, final Element source, final MessageEnd target) {
+ return true;
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java
new file mode 100644
index 00000000000..9d34c21facc
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx implements IRefreshableFeedbackEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private FigureListener hostPositionListener;
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(this.selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (this.selectionFeedbackFigure != null) {
+ removeFeedback(this.selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ this.selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(this.focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (this.focusFeedbackFigure != null) {
+ removeFeedback(this.focusFeedbackFigure);
+ this.focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ final Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ final RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ @Override
+ protected void paintFigure(final Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(final Label target) {
+ final Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (this.selectionFeedbackFigure != null) {
+ if (this.selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) this.selectionFeedbackFigure);
+ this.selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ this.selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (this.focusFeedbackFigure != null) {
+ this.focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ private FigureListener getHostPositionListener() {
+ if (this.hostPositionListener == null) {
+ this.hostPositionListener = new FigureListener() {
+ public void figureMoved(final IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return this.hostPositionListener;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List createSelectionHandles() {
+ final MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java
new file mode 100644
index 00000000000..a170cfc9cf1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.edit.policies;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements IRefreshableFeedbackEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private FigureListener hostPositionListener;
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(this.selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (this.selectionFeedbackFigure != null) {
+ removeFeedback(this.selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ this.selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(this.focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (this.focusFeedbackFigure != null) {
+ removeFeedback(this.focusFeedbackFigure);
+ this.focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ final Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ final RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ @Override
+ protected void paintFigure(final Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(final Label target) {
+ final Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (this.selectionFeedbackFigure != null) {
+ if (this.selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) this.selectionFeedbackFigure);
+ this.selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ this.selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (this.focusFeedbackFigure != null) {
+ this.focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ private FigureListener getHostPositionListener() {
+ if (this.hostPositionListener == null) {
+ this.hostPositionListener = new FigureListener() {
+ public void figureMoved(final IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return this.hostPositionListener;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java
new file mode 100644
index 00000000000..9e57ffd74b5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.expressions;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public abstract class UMLAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private IStatus status = Status.OK_STATUS;
+
+ /**
+ * @generated
+ */
+ protected void setStatus(final int severity, final String message, final Throwable throwable) {
+ final String pluginID = UMLDiagramEditorPlugin.ID;
+ this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
+ if (!this.status.isOK()) {
+ UMLDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body(), throwable); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public IStatus getStatus() {
+ return this.status;
+ }
+
+ /**
+ * @generated
+ */
+ private final String myBody;
+
+ /**
+ * @generated
+ */
+ public String body() {
+ return this.myBody;
+ }
+
+ /**
+ * @generated
+ */
+ private final EClassifier myContext;
+
+ /**
+ * @generated
+ */
+ public EClassifier context() {
+ return this.myContext;
+ }
+
+ /**
+ * @generated
+ */
+ protected UMLAbstractExpression(final String body, final EClassifier context) {
+ this.myBody = body;
+ this.myContext = context;
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ protected abstract Object doEvaluate(Object context, Map env);
+
+ /**
+ * @generated
+ */
+ public Object evaluate(final Object context) {
+ return evaluate(context, Collections.EMPTY_MAP);
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ public Object evaluate(final Object context, final Map env) {
+ if (context().isInstance(context)) {
+ try {
+ return doEvaluate(context, env);
+ } catch (final Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body(), e); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer
+ * is expected), or EEnumLiteral meta-object when literal instance is expected
+ *
+ * @generated
+ */
+ public static Object performCast(final Object value, final EDataType targetType) {
+ if (targetType instanceof EEnum) {
+ if (value instanceof EEnumLiteral) {
+ final EEnumLiteral literal = (EEnumLiteral) value;
+ return (literal.getInstance() != null) ? literal.getInstance() : literal;
+ }
+ }
+ if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
+ return value;
+ }
+ final Class<?> targetClass = targetType.getInstanceClass();
+ final Number num = (Number) value;
+ final Class<?> valClass = value.getClass();
+ Class<?> targetWrapperClass = targetClass;
+ if (targetClass.isPrimitive()) {
+ targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);
+ }
+ if (valClass.equals(targetWrapperClass)) {
+ return value;
+ }
+ if (Number.class.isAssignableFrom(targetWrapperClass)) {
+ if (targetWrapperClass.equals(Byte.class)) {
+ return new Byte(num.byteValue());
+ }
+ if (targetWrapperClass.equals(Integer.class)) {
+ return new Integer(num.intValue());
+ }
+ if (targetWrapperClass.equals(Short.class)) {
+ return new Short(num.shortValue());
+ }
+ if (targetWrapperClass.equals(Long.class)) {
+ return new Long(num.longValue());
+ }
+ if (targetWrapperClass.equals(BigInteger.class)) {
+ return BigInteger.valueOf(num.longValue());
+ }
+ if (targetWrapperClass.equals(Float.class)) {
+ return new Float(num.floatValue());
+ }
+ if (targetWrapperClass.equals(Double.class)) {
+ return new Double(num.doubleValue());
+ }
+ if (targetWrapperClass.equals(BigDecimal.class)) {
+ return new BigDecimal(num.doubleValue());
+ }
+ }
+ return value;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java
new file mode 100644
index 00000000000..4aed98ceb01
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.expressions;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.ocl.Environment;
+import org.eclipse.ocl.EvaluationEnvironment;
+import org.eclipse.ocl.ParserException;
+import org.eclipse.ocl.ecore.EcoreFactory;
+import org.eclipse.ocl.ecore.OCL.Helper;
+import org.eclipse.ocl.ecore.OCLExpression;
+import org.eclipse.ocl.ecore.Variable;
+import org.eclipse.ocl.options.ParsingOptions;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLOCLFactory {
+
+ /**
+ * @generated
+ */
+ private final UMLAbstractExpression[] expressions;
+
+ /**
+ * @generated
+ */
+ private final String[] expressionBodies;
+
+ /**
+ * @generated
+ */
+ protected UMLOCLFactory() {
+ this.expressions = new UMLAbstractExpression[7];
+ this.expressionBodies = new String[] {
+ "self.messageSort=MessageSort::synchCall and self.messageKind<>MessageKind::lost and self.messageKind<>MessageKind::found", //$NON-NLS-1$
+ "self.messageSort=MessageSort::asynchCall or self.messageSort=MessageSort::asynchSignal", //$NON-NLS-1$
+ "self.messageSort=MessageSort::reply", //$NON-NLS-1$
+ "self.messageSort=MessageSort::createMessage", //$NON-NLS-1$
+ "self.messageSort=MessageSort::deleteMessage", //$NON-NLS-1$
+ "self.messageKind=MessageKind::lost", //$NON-NLS-1$
+ "self.messageKind=MessageKind::found", //$NON-NLS-1$
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private static UMLOCLFactory getInstance() {
+ UMLOCLFactory instance = UMLDiagramEditorPlugin.getInstance().getUMLOCLFactory();
+ if (instance == null) {
+ UMLDiagramEditorPlugin.getInstance().setUMLOCLFactory(instance = new UMLOCLFactory());
+ }
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ public static String getExpressionBody(final int index) {
+ return getInstance().expressionBodies[index];
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(final int index, final EClassifier context, final Map<String, EClassifier> environment) {
+ final UMLOCLFactory cached = getInstance();
+ if (index < 0 || index >= cached.expressions.length) {
+ throw new IllegalArgumentException();
+ }
+ if (cached.expressions[index] == null) {
+ cached.expressions[index] = getExpression(cached.expressionBodies[index], context,
+ environment == null ? Collections.<String, EClassifier> emptyMap() : environment);
+ }
+ return cached.expressions[index];
+ }
+
+ /**
+ * This is factory method, callers are responsible to keep reference to the return value if they want to reuse
+ * parsed expression
+ *
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(final String body, final EClassifier context, final Map<String, EClassifier> environment) {
+ return new Expression(body, context, environment);
+ }
+
+ /**
+ * This method will become private in the next release
+ *
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(final String body, final EClassifier context) {
+ return getExpression(body, context, Collections.<String, EClassifier> emptyMap());
+ }
+
+ /**
+ * @generated
+ */
+ private static class Expression extends UMLAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private final org.eclipse.ocl.ecore.OCL oclInstance;
+
+ /**
+ * @generated
+ */
+ private OCLExpression oclExpression;
+
+ /**
+ * @generated
+ */
+ public Expression(final String body, final EClassifier context, final Map<String, EClassifier> environment) {
+ super(body, context);
+ this.oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
+ initCustomEnv(this.oclInstance.getEnvironment(), environment);
+ final Helper oclHelper = this.oclInstance.createOCLHelper();
+ oclHelper.setContext(context());
+ try {
+ this.oclExpression = oclHelper.createQuery(body());
+ setStatus(IStatus.OK, null, null);
+ } catch (final ParserException e) {
+ setStatus(IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected Object doEvaluate(final Object context, final Map env) {
+ if (this.oclExpression == null) {
+ return null;
+ }
+ // on the first call, both evalEnvironment and extentMap are clear, for later we have finally, below.
+ final EvaluationEnvironment<?, ?, ?, ?, ?> evalEnv = this.oclInstance.getEvaluationEnvironment();
+ // initialize environment
+ for (final Object nextKey : env.keySet()) {
+ evalEnv.replace((String) nextKey, env.get(nextKey));
+ }
+ try {
+ final Object result = this.oclInstance.evaluate(context, this.oclExpression);
+ return this.oclInstance.isInvalid(result) ? null : result;
+ } finally {
+ evalEnv.clear();
+ this.oclInstance.setExtentMap(null); // clear allInstances cache, and get the oclInstance ready for the
+ // next call
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void initCustomEnv(final Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?> ecoreEnv,
+ final Map<String, EClassifier> environment) {
+ // Use EObject as implicit root class for any object, to allow eContainer() and other EObject operations
+ // from OCL expressions
+ ParsingOptions.setOption(ecoreEnv, ParsingOptions.implicitRootClass(ecoreEnv), EcorePackage.eINSTANCE.getEObject());
+ for (final String varName : environment.keySet()) {
+ final EClassifier varType = environment.get(varName);
+ ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static Variable createVar(final Environment<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> ecoreEnv, final String name, final EClassifier type) {
+ final Variable var = EcoreFactory.eINSTANCE.createVariable();
+ var.setName(name);
+ var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
+ return var;
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java
new file mode 100644
index 00000000000..fe0e79c3635
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public abstract class UMLAbstractNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class };
+ final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
+ public String getContributorId() {
+ return "org.eclipse.papyrus.uml.diagram.timing"; //$NON-NLS-1$
+ }
+ };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(final Object adaptableObject, final Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem
+ && adapterType == ITabbedPropertySheetPageContributor.class) {
+ return propertySheetPageContributor;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.papyrus.uml.diagram.timing.navigator.UMLAbstractNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private final Object myParent;
+
+ /**
+ * @generated
+ */
+ protected UMLAbstractNavigatorItem(final Object parent) {
+ this.myParent = parent;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return this.myParent;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java
new file mode 100644
index 00000000000..5324da15a8c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDomainNavigatorContentProvider implements ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ public UMLDomainNavigatorContentProvider() {
+ this.myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ this.myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ this.myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+ @Override
+ public Object get(final Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+ });
+ this.myViewerRefreshRunnable = new Runnable() {
+ public void run() {
+ if (UMLDomainNavigatorContentProvider.this.myViewer != null) {
+ UMLDomainNavigatorContentProvider.this.myViewer.refresh();
+ }
+ }
+ };
+ this.myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ for (final Object element : UMLDomainNavigatorContentProvider.this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource nextResource = (Resource) element;
+ nextResource.unload();
+ }
+ if (UMLDomainNavigatorContentProvider.this.myViewer != null) {
+ UMLDomainNavigatorContentProvider.this.myViewer.getControl().getDisplay()
+ .asyncExec(UMLDomainNavigatorContentProvider.this.myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceDeleted(final Resource resource) {
+ for (final Object element : UMLDomainNavigatorContentProvider.this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource nextResource = (Resource) element;
+ nextResource.unload();
+ }
+ if (UMLDomainNavigatorContentProvider.this.myViewer != null) {
+ UMLDomainNavigatorContentProvider.this.myViewer.getControl().getDisplay()
+ .asyncExec(UMLDomainNavigatorContentProvider.this.myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceMoved(final Resource resource, final URI newURI) {
+ for (final Object element : UMLDomainNavigatorContentProvider.this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource nextResource = (Resource) element;
+ nextResource.unload();
+ }
+ if (UMLDomainNavigatorContentProvider.this.myViewer != null) {
+ UMLDomainNavigatorContentProvider.this.myViewer.getControl().getDisplay()
+ .asyncExec(UMLDomainNavigatorContentProvider.this.myViewerRefreshRunnable);
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ this.myWorkspaceSynchronizer.dispose();
+ this.myWorkspaceSynchronizer = null;
+ this.myViewerRefreshRunnable = null;
+ for (final Object element : this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource resource = (Resource) element;
+ resource.unload();
+ }
+ ((TransactionalEditingDomain) this.myEditingDomain).dispose();
+ this.myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
+ this.myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(final Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(final ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(final Object parentElement) {
+ if (parentElement instanceof IFile) {
+ final IFile file = (IFile) parentElement;
+ final URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ final Resource resource = this.myEditingDomain.getResourceSet().getResource(fileURI, true);
+ return wrapEObjects(this.myAdapterFctoryContentProvier.getChildren(resource), parentElement);
+ }
+
+ if (parentElement instanceof UMLDomainNavigatorItem) {
+ return wrapEObjects(this.myAdapterFctoryContentProvier.getChildren(((UMLDomainNavigatorItem) parentElement).getEObject()), parentElement);
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] wrapEObjects(final Object[] objects, final Object parentElement) {
+ final Collection result = new ArrayList();
+ for (final Object object : objects) {
+ if (object instanceof EObject) {
+ result.add(new UMLDomainNavigatorItem((EObject) object, parentElement, this.myAdapterFctoryContentProvier));
+ }
+ }
+ return result.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(final Object element) {
+ if (element instanceof UMLAbstractNavigatorItem) {
+ final UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(final Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java
new file mode 100644
index 00000000000..e3aec44a610
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDomainNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { EObject.class, IPropertySource.class };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(final Object adaptableObject, final Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem) {
+ final org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem) adaptableObject;
+ final EObject eObject = domainNavigatorItem.getEObject();
+ if (adapterType == EObject.class) {
+ return eObject;
+ }
+ if (adapterType == IPropertySource.class) {
+ return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject);
+ }
+ }
+
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private final Object myParent;
+
+ /**
+ * @generated
+ */
+ private final EObject myEObject;
+
+ /**
+ * @generated
+ */
+ private final IPropertySourceProvider myPropertySourceProvider;
+
+ /**
+ * @generated
+ */
+ public UMLDomainNavigatorItem(final EObject eObject, final Object parent, final IPropertySourceProvider propertySourceProvider) {
+ this.myParent = parent;
+ this.myEObject = eObject;
+ this.myPropertySourceProvider = propertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return this.myParent;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getEObject() {
+ return this.myEObject;
+ }
+
+ /**
+ * @generated
+ */
+ public IPropertySourceProvider getPropertySourceProvider() {
+ return this.myPropertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem) {
+ return EcoreUtil.getURI(getEObject()).equals(
+ EcoreUtil.getURI(((org.eclipse.papyrus.uml.diagram.timing.navigator.UMLDomainNavigatorItem) obj).getEObject()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int hashCode() {
+ return EcoreUtil.getURI(getEObject()).hashCode();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java
new file mode 100644
index 00000000000..ed3273152f9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.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.navigator;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDomainNavigatorLabelProvider implements ICommonLabelProvider {
+
+ /**
+ * @generated
+ */
+ private final AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance()
+ .getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public void init(final ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(final Object element) {
+ if (element instanceof UMLDomainNavigatorItem) {
+ return this.myAdapterFactoryLabelProvider.getImage(((UMLDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(final Object element) {
+ if (element instanceof UMLDomainNavigatorItem) {
+ return this.myAdapterFactoryLabelProvider.getText(((UMLDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(final ILabelProviderListener listener) {
+ this.myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ this.myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(final Object element, final String property) {
+ return this.myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(final ILabelProviderListener listener) {
+ this.myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(final Object anElement) {
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java
new file mode 100644
index 00000000000..0f6b8c7df13
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorActionProvider extends CommonActionProvider {
+
+ /**
+ * @generated
+ */
+ private boolean myContribute;
+
+ /**
+ * @generated
+ */
+ private OpenDiagramAction myOpenDiagramAction;
+
+ /**
+ * @generated
+ */
+ @Override
+ public void init(final ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ this.myContribute = true;
+ makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite());
+ } else {
+ this.myContribute = false;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void makeActions(final ICommonViewerWorkbenchSite viewerSite) {
+ this.myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void fillActionBars(final IActionBars actionBars) {
+ if (!this.myContribute) {
+ return;
+ }
+ final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+ this.myOpenDiagramAction.selectionChanged(selection);
+ if (this.myOpenDiagramAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, this.myOpenDiagramAction);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void fillContextMenu(final IMenuManager menu) {
+ }
+
+ /**
+ * @generated
+ */
+ private static class OpenDiagramAction extends Action {
+
+ /**
+ * @generated
+ */
+ private Diagram myDiagram;
+
+ /**
+ * @generated
+ */
+ private final ICommonViewerWorkbenchSite myViewerSite;
+
+ /**
+ * @generated
+ */
+ public OpenDiagramAction(final ICommonViewerWorkbenchSite viewerSite) {
+ super(Messages.NavigatorActionProvider_OpenDiagramActionName);
+ this.myViewerSite = viewerSite;
+ }
+
+ /**
+ * @generated
+ */
+ public final void selectionChanged(final IStructuredSelection selection) {
+ this.myDiagram = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof UMLNavigatorItem) {
+ selectedElement = ((UMLNavigatorItem) selectedElement).getView();
+ } else if (selectedElement instanceof IAdaptable) {
+ selectedElement = ((IAdaptable) selectedElement).getAdapter(View.class);
+ }
+ if (selectedElement instanceof Diagram) {
+ final Diagram diagram = (Diagram) selectedElement;
+ if (TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(diagram))) {
+ this.myDiagram = diagram;
+ }
+ }
+ }
+ setEnabled(this.myDiagram != null);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void run() {
+ if (this.myDiagram == null || this.myDiagram.eResource() == null) {
+ return;
+ }
+
+ final IEditorInput editorInput = getEditorInput(this.myDiagram);
+ final IWorkbenchPage page = this.myViewerSite.getPage();
+ try {
+ page.openEditor(editorInput, UMLDiagramEditor.ID);
+ } catch (final PartInitException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Exception while openning diagram", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static IEditorInput getEditorInput(final Diagram diagram) {
+ final Resource diagramResource = diagram.eResource();
+ for (final EObject nextEObject : diagramResource.getContents()) {
+ if (nextEObject == diagram) {
+ return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ final URI uri = EcoreUtil.getURI(diagram);
+ final String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
+ final IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java
new file mode 100644
index 00000000000..156c36be468
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorContentProvider implements ICommonContentProvider {
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings({ "unchecked", "serial", "rawtypes" })
+ public UMLNavigatorContentProvider() {
+ final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ this.myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ this.myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+ @Override
+ public Object get(final Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+ });
+ this.myViewerRefreshRunnable = new Runnable() {
+ public void run() {
+ if (UMLNavigatorContentProvider.this.myViewer != null) {
+ UMLNavigatorContentProvider.this.myViewer.refresh();
+ }
+ }
+ };
+ this.myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ for (final Object element : UMLNavigatorContentProvider.this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource nextResource = (Resource) element;
+ nextResource.unload();
+ }
+ if (UMLNavigatorContentProvider.this.myViewer != null) {
+ UMLNavigatorContentProvider.this.myViewer.getControl().getDisplay().asyncExec(UMLNavigatorContentProvider.this.myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceDeleted(final Resource resource) {
+ for (final Object element : UMLNavigatorContentProvider.this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource nextResource = (Resource) element;
+ nextResource.unload();
+ }
+ if (UMLNavigatorContentProvider.this.myViewer != null) {
+ UMLNavigatorContentProvider.this.myViewer.getControl().getDisplay().asyncExec(UMLNavigatorContentProvider.this.myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceMoved(final Resource resource, final URI newURI) {
+ for (final Object element : UMLNavigatorContentProvider.this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource nextResource = (Resource) element;
+ nextResource.unload();
+ }
+ if (UMLNavigatorContentProvider.this.myViewer != null) {
+ UMLNavigatorContentProvider.this.myViewer.getControl().getDisplay().asyncExec(UMLNavigatorContentProvider.this.myViewerRefreshRunnable);
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ this.myWorkspaceSynchronizer.dispose();
+ this.myWorkspaceSynchronizer = null;
+ this.myViewerRefreshRunnable = null;
+ for (final Object element : this.myEditingDomain.getResourceSet().getResources()) {
+ final Resource resource = (Resource) element;
+ resource.unload();
+ }
+ ((TransactionalEditingDomain) this.myEditingDomain).dispose();
+ this.myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
+ this.myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(final Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(final ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(final Object parentElement) {
+ if (parentElement instanceof IFile) {
+ final IFile file = (IFile) parentElement;
+ final URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ final Resource resource = this.myEditingDomain.getResourceSet().getResource(fileURI, true);
+ final Collection result = new ArrayList();
+ return result.toArray();
+ }
+
+ if (parentElement instanceof UMLNavigatorGroup) {
+ final UMLNavigatorGroup group = (UMLNavigatorGroup) parentElement;
+ return group.getChildren();
+ }
+
+ if (parentElement instanceof UMLNavigatorItem) {
+ final UMLNavigatorItem navigatorItem = (UMLNavigatorItem) parentElement;
+ if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
+ return EMPTY_ARRAY;
+ }
+ return getViewChildren(navigatorItem.getView(), parentElement);
+ }
+
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Object[] getViewChildren(final View view, final Object parentElement) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getLinksSourceByType(final Collection edges, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = edges.iterator(); it.hasNext();) {
+ final Edge nextEdge = (Edge) it.next();
+ final View nextEdgeSource = nextEdge.getSource();
+ if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
+ result.add(nextEdgeSource);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getLinksTargetByType(final Collection edges, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = edges.iterator(); it.hasNext();) {
+ final Edge nextEdge = (Edge) it.next();
+ final View nextEdgeTarget = nextEdge.getTarget();
+ if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
+ result.add(nextEdgeTarget);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getOutgoingLinksByType(final Collection nodes, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = nodes.iterator(); it.hasNext();) {
+ final View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getIncomingLinksByType(final Collection nodes, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = nodes.iterator(); it.hasNext();) {
+ final View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getChildrenByType(final Collection nodes, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = nodes.iterator(); it.hasNext();) {
+ final View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getChildren(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getDiagramLinksByType(final Collection diagrams, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = diagrams.iterator(); it.hasNext();) {
+ final Diagram nextDiagram = (Diagram) it.next();
+ result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection selectViewsByType(final Collection views, final String type) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = views.iterator(); it.hasNext();) {
+ final View nextView = (View) it.next();
+ if (type.equals(nextView.getType()) && isOwnView(nextView)) {
+ result.add(nextView);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(final View view) {
+ return TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+
+ /**
+ * @generated
+ */
+ private Collection createNavigatorItems(final Collection views, final Object parent, final boolean isLeafs) {
+ final Collection result = new ArrayList();
+ for (final Iterator it = views.iterator(); it.hasNext();) {
+ result.add(new UMLNavigatorItem((View) it.next(), parent, isLeafs));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(final Object element) {
+ if (element instanceof UMLAbstractNavigatorItem) {
+ final UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(final Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.java
new file mode 100644
index 00000000000..315a944ccf1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.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.navigator;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorGroup extends UMLAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ private final String myGroupName;
+
+ /**
+ * @generated
+ */
+ private final String myIcon;
+
+ /**
+ * @generated
+ */
+ private final Collection myChildren = new LinkedList();
+
+ /**
+ * @generated
+ */
+ UMLNavigatorGroup(final String groupName, final String icon, final Object parent) {
+ super(parent);
+ this.myGroupName = groupName;
+ this.myIcon = icon;
+ }
+
+ /**
+ * @generated
+ */
+ public String getGroupName() {
+ return this.myGroupName;
+ }
+
+ /**
+ * @generated
+ */
+ public String getIcon() {
+ return this.myIcon;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren() {
+ return this.myChildren.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public void addChildren(final Collection children) {
+ this.myChildren.addAll(children);
+ }
+
+ /**
+ * @generated
+ */
+ public void addChild(final Object child) {
+ this.myChildren.add(child);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEmpty() {
+ return this.myChildren.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorGroup) {
+ final org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorGroup anotherGroup = (org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorGroup) obj;
+ if (getGroupName().equals(anotherGroup.getGroupName())) {
+ return getParent().equals(anotherGroup.getParent());
+ }
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int hashCode() {
+ return getGroupName().hashCode();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java
new file mode 100644
index 00000000000..6a07a66fd37
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorItem extends UMLAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { View.class, EObject.class };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(final Object adaptableObject, final Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorItem
+ && (adapterType == View.class || adapterType == EObject.class)) {
+ return ((org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorItem) adaptableObject).getView();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private final View myView;
+
+ /**
+ * @generated
+ */
+ private boolean myLeaf = false;
+
+ /**
+ * @generated
+ */
+ public UMLNavigatorItem(final View view, final Object parent, final boolean isLeaf) {
+ super(parent);
+ this.myView = view;
+ this.myLeaf = isLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public View getView() {
+ return this.myView;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLeaf() {
+ return this.myLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorItem) {
+ return EcoreUtil.getURI(getView()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorItem) obj).getView()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int hashCode() {
+ return EcoreUtil.getURI(getView()).hashCode();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java
new file mode 100644
index 00000000000..2d6132be3c4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ITreePathLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.ViewerLabel;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {
+
+ /**
+ * @generated
+ */
+ static {
+ UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public void updateLabel(final ViewerLabel label, final TreePath elementPath) {
+ final Object element = elementPath.getLastSegment();
+ if (element instanceof UMLNavigatorItem && !isOwnView(((UMLNavigatorItem) element).getView())) {
+ return;
+ }
+ label.setText(getText(element));
+ label.setImage(getImage(element));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Image getImage(final Object element) {
+ if (element instanceof UMLNavigatorGroup) {
+ final UMLNavigatorGroup group = (UMLNavigatorGroup) element;
+ return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
+ }
+
+ if (element instanceof UMLNavigatorItem) {
+ final UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return super.getImage(element);
+ }
+ return getImage(navigatorItem.getView());
+ }
+
+ return super.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(final View view) {
+ return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Image getImage(final String key, final IElementType elementType) {
+ final ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance().getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null && elementType != null && UMLElementTypes.isKnownElementType(elementType)) {
+ image = UMLElementTypes.getImage(elementType);
+ imageRegistry.put(key, image);
+ }
+
+ if (image == null) {
+ image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
+ imageRegistry.put(key, image);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getText(final Object element) {
+ if (element instanceof UMLNavigatorGroup) {
+ final UMLNavigatorGroup group = (UMLNavigatorGroup) element;
+ return group.getGroupName();
+ }
+
+ if (element instanceof UMLNavigatorItem) {
+ final UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return null;
+ }
+ return getText(navigatorItem.getView());
+ }
+
+ return super.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(final View view) {
+ if (view.getElement() != null && view.getElement().eIsProxy()) {
+ return getUnresolvedDomainElementProxyText(view);
+ }
+ return getUnknownElementText(view);
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnknownElementText(final View view) {
+ return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnresolvedDomainElementProxyText(final View view) {
+ return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ public void init(final ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(final IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(final Object anElement) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(final View view) {
+ return TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java
new file mode 100644
index 00000000000..685303fb6c9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.navigator.ILinkHelper;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorLinkHelper implements ILinkHelper {
+
+ /**
+ * @generated
+ */
+ private static IEditorInput getEditorInput(final Diagram diagram) {
+ final Resource diagramResource = diagram.eResource();
+ for (final EObject nextEObject : diagramResource.getContents()) {
+ if (nextEObject == diagram) {
+ return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ final URI uri = EcoreUtil.getURI(diagram);
+ final String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
+ final IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection findSelection(final IEditorInput anInput) {
+ final IDiagramDocument document = UMLDiagramEditorPlugin.getInstance().getDocumentProvider().getDiagramDocument(anInput);
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ public void activateEditor(final IWorkbenchPage aPage, final IStructuredSelection aSelection) {
+ if (aSelection == null || aSelection.isEmpty()) {
+ return;
+ }
+ if (false == aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) {
+ return;
+ }
+
+ final UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) aSelection.getFirstElement();
+ View navigatorView = null;
+ if (abstractNavigatorItem instanceof UMLNavigatorItem) {
+ navigatorView = ((UMLNavigatorItem) abstractNavigatorItem).getView();
+ } else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
+ final UMLNavigatorGroup navigatorGroup = (UMLNavigatorGroup) abstractNavigatorItem;
+ if (navigatorGroup.getParent() instanceof UMLNavigatorItem) {
+ navigatorView = ((UMLNavigatorItem) navigatorGroup.getParent()).getView();
+ }
+ }
+ if (navigatorView == null) {
+ return;
+ }
+ final IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
+ final IEditorPart editor = aPage.findEditor(editorInput);
+ if (editor == null) {
+ return;
+ }
+ aPage.bringToTop(editor);
+ if (editor instanceof DiagramEditor) {
+ final DiagramEditor diagramEditor = (DiagramEditor) editor;
+ final ResourceSet diagramEditorResourceSet = diagramEditor.getEditingDomain().getResourceSet();
+ final EObject selectedView = diagramEditorResourceSet.getEObject(EcoreUtil.getURI(navigatorView), true);
+ if (selectedView == null) {
+ return;
+ }
+ final GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor.getAdapter(GraphicalViewer.class);
+ final EditPart selectedEditPart = (EditPart) graphicalViewer.getEditPartRegistry().get(selectedView);
+ if (selectedEditPart != null) {
+ graphicalViewer.select(selectedEditPart);
+ }
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java
new file mode 100644
index 00000000000..ecf211f624e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.navigator;
+
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNavigatorSorter extends ViewerSorter {
+
+ /**
+ * @generated
+ */
+ private static final int GROUP_CATEGORY = 85;
+
+ /**
+ * @generated
+ */
+ @Override
+ public int category(final Object element) {
+ if (element instanceof UMLNavigatorItem) {
+ final UMLNavigatorItem item = (UMLNavigatorItem) element;
+ return UMLVisualIDRegistry.getVisualID(item.getView());
+ }
+ return GROUP_CATEGORY;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java
new file mode 100644
index 00000000000..3bd1145c80a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java
@@ -0,0 +1,429 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.parsers;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public abstract class AbstractParser implements IParser {
+
+ /**
+ * @generated
+ */
+ protected final EAttribute[] features;
+
+ /**
+ * @generated
+ */
+ protected final EAttribute[] editableFeatures;
+
+ /**
+ * @generated
+ */
+ private String viewPattern;
+
+ /**
+ * @generated
+ */
+ private String editorPattern;
+
+ /**
+ * @generated
+ */
+ private String editPattern;
+
+ /**
+ * @generated
+ */
+ public AbstractParser(final EAttribute[] features) {
+ if (features == null || Arrays.asList(features).contains(null)) {
+ throw new IllegalArgumentException();
+ }
+ this.editableFeatures = this.features = features;
+ }
+
+ /**
+ * @generated
+ */
+ public AbstractParser(final EAttribute[] features, final EAttribute[] editableFeatures) {
+ if (features == null || Arrays.asList(features).contains(null)) {
+ throw new IllegalArgumentException();
+ }
+ this.features = features;
+ if (editableFeatures == null || Arrays.asList(editableFeatures).contains(null)) {
+ throw new IllegalArgumentException();
+ }
+ this.editableFeatures = editableFeatures;
+ }
+
+ /**
+ * @generated
+ */
+ public String getViewPattern() {
+ return this.viewPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setViewPattern(final String viewPattern) {
+ this.viewPattern = viewPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditorPattern() {
+ return this.editorPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditorPattern(final String editorPattern) {
+ this.editorPattern = editorPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditPattern() {
+ return this.editPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditPattern(final String editPattern) {
+ this.editPattern = editPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isAffectingEvent(final Object event, final int flags) {
+ if (event instanceof Notification) {
+ return isAffectingFeature(((Notification) event).getFeature());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isAffectingFeature(final Object feature) {
+ for (final EAttribute feature2 : this.features) {
+ if (feature2 == feature) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor(final IAdaptable element) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object[] getValues(final EObject element) {
+ final Object[] values = new Object[this.features.length];
+ for (int i = 0; i < this.features.length; i++) {
+ values[i] = getValue(element, this.features[i]);
+ }
+ return values;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object[] getEditableValues(final EObject element) {
+ final Object[] values = new Object[this.editableFeatures.length];
+ for (int i = 0; i < this.editableFeatures.length; i++) {
+ values[i] = getValue(element, this.editableFeatures[i]);
+ }
+ return values;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object getValue(final EObject element, final EAttribute feature) {
+ Object value = element.eGet(feature);
+ final Class iClass = feature.getEAttributeType().getInstanceClass();
+ if (String.class.equals(iClass)) {
+ if (value == null) {
+ value = ""; //$NON-NLS-1$
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getParseCommand(final IAdaptable adapter, final Object[] values, final int flags) {
+ if (values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final EObject element = (EObject) adapter.getAdapter(EObject.class);
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
+ for (int i = 0; i < values.length; i++) {
+ command.compose(getModificationCommand(element, this.editableFeatures[i], values[i]));
+ }
+ return command;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getModificationCommand(final EObject element, final EAttribute feature, Object value) {
+ value = getValidNewValue(feature, value);
+ if (value instanceof InvalidValue) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ final SetRequest request = new SetRequest(element, feature, value);
+ return new SetValueCommand(request);
+ }
+
+ /**
+ * @generated
+ */
+ protected IParserEditStatus validateNewValues(final Object[] values) {
+ if (values.length != this.editableFeatures.length) {
+ return ParserEditStatus.UNEDITABLE_STATUS;
+ }
+ for (int i = 0; i < values.length; i++) {
+ final Object value = getValidNewValue(this.editableFeatures[i], values[i]);
+ if (value instanceof InvalidValue) {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, value.toString());
+ }
+ }
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object getValidNewValue(final EAttribute feature, Object value) {
+ final EClassifier type = feature.getEType();
+ if (type instanceof EDataType) {
+ final Class iClass = type.getInstanceClass();
+ if (Boolean.TYPE.equals(iClass)) {
+ if (value instanceof Boolean) {
+ // ok
+ } else if (value instanceof String) {
+ value = Boolean.valueOf((String) value);
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Character.TYPE.equals(iClass)) {
+ if (value instanceof Character) {
+ // ok
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ value = new Character(s.charAt(0));
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Byte.TYPE.equals(iClass)) {
+ if (value instanceof Byte) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Byte(((Number) value).byteValue());
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Byte.valueOf(s);
+ } catch (final NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Short.TYPE.equals(iClass)) {
+ if (value instanceof Short) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Short(((Number) value).shortValue());
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Short.valueOf(s);
+ } catch (final NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Integer.TYPE.equals(iClass)) {
+ if (value instanceof Integer) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Integer(((Number) value).intValue());
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Integer.valueOf(s);
+ } catch (final NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Long.TYPE.equals(iClass)) {
+ if (value instanceof Long) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Long(((Number) value).longValue());
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Long.valueOf(s);
+ } catch (final NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Float.TYPE.equals(iClass)) {
+ if (value instanceof Float) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Float(((Number) value).floatValue());
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Float.valueOf(s);
+ } catch (final NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (Double.TYPE.equals(iClass)) {
+ if (value instanceof Double) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Double(((Number) value).doubleValue());
+ } else if (value instanceof String) {
+ final String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Double.valueOf(s);
+ } catch (final NumberFormatException nfe) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_WrongStringConversion, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, iClass.getName()));
+ }
+ } else if (type instanceof EEnum) {
+ if (value instanceof String) {
+ final EEnumLiteral literal = ((EEnum) type).getEEnumLiteralByLiteral((String) value);
+ if (literal == null) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnknownLiteral, value));
+ } else {
+ value = literal.getInstance();
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueType, String.class.getName()));
+ }
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ protected class InvalidValue {
+
+ /**
+ * @generated
+ */
+ private final String description;
+
+ /**
+ * @generated
+ */
+ public InvalidValue(final String description) {
+ this.description = description;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return this.description;
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java
new file mode 100644
index 00000000000..0f86e3abdf6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.parsers;
+
+import java.text.FieldPosition;
+import java.text.MessageFormat;
+import java.text.ParsePosition;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFormatParser extends AbstractParser {
+
+ /**
+ * @generated
+ */
+ private String defaultPattern;
+
+ /**
+ * @generated
+ */
+ private String defaultEditablePattern;
+
+ /**
+ * @generated
+ */
+ private MessageFormat viewProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editorProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editProcessor;
+
+ /**
+ * @generated
+ */
+ public MessageFormatParser(final EAttribute[] features) {
+ super(features);
+ }
+
+ /**
+ * @generated
+ */
+ public MessageFormatParser(final EAttribute[] features, final EAttribute[] editableFeatures) {
+ super(features, editableFeatures);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultPattern() {
+ if (this.defaultPattern == null) {
+ final StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < this.features.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('{');
+ sb.append(i);
+ sb.append('}');
+ }
+ this.defaultPattern = sb.toString();
+ }
+ return this.defaultPattern;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setViewPattern(final String viewPattern) {
+ super.setViewPattern(viewPattern);
+ this.viewProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setEditorPattern(final String editorPattern) {
+ super.setEditorPattern(editorPattern);
+ this.editorProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getViewProcessor() {
+ if (this.viewProcessor == null) {
+ this.viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
+ }
+ return this.viewProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditorProcessor() {
+ if (this.editorProcessor == null) {
+ this.editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
+ }
+ return this.editorProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultEditablePattern() {
+ if (this.defaultEditablePattern == null) {
+ final StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < this.editableFeatures.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('{');
+ sb.append(i);
+ sb.append('}');
+ }
+ this.defaultEditablePattern = sb.toString();
+ }
+ return this.defaultEditablePattern;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setEditPattern(final String editPattern) {
+ super.setEditPattern(editPattern);
+ this.editProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditProcessor() {
+ if (this.editProcessor == null) {
+ this.editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
+ }
+ return this.editProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditString(final IAdaptable adapter, final int flags) {
+ final EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+ /**
+ * @generated
+ */
+ public IParserEditStatus isValidEditString(final IAdaptable adapter, final String editString) {
+ final ParsePosition pos = new ParsePosition(0);
+ final Object[] values = getEditProcessor().parse(editString, pos);
+ if (values == null) {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError,
+ new Integer(pos.getErrorIndex())));
+ }
+ return validateNewValues(values);
+ }
+
+ /**
+ * @generated
+ */
+ public ICommand getParseCommand(final IAdaptable adapter, final String newString, final int flags) {
+ final Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
+ return getParseCommand(adapter, values, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public String getPrintString(final IAdaptable adapter, final int flags) {
+ final EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DeleteElementAction.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DeleteElementAction.java
new file mode 100644
index 00000000000..8d500e92b87
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DeleteElementAction.java
@@ -0,0 +1,3 @@
+//This file is not used.
+// The DeleteElementAction is removed from the plugin and replaced by DeleteFromModelAction in the plugin
+// org.eclipse.diagram.common.
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.java
new file mode 100644
index 00000000000..b9272e900fc
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.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.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider {
+
+ /**
+ * @generated
+ */
+ private final IWorkbenchPart part;
+
+ /**
+ * @generated
+ */
+ public DiagramEditorContextMenuProvider(final IWorkbenchPart part, final EditPartViewer viewer) {
+ super(part, viewer);
+ this.part = part;
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void buildContextMenu(final IMenuManager menu) {
+ getViewer().flush();
+ try {
+ TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+
+ public void run() {
+ ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this,
+ DiagramEditorContextMenuProvider.this.part);
+ menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
+
+ }
+ });
+ } catch (final Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/Messages.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/Messages.java
new file mode 100644
index 00000000000..9997d0450ab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/Messages.java
@@ -0,0 +1,529 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class Messages extends NLS {
+
+ /**
+ * @generated
+ */
+ static {
+ NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Messages() {
+ }
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardOpenEditorError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardCreationError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardPageExtensionError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramProgressTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_isModifiable;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_handleElementContentChanged;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_IncorrectInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_NoDiagramInResourceError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_DiagramLoadingError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_UnsynchronizedFileSaveError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveDiagramTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveNextResourceTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveAsOperation;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_ResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_ResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_WizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_OpenModelFileDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_InitDiagramCommand;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_IncorrectRootError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SavingDeletedFile;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLElementChooserDialog_SelectModelElementTitle;
+
+ /**
+ * @generated
+ */
+ public static String ModelElementSelectionPageMessage;
+
+ /**
+ * @generated
+ */
+ public static String ValidateActionMessage;
+
+ /**
+ * @generated
+ */
+ public static String createNodesGroup_title;
+
+ /**
+ * @generated
+ */
+ public static String createEdgesGroup_title;
+
+ /**
+ * @generated
+ */
+ public static String createInteractionCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createInteractionCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createLifelineCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createLifelineCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createStateDefinitionCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createStateDefinitionCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createTimeObservationCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createTimeObservationCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createTimeConstraintCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createTimeConstraintCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createDurationObservationCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createDurationObservationCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createDurationConstraintCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createDurationConstraintCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createOccurrenceSpecificationCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createOccurrenceSpecificationCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createDestructionOccurrenceSpecificationCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createDestructionOccurrenceSpecificationCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createGateCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createGateCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createGeneralOrderingCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createGeneralOrderingCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createMessageSyncCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createMessageSyncCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createMessageAsyncCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createMessageAsyncCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createMessageReplyCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createMessageReplyCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createCreateMessageCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createCreateMessageCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createDeleteMessageCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createDeleteMessageCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createLostMessageCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createLostMessageCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String createFoundMessageCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String createFoundMessageCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String InteractionCompartmentEditPartTN_title;
+
+ /**
+ * @generated
+ */
+ public static String FullLifelineStateDefinitionCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String FullLifelineTimelineCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String CompactLifelineCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String TimeRulerCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String FullLifelineTimeRulerCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String CompactLifelineTimeRulerCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String FreeTimeRulerCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String LinearTimeRulerCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String CommandName_OpenDiagram;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorActionProvider_OpenDiagramActionName;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_UnexpectedValueType;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_WrongStringConversion;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_UnknownLiteral;
+
+ /**
+ * @generated
+ */
+ public static String MessageFormatParser_InvalidInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderMessage;
+
+ // TODO: put accessor fields manually
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java
new file mode 100644
index 00000000000..d6433e621a0
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.IWrapperItemProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Wizard page that allows to select element from model.
+ *
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class ModelElementSelectionPage extends WizardPage {
+ /**
+ * @generated
+ */
+ protected EObject selectedModelElement;
+
+ /**
+ * @generated
+ */
+ private TreeViewer modelViewer;
+
+ /**
+ * @generated
+ */
+ public ModelElementSelectionPage(final String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getModelElement() {
+ return this.selectedModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModelElement(final EObject modelElement) {
+ this.selectedModelElement = modelElement;
+ if (this.modelViewer != null) {
+ if (this.selectedModelElement != null) {
+ this.modelViewer.setInput(this.selectedModelElement.eResource());
+ this.modelViewer.setSelection(new StructuredSelection(this.selectedModelElement));
+ } else {
+ this.modelViewer.setInput(null);
+ }
+ setPageComplete(validatePage());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void createControl(final Composite parent) {
+ initializeDialogUnits(parent);
+
+ final Composite plate = new Composite(parent, SWT.NONE);
+ plate.setLayoutData(new GridData(GridData.FILL_BOTH));
+ final GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ plate.setLayout(layout);
+ setControl(plate);
+
+ final Label label = new Label(plate, SWT.NONE);
+ label.setText(getSelectionTitle());
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ this.modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ final GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ this.modelViewer.getTree().setLayoutData(layoutData);
+ this.modelViewer.setContentProvider(new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
+ this.modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
+ if (this.selectedModelElement != null) {
+ this.modelViewer.setInput(this.selectedModelElement.eResource());
+ this.modelViewer.setSelection(new StructuredSelection(this.selectedModelElement));
+ }
+ this.modelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(final SelectionChangedEvent event) {
+ ModelElementSelectionPage.this.updateSelection((IStructuredSelection) event.getSelection());
+ }
+ });
+
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Override to provide custom model element description.
+ *
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return Messages.ModelElementSelectionPageMessage;
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateSelection(final IStructuredSelection selection) {
+ this.selectedModelElement = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof IWrapperItemProvider) {
+ selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof FeatureMap.Entry) {
+ selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof EObject) {
+ this.selectedModelElement = (EObject) selectedElement;
+ }
+ }
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Override to provide specific validation of the selected model element.
+ *
+ * @generated
+ */
+ protected boolean validatePage() {
+ return true;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java
new file mode 100644
index 00000000000..0da24c254d4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLCreationWizard extends Wizard implements INewWizard {
+
+ /**
+ * @generated
+ */
+ private IWorkbench workbench;
+
+ /**
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * @generated
+ */
+ protected UMLCreationWizardPage diagramModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected UMLCreationWizardPage domainModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected Resource diagram;
+
+ /**
+ * @generated
+ */
+ private boolean openNewlyCreatedDiagramEditor = true;
+
+ /**
+ * @generated
+ */
+ public IWorkbench getWorkbench() {
+ return this.workbench;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection getSelection() {
+ return this.selection;
+ }
+
+ /**
+ * @generated
+ */
+ public final Resource getDiagram() {
+ return this.diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return this.openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setOpenNewlyCreatedDiagramEditor(final boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(final IWorkbench workbench, final IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(Messages.UMLCreationWizardTitle);
+ setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void addPages() {
+ this.diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), "PapyrusUMLTiming_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
+ this.diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
+ this.diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
+ addPage(this.diagramModelFilePage);
+
+ this.domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "PapyrusUMLTiming") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ @Override
+ public void setVisible(final boolean visible) {
+ if (visible) {
+ String fileName = UMLCreationWizard.this.diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLTiming_diagram".length()); //$NON-NLS-1$
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "PapyrusUMLTiming")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
+ this.domainModelFilePage.setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
+ this.domainModelFilePage.setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
+ addPage(this.domainModelFilePage);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ final IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
+
+ @Override
+ protected void execute(final IProgressMonitor monitor) throws CoreException, InterruptedException {
+ UMLCreationWizard.this.diagram = UMLDiagramEditorUtil.createDiagram(UMLCreationWizard.this.diagramModelFilePage.getURI(),
+ UMLCreationWizard.this.domainModelFilePage.getURI(), monitor);
+ if (isOpenNewlyCreatedDiagramEditor() && UMLCreationWizard.this.diagram != null) {
+ try {
+ UMLDiagramEditorUtil.openDiagram(UMLCreationWizard.this.diagram);
+ } catch (final PartInitException e) {
+ ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardOpenEditorError, null, e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (final InterruptedException e) {
+ return false;
+ } catch (final InvocationTargetException e) {
+ if (e.getTargetException() instanceof CoreException) {
+ ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardCreationError, null,
+ ((CoreException) e.getTargetException()).getStatus());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return this.diagram != null;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java
new file mode 100644
index 00000000000..847c4053d5e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLCreationWizardPage extends WizardNewFileCreationPage {
+
+ /**
+ * @generated
+ */
+ private final String fileExtension;
+
+ /**
+ * @generated
+ */
+ public UMLCreationWizardPage(final String pageName, final IStructuredSelection selection, final String fileExtension) {
+ super(pageName, selection);
+ this.fileExtension = fileExtension;
+ }
+
+ /**
+ * Override to create files with this extension.
+ *
+ * @generated
+ */
+ protected String getExtension() {
+ return this.fileExtension;
+ }
+
+ /**
+ * @generated
+ */
+ public URI getURI() {
+ return URI.createPlatformResourceURI(getFilePath().toString(), false);
+ }
+
+ /**
+ * @generated
+ */
+ protected IPath getFilePath() {
+ IPath path = getContainerFullPath();
+ if (path == null) {
+ path = new Path(""); //$NON-NLS-1$
+ }
+ final String fileName = getFileName();
+ if (fileName != null) {
+ path = path.append(fileName);
+ }
+ return path;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ super.createControl(parent);
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), getFileName(), getExtension()));
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean validatePage() {
+ if (!super.validatePage()) {
+ return false;
+ }
+ final String extension = getExtension();
+ if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
+ setErrorMessage(NLS.bind(Messages.UMLCreationWizardPageExtensionError, extension));
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java
new file mode 100644
index 00000000000..bb132a43a73
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramActionBarContributor extends DiagramActionBarContributor {
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Class getEditorClass() {
+ return UMLDiagramEditor.class;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getEditorId() {
+ return UMLDiagramEditor.ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void init(final IActionBars bars, final IWorkbenchPage page) {
+ super.init(bars, page);
+ // print preview
+ final IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_FILE);
+ assert fileMenu != null;
+ fileMenu.remove("pageSetupAction"); //$NON-NLS-1$
+ final IMenuManager editMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ assert editMenu != null;
+ if (editMenu.find("validationGroup") == null) { //$NON-NLS-1$
+ editMenu.add(new GroupMarker("validationGroup")); //$NON-NLS-1$
+ }
+ final IAction validateAction = new ValidateAction(page);
+ editMenu.appendToGroup("validationGroup", validateAction); //$NON-NLS-1$
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java
new file mode 100644
index 00000000000..aaf970bf421
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+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.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.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.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.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+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.uml2.uml.Package;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramContentInitializer {
+
+ /**
+ * @generated
+ */
+ private final Map myDomain2NotationMap = new HashMap();
+
+ /**
+ * @generated
+ */
+ private final Collection myLinkDescriptors = new LinkedList();
+
+ /**
+ * @generated
+ */
+ public void initDiagramContent(final Diagram diagram) {
+ if (!TimingDiagramEditPart.MODEL_ID.equals(diagram.getType())) {
+ UMLDiagramEditorPlugin.getInstance().logError("Incorrect diagram passed as a parameter: " + diagram.getType());
+ return;
+ }
+ if (false == diagram.getElement() instanceof Package) {
+ UMLDiagramEditorPlugin.getInstance().logError("Incorrect diagram element specified: " + diagram.getElement() + " instead of Package");
+ return;
+ }
+ createPackage_1Children(diagram);
+ createLinks(diagram);
+ }
+
+ /**
+ * @generated
+ */
+ private void createPackage_1Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getPackage_1SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createInteraction_2Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getInteraction_2OutgoingLinks(view));
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getInteraction_2SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ createInteractionInteractionCompartment_5Children(getCompartment(view, InteractionCompartmentEditPartTN.VISUAL_ID));
+ createInteractionTimeRulerCompartment_29Children(getCompartment(view, TimeRulerCompartmentEditPartCN.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifeline_19Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getLifeline_19OutgoingLinks(view));
+ createLifelineFullLifelineStateDefinitionCompartment_7Children(getCompartment(view, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID));
+ createLifelineFullLifelineTimelineCompartment_8Children(getCompartment(view, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID));
+ createLifelineFullLifelineTimeRuler_82Children(getCompartment(view, FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifeline_20Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getLifeline_20OutgoingLinks(view));
+ createLifelineCompactLifelineCompartment_23Children(getCompartment(view, CompactLifelineCompartmentEditPartCN.VISUAL_ID));
+ createLifelineCompactLifelineTimeRuler_83Children(getCompartment(view, CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createStateInvariant_11Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getStateInvariant_11OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createStateInvariant_28Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getStateInvariant_28OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createOccurrenceSpecification_12Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getOccurrenceSpecification_12OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createMessageOccurrenceSpecification_13Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getMessageOccurrenceSpecification_13OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createTimeConstraint_15Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getTimeConstraint_15OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createTimeObservation_16Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getTimeObservation_16OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createDurationConstraint_18Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getDurationConstraint_18OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createDurationObservation_17Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getDurationObservation_17OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createGeneralOrdering_67Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getGeneralOrdering_67OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createDestructionOccurrenceSpecification_27Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getDestructionOccurrenceSpecification_27OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifeline_40Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getLifeline_40OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createGate_69Children(final View view) {
+ this.myDomain2NotationMap.put(view.getElement(), view);
+ this.myLinkDescriptors.addAll(UMLDiagramUpdater.getGate_69OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createInteractionInteractionCompartment_5Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getInteractionInteractionCompartment_5SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifelineFullLifelineStateDefinitionCompartment_7Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getLifelineFullLifelineStateDefinitionCompartment_7SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifelineFullLifelineTimelineCompartment_8Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getLifelineFullLifelineTimelineCompartment_8SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifelineCompactLifelineCompartment_23Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getLifelineCompactLifelineCompartment_23SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createInteractionTimeRulerCompartment_29Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getInteractionTimeRulerCompartment_29SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifelineFullLifelineTimeRuler_82Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getLifelineFullLifelineTimeRuler_82SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLifelineCompactLifelineTimeRuler_83Children(final View view) {
+ final Collection childNodeDescriptors = UMLDiagramUpdater.getLifelineCompactLifelineTimeRuler_83SemanticChildren(view);
+ for (final Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (UMLNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createNode(final View parentView, final UMLNodeDescriptor nodeDescriptor) {
+ final String nodeType = UMLVisualIDRegistry.getType(nodeDescriptor.getVisualID());
+ final Node node = ViewService.createNode(parentView, nodeDescriptor.getModelElement(), nodeType, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ switch (nodeDescriptor.getVisualID()) {
+ case InteractionEditPartTN.VISUAL_ID:
+ createInteraction_2Children(node);
+ return;
+ case FullLifelineEditPartCN.VISUAL_ID:
+ createLifeline_19Children(node);
+ return;
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ createLifeline_20Children(node);
+ return;
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ createStateInvariant_11Children(node);
+ return;
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ createStateInvariant_28Children(node);
+ return;
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ createOccurrenceSpecification_12Children(node);
+ return;
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ createMessageOccurrenceSpecification_13Children(node);
+ return;
+ case TimeConstraintEditPart.VISUAL_ID:
+ createTimeConstraint_15Children(node);
+ return;
+ case TimeObservationEditPart.VISUAL_ID:
+ createTimeObservation_16Children(node);
+ return;
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ createDurationConstraint_18Children(node);
+ return;
+ case DurationObservationEditPartCN.VISUAL_ID:
+ createDurationObservation_17Children(node);
+ return;
+ case GeneralOrderingEditPart.VISUAL_ID:
+ createGeneralOrdering_67Children(node);
+ return;
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ createDestructionOccurrenceSpecification_27Children(node);
+ return;
+ case LifelineEditPart.VISUAL_ID:
+ createLifeline_40Children(node);
+ return;
+ case GateEditPart.VISUAL_ID:
+ createGate_69Children(node);
+ return;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLinks(final Diagram diagram) {
+ for (boolean continueLinkCreation = true; continueLinkCreation;) {
+ continueLinkCreation = false;
+ final Collection additionalDescriptors = new LinkedList();
+ for (final Iterator it = this.myLinkDescriptors.iterator(); it.hasNext();) {
+ final UMLLinkDescriptor nextLinkDescriptor = (UMLLinkDescriptor) it.next();
+ if (!this.myDomain2NotationMap.containsKey(nextLinkDescriptor.getSource())
+ || !this.myDomain2NotationMap.containsKey(nextLinkDescriptor.getDestination())) {
+ continue;
+ }
+ final String linkType = UMLVisualIDRegistry.getType(nextLinkDescriptor.getVisualID());
+ final Edge edge = ViewService.getInstance().createEdge(nextLinkDescriptor.getSemanticAdapter(), diagram, linkType, ViewUtil.APPEND, true,
+ UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (edge != null) {
+ edge.setSource((View) this.myDomain2NotationMap.get(nextLinkDescriptor.getSource()));
+ edge.setTarget((View) this.myDomain2NotationMap.get(nextLinkDescriptor.getDestination()));
+ it.remove();
+ if (nextLinkDescriptor.getModelElement() != null) {
+ this.myDomain2NotationMap.put(nextLinkDescriptor.getModelElement(), edge);
+ }
+ continueLinkCreation = true;
+ switch (nextLinkDescriptor.getVisualID()) {
+ case MessageSyncEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_3OutgoingLinks(edge));
+ break;
+ case MessageAsyncEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_4OutgoingLinks(edge));
+ break;
+ case MessageReplyEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_41OutgoingLinks(edge));
+ break;
+ case MessageCreateEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_44OutgoingLinks(edge));
+ break;
+ case MessageDeleteEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_47OutgoingLinks(edge));
+ break;
+ case MessageLostEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_50OutgoingLinks(edge));
+ break;
+ case MessageFoundEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(UMLDiagramUpdater.getMessage_53OutgoingLinks(edge));
+ break;
+ }
+ }
+ }
+ this.myLinkDescriptors.addAll(additionalDescriptors);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private Node getCompartment(final View node, final int visualID) {
+ final String type = UMLVisualIDRegistry.getType(visualID);
+ for (final Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ final View nextView = (View) it.next();
+ if (nextView instanceof Node && type.equals(nextView.getType())) {
+ return (Node) nextView;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java
new file mode 100644
index 00000000000..cb104e39f6d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java
@@ -0,0 +1,536 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.util.EventObject;
+
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.commands.CommandStackListener;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.ui.palette.PaletteViewer;
+import org.eclipse.gef.ui.palette.PaletteViewerProvider;
+import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
+import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent;
+import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider;
+import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener;
+import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider;
+import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer;
+import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.navigator.resources.ProjectExplorer;
+import org.eclipse.ui.part.IShowInTargetList;
+import org.eclipse.ui.part.ShowInContext;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final String CONTEXT_ID = "org.eclipse.papyrus.uml.diagram.timing.ui.diagramContext"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private KeyHandler paletteKeyHandler = null;
+
+ /**
+ * @generated
+ */
+ private MouseListener paletteMouseListener = null;
+
+ /**
+ * @generated
+ */
+ private IUndoableOperation savedOperation = null;
+
+ /**
+ * @generated
+ */
+ private final TransactionalEditingDomain editingDomain;
+
+ /**
+ * @generated
+ */
+ private final IDocumentProvider documentProvider;
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditor(final ServicesRegistry servicesRegistry, final Diagram diagram) throws ServiceException {
+ super(servicesRegistry, diagram);
+
+ // adds a listener to the palette service, which reacts to palette customizations
+ PapyrusPaletteService.getInstance().addProviderChangeListener(this);
+
+ // Share the same editing provider
+ this.editingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
+ this.documentProvider = new GmfMultiDiagramDocumentProvider(this.editingDomain);
+
+ // overrides editing domain created by super constructor
+ setDocumentProvider(this.documentProvider);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PaletteRoot createPaletteRoot(final PaletteRoot existingPaletteRoot) {
+ PaletteRoot paletteRoot;
+ if (existingPaletteRoot == null) {
+ paletteRoot = PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent());
+ } else {
+ PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent());
+ paletteRoot = existingPaletteRoot;
+ }
+ applyCustomizationsToPalette(paletteRoot);
+ return paletteRoot;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PreferencesHint getPreferencesHint() {
+ return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getContributorId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getAdapter(final Class type) {
+ if (type == IShowInTargetList.class) {
+ return new IShowInTargetList() {
+ public String[] getShowInTargetIds() {
+ return new String[] { ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ return super.getAdapter(type);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected final IDocumentProvider getDocumentProvider(final IEditorInput input) {
+ return this.documentProvider;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public TransactionalEditingDomain getEditingDomain() {
+ return this.editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected final void setDocumentProvider(final IEditorInput input) {
+ // Already set in the constructor
+ }
+
+ /**
+ * @generated
+ */
+ public void gotoMarker(final IMarker marker) {
+ MarkerNavigationService.getInstance().gotoMarker(this, marker);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ performSaveAs(new NullProgressMonitor());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performSaveAs(final IProgressMonitor progressMonitor) {
+ // Nothing
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ShowInContext getShowInContext() {
+ return new ShowInContext(getEditorInput(), getNavigatorSelection());
+ }
+
+ /**
+ * @generated
+ */
+ private ISelection getNavigatorSelection() {
+ final IDiagramDocument document = getDiagramDocument();
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ final DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
+ getDiagramGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TransactionalEditingDomain createEditingDomain() {
+ // Already configured
+ return this.editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void configureDiagramEditDomain() {
+ super.configureDiagramEditDomain();
+ getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new CommandStackListener() {
+
+ public void commandStackChanged(final EventObject event) {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void doSave(final IProgressMonitor progressMonitor) {
+ // The saving of the resource is done by the CoreMultiDiagramEditor
+ this.savedOperation = getOperationHistory().getUndoOperation(getUndoContext());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ final IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
+ return this.savedOperation != op;
+ }
+
+ /**
+ * @generated
+ */
+ public void providerChanged(final ProviderChangeEvent event) {
+ // update the palette if the palette service has changed
+ if (PapyrusPaletteService.getInstance().equals(event.getSource())) {
+ PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, getDefaultPaletteContent());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ // remove palette service listener
+ // remove preference listener
+ PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+
+ super.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ protected PaletteViewer getPaletteViewer() {
+ return getEditDomain().getPaletteViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PaletteViewer constructPaletteViewer() {
+ return new PapyrusPaletteViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PaletteViewerProvider createPaletteViewerProvider() {
+ getEditDomain().setPaletteRoot(createPaletteRoot(null));
+ return new PaletteViewerProvider(getEditDomain()) {
+
+ /**
+ * Override to provide the additional behavior for the tools. Will intialize with a PaletteEditPartFactory
+ * that has a TrackDragger that understand how to handle the mouseDoubleClick event for shape creation
+ * tools. Also will initialize the palette with a defaultTool that is the SelectToolEx that undestands how
+ * to handle the enter key which will result in the creation of the shape also.
+ */
+ @Override
+ protected void configurePaletteViewer(final PaletteViewer viewer) {
+ super.configurePaletteViewer(viewer);
+
+ // customize menu...
+ viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(viewer));
+
+ viewer.getKeyHandler().setParent(getPaletteKeyHandler());
+ viewer.getControl().addMouseListener(getPaletteMouseListener());
+
+ // Add a transfer drag target listener that is supported on
+ // palette template entries whose template is a creation tool.
+ // This will enable drag and drop of the palette shape creation
+ // tools.
+ viewer.addDragSourceListener(new PaletteToolTransferDragSourceListener(viewer));
+ viewer.setCustomizer(createPaletteCustomizer());
+ }
+
+ @Override
+ public PaletteViewer createPaletteViewer(final Composite parent) {
+ final PaletteViewer pViewer = constructPaletteViewer();
+ pViewer.createControl(parent);
+ configurePaletteViewer(pViewer);
+ hookPaletteViewer(pViewer);
+ return pViewer;
+ }
+
+ /**
+ * @return Palette Key Handler for the palette
+ */
+ private KeyHandler getPaletteKeyHandler() {
+
+ if (UMLDiagramEditor.this.paletteKeyHandler == null) {
+
+ UMLDiagramEditor.this.paletteKeyHandler = new KeyHandler() {
+
+ /**
+ * Processes a <i>key released </i> event. This method is called by the Tool whenever a key is
+ * released, and the Tool is in the proper state. Override to support pressing the enter key to
+ * create a shape or connection (between two selected shapes)
+ *
+ * @param event
+ * the KeyEvent
+ * @return <code>true</code> if KeyEvent was handled in some way
+ */
+ @Override
+ public boolean keyReleased(final KeyEvent event) {
+
+ if (event.keyCode == SWT.Selection) {
+
+ final Tool tool = getPaletteViewer().getActiveTool().createTool();
+
+ if (toolSupportsAccessibility(tool)) {
+
+ tool.keyUp(event, getDiagramGraphicalViewer());
+
+ // deactivate current selection
+ getPaletteViewer().setActiveTool(null);
+
+ return true;
+ }
+
+ }
+ return super.keyReleased(event);
+ }
+
+ };
+
+ }
+ return UMLDiagramEditor.this.paletteKeyHandler;
+ }
+
+ /**
+ * @return Palette Mouse listener for the palette
+ */
+ private MouseListener getPaletteMouseListener() {
+
+ if (UMLDiagramEditor.this.paletteMouseListener == null) {
+
+ UMLDiagramEditor.this.paletteMouseListener = new MouseListener() {
+
+ /**
+ * Flag to indicate that the current active tool should be cleared after a mouse double-click
+ * event.
+ */
+ private boolean clearActiveTool = false;
+
+ /**
+ * Override to support double-clicking a palette tool entry to create a shape or connection
+ * (between two selected shapes).
+ *
+ * @see MouseListener#mouseDoubleClick(MouseEvent)
+ */
+ public void mouseDoubleClick(final MouseEvent e) {
+ final Tool tool = getPaletteViewer().getActiveTool().createTool();
+
+ if (toolSupportsAccessibility(tool)) {
+
+ tool.setViewer(getDiagramGraphicalViewer());
+ tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain());
+ tool.mouseDoubleClick(e, getDiagramGraphicalViewer());
+
+ // Current active tool should be deactivated,
+ // but if it is down here it will get
+ // reactivated deep in GEF palette code after
+ // receiving mouse up events.
+ this.clearActiveTool = true;
+ }
+ }
+
+ public void mouseDown(final MouseEvent e) {
+ // do nothing
+ }
+
+ public void mouseUp(final MouseEvent e) {
+ // Deactivate current active tool here if a
+ // double-click was handled.
+ if (this.clearActiveTool) {
+ getPaletteViewer().setActiveTool(null);
+ this.clearActiveTool = false;
+ }
+
+ }
+ };
+
+ }
+ return UMLDiagramEditor.this.paletteMouseListener;
+ }
+
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public GraphicalViewer getGraphicalViewer() {
+ return super.getGraphicalViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+
+ // Enable Drop
+ getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
+
+ @Override
+ protected Object getJavaObject(final TransferData data) {
+ return LocalSelectionTransfer.getTransfer().nativeToJava(data);
+ }
+
+ @Override
+ protected TransactionalEditingDomain getTransactionalEditingDomain() {
+ return getEditingDomain();
+ }
+ });
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
+ if (getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) {
+ final IMultiDiagramEditor editor = (IMultiDiagramEditor) getSite().getPage().getActiveEditor();
+ // If not the active editor, ignore selection changed.
+ if (equals(editor.getActiveEditor())) {
+ updateActions(getSelectionActions());
+ super.selectionChanged(part, selection);
+ } else {
+ super.selectionChanged(part, selection);
+ }
+ } else {
+ super.selectionChanged(part, selection);
+ }
+ // from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart,
+ // ISelection)
+ if (part == this) {
+ rebuildStatusLine();
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java
new file mode 100644
index 00000000000..7d83ac47c17
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
+import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.timing.expressions.UMLOCLFactory;
+import org.eclipse.papyrus.uml.diagram.timing.preferences.DiagramPreferenceInitializer;
+import org.eclipse.papyrus.uml.diagram.timing.providers.ElementInitializers;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.uml.diagram.timing"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
+
+ /**
+ * @generated
+ */
+ private static UMLDiagramEditorPlugin instance;
+
+ /**
+ * @generated
+ */
+ private ComposedAdapterFactory adapterFactory;
+
+ /**
+ * @generated
+ */
+ private UMLDocumentProvider documentProvider;
+
+ /**
+ * @generated
+ */
+ private UMLBaseItemSemanticEditPolicy.LinkConstraints linkConstraints;
+
+ /**
+ * @generated
+ */
+ private ElementInitializers initializers;
+
+ /**
+ * @generated
+ */
+ private UMLOCLFactory oclFactory;
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditorPlugin() {
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+ PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
+ this.adapterFactory = createAdapterFactory();
+ final DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
+ diagramPreferenceInitializer.initializeDefaultPreferences();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ this.adapterFactory.dispose();
+ this.adapterFactory = null;
+ this.linkConstraints = null;
+ this.initializers = null;
+ this.oclFactory = null;
+ instance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLDiagramEditorPlugin getInstance() {
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ return store;
+ }
+
+ /**
+ * @generated
+ */
+ protected ComposedAdapterFactory createAdapterFactory() {
+ final ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
+ fillItemProviderFactories(factories);
+ return new ComposedAdapterFactory(factories);
+ }
+
+ /**
+ * @generated
+ */
+ protected void fillItemProviderFactories(final List<AdapterFactory> factories) {
+ factories.add(new UMLItemProviderAdapterFactory());
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ }
+
+ /**
+ * @generated
+ */
+ public AdapterFactory getItemProvidersAdapterFactory() {
+ return this.adapterFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public ImageDescriptor getItemImageDescriptor(final Object item) {
+ final IItemLabelProvider labelProvider = (IItemLabelProvider) this.adapterFactory.adapt(item, IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
+ }
+ return null;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in relative path.
+ *
+ * @generated
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getBundledImageDescriptor(final String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
+ }
+
+ /**
+ * Respects images residing in any plug-in. If path is relative, then this bundle is looked up for the image,
+ * otherwise, for absolute path, first segment is taken as id of plug-in with image
+ *
+ * @generated
+ * @param path
+ * the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
+ * @return the image descriptor
+ */
+ public static ImageDescriptor findImageDescriptor(final String path) {
+ final IPath p = new Path(path);
+ if (p.isAbsolute() && p.segmentCount() > 1) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
+ } else {
+ return getBundledImageDescriptor(p.makeAbsolute().toString());
+ }
+ }
+
+ /**
+ * Returns an image for the image file at the given plug-in relative path. Client do not need to dispose this image.
+ * Images will be disposed automatically.
+ *
+ * @generated
+ * @param path
+ * the path
+ * @return image instance
+ */
+ public Image getBundledImage(final String path) {
+ Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
+
+ /**
+ * Returns string from plug-in's resource bundle
+ *
+ * @generated
+ */
+ public static String getString(final String key) {
+ return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public UMLDocumentProvider getDocumentProvider() {
+ if (this.documentProvider == null) {
+ this.documentProvider = new UMLDocumentProvider();
+ }
+ return this.documentProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public UMLBaseItemSemanticEditPolicy.LinkConstraints getLinkConstraints() {
+ return this.linkConstraints;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLinkConstraints(final UMLBaseItemSemanticEditPolicy.LinkConstraints lc) {
+ this.linkConstraints = lc;
+ }
+
+ /**
+ * @generated
+ */
+ public ElementInitializers getElementInitializers() {
+ return this.initializers;
+ }
+
+ /**
+ * @generated
+ */
+ public void setElementInitializers(final ElementInitializers i) {
+ this.initializers = i;
+ }
+
+ /**
+ * @generated
+ */
+ public UMLOCLFactory getUMLOCLFactory() {
+ return this.oclFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUMLOCLFactory(final UMLOCLFactory f) {
+ this.oclFactory = f;
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(final String error) {
+ logError(error, null);
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(String error, final Throwable throwable) {
+ if (error == null && throwable != null) {
+ error = throwable.getMessage();
+ }
+ getLog().log(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IStatus.OK, error, throwable));
+ debug(error, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(final String message) {
+ logInfo(message, null);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(String message, final Throwable throwable) {
+ if (message == null && throwable != null) {
+ message = throwable.getMessage();
+ }
+ getLog().log(new Status(IStatus.INFO, UMLDiagramEditorPlugin.ID, IStatus.OK, message, throwable));
+ debug(message, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ private void debug(final String message, final Throwable throwable) {
+ if (!isDebugging()) {
+ return;
+ }
+ if (message != null) {
+ System.err.println(message);
+ }
+ if (throwable != null) {
+ throwable.printStackTrace();
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java
new file mode 100644
index 00000000000..0d2fff7f632
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramEditorUtil {
+
+ /**
+ * @generated
+ */
+ public static Map<?, ?> getSaveOptions() {
+ final HashMap<String, Object> saveOptions = new HashMap<String, Object>();
+ saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ return saveOptions;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean openDiagram(final Resource diagram) throws PartInitException {
+ final String path = diagram.getURI().toPlatformString(true);
+ final IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ if (workspaceResource instanceof IFile) {
+ final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return null != page.openEditor(new FileEditorInput((IFile) workspaceResource), UMLDiagramEditor.ID);
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void setCharset(final IFile file) {
+ if (file == null) {
+ return;
+ }
+ try {
+ file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$
+ } catch (final CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
+ if (containerFullPath == null) {
+ containerFullPath = new Path(""); //$NON-NLS-1$
+ }
+ if (fileName == null || fileName.trim().length() == 0) {
+ fileName = "default"; //$NON-NLS-1$
+ }
+ IPath filePath = containerFullPath.append(fileName);
+ if (extension != null && !extension.equals(filePath.getFileExtension())) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ extension = filePath.getFileExtension();
+ fileName = filePath.removeFileExtension().lastSegment();
+ int i = 1;
+ while (ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) {
+ i++;
+ filePath = containerFullPath.append(fileName + i);
+ if (extension != null) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ }
+ return filePath.lastSegment();
+ }
+
+ /**
+ * Runs the wizard in a dialog.
+ *
+ * @generated
+ */
+ public static void runWizard(final Shell shell, final Wizard wizard, final String settingsKey) {
+ final IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin.getInstance().getDialogSettings();
+ IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
+ if (wizardDialogSettings == null) {
+ wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
+ }
+ wizard.setDialogSettings(wizardDialogSettings);
+ final WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
+ dialog.open();
+ }
+
+ /**
+ * This method should be called within a workspace modify operation since it creates resources.
+ *
+ * @generated
+ */
+ public static Resource createDiagram(final URI diagramURI, final URI modelURI, final IProgressMonitor progressMonitor) {
+ final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask(Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3);
+ final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+ final Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
+ final String diagramName = diagramURI.lastSegment();
+ final AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel,
+ Collections.EMPTY_LIST) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final Package model = createInitialModel();
+ attachModelToResource(model, modelResource);
+
+ final Diagram diagram = ViewService.createDiagram(model, TimingDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null) {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ diagram.setElement(model);
+ }
+
+ try {
+ modelResource.save(org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorUtil.getSaveOptions());
+ diagramResource.save(org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorUtil.getSaveOptions());
+ } catch (final IOException e) {
+
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null);
+ } catch (final ExecutionException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ }
+ setCharset(WorkspaceSynchronizer.getFile(modelResource));
+ setCharset(WorkspaceSynchronizer.getFile(diagramResource));
+ return diagramResource;
+ }
+
+ /**
+ * Create a new instance of domain element associated with canvas. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static Package createInitialModel() {
+ return UMLFactory.eINSTANCE.createPackage();
+ }
+
+ /**
+ * Store model element in the resource. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static void attachModelToResource(final Package model, final Resource resource) {
+ resource.getContents().add(model);
+ }
+
+ /**
+ * @generated
+ */
+ public static void selectElementsInDiagram(final IDiagramWorkbenchPart diagramPart, final List<EditPart> editParts) {
+ diagramPart.getDiagramGraphicalViewer().deselectAll();
+
+ EditPart firstPrimary = null;
+ for (final EditPart nextPart : editParts) {
+ diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
+ if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
+ firstPrimary = nextPart;
+ }
+ }
+
+ if (!editParts.isEmpty()) {
+ diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static int findElementsInDiagramByID(final DiagramEditPart diagramPart, final EObject element, final List<EditPart> editPartCollector) {
+ final IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart.getViewer();
+ final int intialNumOfEditParts = editPartCollector.size();
+
+ if (element instanceof View) { // support notation element lookup
+ final EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(element);
+ if (editPart != null) {
+ editPartCollector.add(editPart);
+ return 1;
+ }
+ }
+
+ final String elementID = EMFCoreUtil.getProxyID(element);
+ @SuppressWarnings("unchecked")
+ final List<EditPart> associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
+ // perform the possible hierarchy disjoint -> take the top-most parts only
+ for (final EditPart nextPart : associatedParts) {
+ EditPart parentPart = nextPart.getParent();
+ while (parentPart != null && !associatedParts.contains(parentPart)) {
+ parentPart = parentPart.getParent();
+ }
+ if (parentPart == null) {
+ editPartCollector.add(nextPart);
+ }
+ }
+
+ if (intialNumOfEditParts == editPartCollector.size()) {
+ if (!associatedParts.isEmpty()) {
+ editPartCollector.add(associatedParts.get(0));
+ } else {
+ if (element.eContainer() != null) {
+ return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector);
+ }
+ }
+ }
+ return editPartCollector.size() - intialNumOfEditParts;
+ }
+
+ /**
+ * @generated
+ */
+ public static View findView(final DiagramEditPart diagramEditPart, final EObject targetElement, final LazyElement2ViewMap lazyElement2ViewMap) {
+ boolean hasStructuralURI = false;
+ if (targetElement.eResource() instanceof XMLResource) {
+ hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null;
+ }
+
+ View view = null;
+ final LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>();
+ if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
+ view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
+ } else if (findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) {
+ final EditPart editPart = editPartHolder.get(0);
+ view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null;
+ }
+
+ return (view == null) ? diagramEditPart.getDiagramView() : view;
+ }
+
+ /**
+ * XXX This is quite suspicious code (especially editPartTmpHolder) and likely to be removed soon
+ *
+ * @generated
+ */
+ public static class LazyElement2ViewMap {
+ /**
+ * @generated
+ */
+ private Map<EObject, View> element2ViewMap;
+
+ /**
+ * @generated
+ */
+ private final View scope;
+
+ /**
+ * @generated
+ */
+ private final Set<? extends EObject> elementSet;
+
+ /**
+ * @generated
+ */
+ public LazyElement2ViewMap(final View scope, final Set<? extends EObject> elements) {
+ this.scope = scope;
+ this.elementSet = elements;
+ }
+
+ /**
+ * @generated
+ */
+ public final Map<EObject, View> getElement2ViewMap() {
+ if (this.element2ViewMap == null) {
+ this.element2ViewMap = new HashMap<EObject, View>();
+ // map possible notation elements to itself as these can't be found by view.getElement()
+ for (final EObject element : this.elementSet) {
+ if (element instanceof View) {
+ final View view = (View) element;
+ if (view.getDiagram() == this.scope.getDiagram()) {
+ this.element2ViewMap.put(element, view); // take only those that part of our diagram
+ }
+ }
+ }
+
+ buildElement2ViewMap(this.scope, this.element2ViewMap, this.elementSet);
+ }
+ return this.element2ViewMap;
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean buildElement2ViewMap(final View parentView, final Map<EObject, View> element2ViewMap, final Set<? extends EObject> elements) {
+ if (elements.size() == element2ViewMap.size()) {
+ return true;
+ }
+
+ if (parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) {
+ element2ViewMap.put(parentView.getElement(), parentView);
+ if (elements.size() == element2ViewMap.size()) {
+ return true;
+ }
+ }
+ boolean complete = false;
+ for (final Iterator<?> it = parentView.getChildren().iterator(); it.hasNext() && !complete;) {
+ complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ }
+ for (final Iterator<?> it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete;) {
+ complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ }
+ for (final Iterator<?> it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete;) {
+ complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ }
+ return complete;
+ }
+ } // LazyElement2ViewMap
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java
new file mode 100644
index 00000000000..125d6939951
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramUpdateCommand implements IHandler {
+
+ /**
+ * @generated
+ */
+ public void addHandlerListener(final IHandlerListener handlerListener) {
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() != 1) {
+ return null;
+ }
+ if (structuredSelection.getFirstElement() instanceof EditPart && ((EditPart) structuredSelection.getFirstElement()).getModel() instanceof View) {
+ final EObject modelElement = ((View) ((EditPart) structuredSelection.getFirstElement()).getModel()).getElement();
+ final List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ for (final Iterator it = editPolicies.iterator(); it.hasNext();) {
+ final CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
+ nextEditPolicy.refresh();
+ }
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEnabled() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isHandled() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void removeHandlerListener(final IHandlerListener handlerListener) {
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java
new file mode 100644
index 00000000000..266ecad20ca
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java
@@ -0,0 +1,1676 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.update.DiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.timing.custom.parts.PropertyDiagramUpdater;
+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.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.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.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.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+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.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
+import org.eclipse.uml2.uml.DurationConstraint;
+import org.eclipse.uml2.uml.DurationObservation;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Gate;
+import org.eclipse.uml2.uml.GeneralOrdering;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
+import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.StateInvariant;
+import org.eclipse.uml2.uml.TimeConstraint;
+import org.eclipse.uml2.uml.TimeObservation;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDiagramUpdater {
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getSemanticChildren(final View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case TimingDiagramEditPart.VISUAL_ID:
+ return getPackage_1SemanticChildren(view);
+ case InteractionEditPartTN.VISUAL_ID:
+ return getInteraction_2SemanticChildren(view);
+ case InteractionCompartmentEditPartTN.VISUAL_ID:
+ return getInteractionInteractionCompartment_5SemanticChildren(view);
+ case FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID:
+ return getLifelineFullLifelineStateDefinitionCompartment_7SemanticChildren(view);
+ case FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID:
+ return getLifelineFullLifelineTimelineCompartment_8SemanticChildren(view);
+ case CompactLifelineCompartmentEditPartCN.VISUAL_ID:
+ return getLifelineCompactLifelineCompartment_23SemanticChildren(view);
+ case TimeRulerCompartmentEditPartCN.VISUAL_ID:
+ return getInteractionTimeRulerCompartment_29SemanticChildren(view);
+ case FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ return getLifelineFullLifelineTimeRuler_82SemanticChildren(view);
+ case CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ return getLifelineCompactLifelineTimeRuler_83SemanticChildren(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getPackage_1SemanticChildren(final View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ final Package modelElement = (Package) view.getElement();
+ final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (final Object name : modelElement.getPackagedElements()) {
+ final PackageableElement childElement = (PackageableElement) name;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == InteractionEditPartTN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getInteraction_2SemanticChildren(final View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ final Interaction modelElement = (Interaction) view.getElement();
+ final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (final Object name : modelElement.getFormalGates()) {
+ final Gate childElement = (Gate) name;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == GateEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getInteractionInteractionCompartment_5SemanticChildren(final View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ final View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ final Interaction modelElement = (Interaction) containerView.getElement();
+ final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (final Object name : modelElement.getLifelines()) {
+ final Lifeline childElement = (Lifeline) name;
+ final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == FullLifelineEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == CompactLifelineEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getLifelineFullLifelineStateDefinitionCompartment_7SemanticChildren(final View view) {
+ return Collections.emptyList();
+ }
+
+ public static List getLifelineFullLifelineTimelineCompartment_8SemanticChildren(final View view) {
+ final ICustomDiagramUpdater customUpdater = new PropertyDiagramUpdater();
+ return customUpdater.getSemanticChildren(view);
+ }
+
+ public static List getLifelineCompactLifelineCompartment_23SemanticChildren(final View view) {
+ final ICustomDiagramUpdater customUpdater = new PropertyDiagramUpdater();
+ return customUpdater.getSemanticChildren(view);
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getInteractionTimeRulerCompartment_29SemanticChildren(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getLifelineFullLifelineTimeRuler_82SemanticChildren(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLNodeDescriptor> getLifelineCompactLifelineTimeRuler_83SemanticChildren(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getContainedLinks(final View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case TimingDiagramEditPart.VISUAL_ID:
+ return getPackage_1ContainedLinks(view);
+ case InteractionEditPartTN.VISUAL_ID:
+ return getInteraction_2ContainedLinks(view);
+ case FullLifelineEditPartCN.VISUAL_ID:
+ return getLifeline_19ContainedLinks(view);
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return getLifeline_20ContainedLinks(view);
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ return getStateInvariant_11ContainedLinks(view);
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ return getStateInvariant_28ContainedLinks(view);
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getOccurrenceSpecification_12ContainedLinks(view);
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getMessageOccurrenceSpecification_13ContainedLinks(view);
+ case TimeConstraintEditPart.VISUAL_ID:
+ return getTimeConstraint_15ContainedLinks(view);
+ case TimeObservationEditPart.VISUAL_ID:
+ return getTimeObservation_16ContainedLinks(view);
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ return getDurationConstraint_18ContainedLinks(view);
+ case DurationObservationEditPartCN.VISUAL_ID:
+ return getDurationObservation_17ContainedLinks(view);
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return getGeneralOrdering_67ContainedLinks(view);
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getDestructionOccurrenceSpecification_27ContainedLinks(view);
+ case LifelineEditPart.VISUAL_ID:
+ return getLifeline_40ContainedLinks(view);
+ case GateEditPart.VISUAL_ID:
+ return getGate_69ContainedLinks(view);
+ case MessageSyncEditPart.VISUAL_ID:
+ return getMessage_3ContainedLinks(view);
+ case MessageAsyncEditPart.VISUAL_ID:
+ return getMessage_4ContainedLinks(view);
+ case MessageReplyEditPart.VISUAL_ID:
+ return getMessage_41ContainedLinks(view);
+ case MessageCreateEditPart.VISUAL_ID:
+ return getMessage_44ContainedLinks(view);
+ case MessageDeleteEditPart.VISUAL_ID:
+ return getMessage_47ContainedLinks(view);
+ case MessageLostEditPart.VISUAL_ID:
+ return getMessage_50ContainedLinks(view);
+ case MessageFoundEditPart.VISUAL_ID:
+ return getMessage_53ContainedLinks(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getIncomingLinks(final View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case InteractionEditPartTN.VISUAL_ID:
+ return getInteraction_2IncomingLinks(view);
+ case FullLifelineEditPartCN.VISUAL_ID:
+ return getLifeline_19IncomingLinks(view);
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return getLifeline_20IncomingLinks(view);
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ return getStateInvariant_11IncomingLinks(view);
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ return getStateInvariant_28IncomingLinks(view);
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getOccurrenceSpecification_12IncomingLinks(view);
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getMessageOccurrenceSpecification_13IncomingLinks(view);
+ case TimeConstraintEditPart.VISUAL_ID:
+ return getTimeConstraint_15IncomingLinks(view);
+ case TimeObservationEditPart.VISUAL_ID:
+ return getTimeObservation_16IncomingLinks(view);
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ return getDurationConstraint_18IncomingLinks(view);
+ case DurationObservationEditPartCN.VISUAL_ID:
+ return getDurationObservation_17IncomingLinks(view);
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return getGeneralOrdering_67IncomingLinks(view);
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getDestructionOccurrenceSpecification_27IncomingLinks(view);
+ case LifelineEditPart.VISUAL_ID:
+ return getLifeline_40IncomingLinks(view);
+ case GateEditPart.VISUAL_ID:
+ return getGate_69IncomingLinks(view);
+ case MessageSyncEditPart.VISUAL_ID:
+ return getMessage_3IncomingLinks(view);
+ case MessageAsyncEditPart.VISUAL_ID:
+ return getMessage_4IncomingLinks(view);
+ case MessageReplyEditPart.VISUAL_ID:
+ return getMessage_41IncomingLinks(view);
+ case MessageCreateEditPart.VISUAL_ID:
+ return getMessage_44IncomingLinks(view);
+ case MessageDeleteEditPart.VISUAL_ID:
+ return getMessage_47IncomingLinks(view);
+ case MessageLostEditPart.VISUAL_ID:
+ return getMessage_50IncomingLinks(view);
+ case MessageFoundEditPart.VISUAL_ID:
+ return getMessage_53IncomingLinks(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getOutgoingLinks(final View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case InteractionEditPartTN.VISUAL_ID:
+ return getInteraction_2OutgoingLinks(view);
+ case FullLifelineEditPartCN.VISUAL_ID:
+ return getLifeline_19OutgoingLinks(view);
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return getLifeline_20OutgoingLinks(view);
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ return getStateInvariant_11OutgoingLinks(view);
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ return getStateInvariant_28OutgoingLinks(view);
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getOccurrenceSpecification_12OutgoingLinks(view);
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getMessageOccurrenceSpecification_13OutgoingLinks(view);
+ case TimeConstraintEditPart.VISUAL_ID:
+ return getTimeConstraint_15OutgoingLinks(view);
+ case TimeObservationEditPart.VISUAL_ID:
+ return getTimeObservation_16OutgoingLinks(view);
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ return getDurationConstraint_18OutgoingLinks(view);
+ case DurationObservationEditPartCN.VISUAL_ID:
+ return getDurationObservation_17OutgoingLinks(view);
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return getGeneralOrdering_67OutgoingLinks(view);
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return getDestructionOccurrenceSpecification_27OutgoingLinks(view);
+ case LifelineEditPart.VISUAL_ID:
+ return getLifeline_40OutgoingLinks(view);
+ case GateEditPart.VISUAL_ID:
+ return getGate_69OutgoingLinks(view);
+ case MessageSyncEditPart.VISUAL_ID:
+ return getMessage_3OutgoingLinks(view);
+ case MessageAsyncEditPart.VISUAL_ID:
+ return getMessage_4OutgoingLinks(view);
+ case MessageReplyEditPart.VISUAL_ID:
+ return getMessage_41OutgoingLinks(view);
+ case MessageCreateEditPart.VISUAL_ID:
+ return getMessage_44OutgoingLinks(view);
+ case MessageDeleteEditPart.VISUAL_ID:
+ return getMessage_47OutgoingLinks(view);
+ case MessageLostEditPart.VISUAL_ID:
+ return getMessage_50OutgoingLinks(view);
+ case MessageFoundEditPart.VISUAL_ID:
+ return getMessage_53OutgoingLinks(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getPackage_1ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getInteraction_2ContainedLinks(final View view) {
+ final Interaction modelElement = (Interaction) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Message_3(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Message_4(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Message_41(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Message_44(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Message_47(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Message_50(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_19ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_20ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getStateInvariant_11ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getStateInvariant_28ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getOccurrenceSpecification_12ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessageOccurrenceSpecification_13ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getTimeConstraint_15ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getTimeObservation_16ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDurationConstraint_18ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDurationObservation_17ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getGeneralOrdering_67ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDestructionOccurrenceSpecification_27ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_40ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getGate_69ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_3ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_4ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_41ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_44ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_47ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_50ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_53ContainedLinks(final View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getInteraction_2IncomingLinks(final View view) {
+ final Interaction modelElement = (Interaction) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_19IncomingLinks(final View view) {
+ final Lifeline modelElement = (Lifeline) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_20IncomingLinks(final View view) {
+ final Lifeline modelElement = (Lifeline) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getStateInvariant_11IncomingLinks(final View view) {
+ final StateInvariant modelElement = (StateInvariant) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getStateInvariant_28IncomingLinks(final View view) {
+ final StateInvariant modelElement = (StateInvariant) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getOccurrenceSpecification_12IncomingLinks(final View view) {
+ final OccurrenceSpecification modelElement = (OccurrenceSpecification) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessageOccurrenceSpecification_13IncomingLinks(final View view) {
+ final MessageOccurrenceSpecification modelElement = (MessageOccurrenceSpecification) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_3(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_4(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_41(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_44(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_47(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_53(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getTimeConstraint_15IncomingLinks(final View view) {
+ final TimeConstraint modelElement = (TimeConstraint) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getTimeObservation_16IncomingLinks(final View view) {
+ final TimeObservation modelElement = (TimeObservation) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDurationConstraint_18IncomingLinks(final View view) {
+ final DurationConstraint modelElement = (DurationConstraint) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDurationObservation_17IncomingLinks(final View view) {
+ final DurationObservation modelElement = (DurationObservation) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getGeneralOrdering_67IncomingLinks(final View view) {
+ final GeneralOrdering modelElement = (GeneralOrdering) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDestructionOccurrenceSpecification_27IncomingLinks(final View view) {
+ final DestructionOccurrenceSpecification modelElement = (DestructionOccurrenceSpecification) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_3(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_4(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_41(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_44(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_47(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_53(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_40IncomingLinks(final View view) {
+ final Lifeline modelElement = (Lifeline) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getGate_69IncomingLinks(final View view) {
+ final Gate modelElement = (Gate) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_3(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_4(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_41(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_44(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_47(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_Message_53(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_3IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_4IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_41IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_44IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_47IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_50IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_53IncomingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet()
+ .getResources());
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingTypeModelFacetLinks_Message_50(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getInteraction_2OutgoingLinks(final View view) {
+ final Interaction modelElement = (Interaction) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_19OutgoingLinks(final View view) {
+ final Lifeline modelElement = (Lifeline) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_20OutgoingLinks(final View view) {
+ final Lifeline modelElement = (Lifeline) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getStateInvariant_11OutgoingLinks(final View view) {
+ final StateInvariant modelElement = (StateInvariant) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getStateInvariant_28OutgoingLinks(final View view) {
+ final StateInvariant modelElement = (StateInvariant) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getOccurrenceSpecification_12OutgoingLinks(final View view) {
+ final OccurrenceSpecification modelElement = (OccurrenceSpecification) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessageOccurrenceSpecification_13OutgoingLinks(final View view) {
+ final MessageOccurrenceSpecification modelElement = (MessageOccurrenceSpecification) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_3(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_4(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_41(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_44(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_47(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_50(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getTimeConstraint_15OutgoingLinks(final View view) {
+ final TimeConstraint modelElement = (TimeConstraint) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getTimeObservation_16OutgoingLinks(final View view) {
+ final TimeObservation modelElement = (TimeObservation) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDurationConstraint_18OutgoingLinks(final View view) {
+ final DurationConstraint modelElement = (DurationConstraint) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDurationObservation_17OutgoingLinks(final View view) {
+ final DurationObservation modelElement = (DurationObservation) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getGeneralOrdering_67OutgoingLinks(final View view) {
+ final GeneralOrdering modelElement = (GeneralOrdering) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getDestructionOccurrenceSpecification_27OutgoingLinks(final View view) {
+ final DestructionOccurrenceSpecification modelElement = (DestructionOccurrenceSpecification) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_3(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_4(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_41(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_44(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_47(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_50(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getLifeline_40OutgoingLinks(final View view) {
+ final Lifeline modelElement = (Lifeline) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getGate_69OutgoingLinks(final View view) {
+ final Gate modelElement = (Gate) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_3(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_4(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_41(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_44(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_47(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_50(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_3OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_4OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_41OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_44OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_47OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_50OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List<UMLLinkDescriptor> getMessage_53OutgoingLinks(final View view) {
+ final Message modelElement = (Message) view.getElement();
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Message_53(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_3(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageSyncEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_3, MessageSyncEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_4(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageAsyncEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_4, MessageAsyncEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_41(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageReplyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_41, MessageReplyEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_44(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageCreateEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_44, MessageCreateEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_47(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageDeleteEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_47, MessageDeleteEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_50(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageLostEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final Element dst = link.getOwner();
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_50, MessageLostEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Message_53(final Interaction container) {
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageFoundEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final Element src = link.getOwner();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_53, MessageFoundEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_3(final MessageEnd target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getMessage_SendEvent() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageSyncEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_3, MessageSyncEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_4(final MessageEnd target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getMessage_SendEvent() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageAsyncEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_4, MessageAsyncEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_41(final MessageEnd target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getMessage_SendEvent() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageReplyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_41, MessageReplyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_44(final MessageEnd target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getMessage_SendEvent() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageCreateEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_44, MessageCreateEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_47(final MessageEnd target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getMessage_SendEvent() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageDeleteEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_47, MessageDeleteEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_50(final Element target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getElement_Owner() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageLostEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final MessageEnd src = link.getReceiveEvent();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_50, MessageLostEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Message_53(final MessageEnd target,
+ final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
+ final LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ final Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
+ for (final EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getMessage_SendEvent() || false == setting.getEObject() instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) setting.getEObject();
+ if (MessageFoundEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ final Element src = link.getOwner();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Message_53, MessageFoundEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_3(final MessageEnd source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageSyncEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_3, MessageSyncEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_4(final MessageEnd source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageAsyncEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_4, MessageAsyncEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_41(final MessageEnd source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageReplyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_41, MessageReplyEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_44(final MessageEnd source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageCreateEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_44, MessageCreateEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_47(final MessageEnd source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageDeleteEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final MessageEnd src = link.getReceiveEvent();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_47, MessageDeleteEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_50(final MessageEnd source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageLostEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final Element dst = link.getOwner();
+ final MessageEnd src = link.getReceiveEvent();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_50, MessageLostEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Message_53(final Element source) {
+ Interaction container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null && container == null; element = element.eContainer()) {
+ if (element instanceof Interaction) {
+ container = (Interaction) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ final Collection result = new LinkedList();
+ for (final Object element : container.getMessages()) {
+ final EObject linkObject = (EObject) element;
+ if (false == linkObject instanceof Message) {
+ continue;
+ }
+ final Message link = (Message) linkObject;
+ if (MessageFoundEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+
+ final MessageEnd dst = link.getSendEvent();
+ final Element src = link.getOwner();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Message_53, MessageFoundEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static final DiagramUpdater TYPED_INSTANCE = new DiagramUpdater() {
+ /**
+ * @generated
+ */
+
+ public List<UMLNodeDescriptor> getSemanticChildren(final View view) {
+ return UMLDiagramUpdater.getSemanticChildren(view);
+ }
+
+ /**
+ * @generated
+ */
+
+ public List<UMLLinkDescriptor> getContainedLinks(final View view) {
+ return UMLDiagramUpdater.getContainedLinks(view);
+ }
+
+ /**
+ * @generated
+ */
+
+ public List<UMLLinkDescriptor> getIncomingLinks(final View view) {
+ return UMLDiagramUpdater.getIncomingLinks(view);
+ }
+
+ /**
+ * @generated
+ */
+
+ public List<UMLLinkDescriptor> getOutgoingLinks(final View view) {
+ return UMLDiagramUpdater.getOutgoingLinks(view);
+ }
+ };
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java
new file mode 100644
index 00000000000..296437195bd
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java
@@ -0,0 +1,1020 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.MultiRule;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLDocumentProvider extends AbstractDocumentProvider implements IDiagramDocumentProvider {
+
+ /**
+ * @generated
+ */
+ @Override
+ protected ElementInfo createElementInfo(final Object element) throws CoreException {
+ if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ final IEditorInput editorInput = (IEditorInput) element;
+ final IDiagramDocument document = (IDiagramDocument) createDocument(editorInput);
+
+ final ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
+ info.setModificationStamp(computeModificationStamp(info));
+ info.fStatus = null;
+ return info;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IDocument createDocument(final Object element) throws CoreException {
+ if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ final IDocument document = createEmptyDocument();
+ setDocumentContent(document, (IEditorInput) element);
+ setupDocument(element, document);
+ return document;
+ }
+
+ /**
+ * Sets up the given document as it would be provided for the given element. The content of the document is not
+ * changed. This default implementation is empty. Subclasses may reimplement.
+ *
+ * @param element
+ * the blue-print element
+ * @param document
+ * the document to set up
+ * @generated
+ */
+ protected void setupDocument(final Object element, final IDocument document) {
+ // for subclasses
+ }
+
+ /**
+ * @generated
+ */
+ private long computeModificationStamp(final ResourceSetInfo info) {
+ int result = 0;
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ if (file.getLocation() != null) {
+ result += file.getLocation().toFile().lastModified();
+ } else {
+ result += file.getModificationStamp();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IDocument createEmptyDocument() {
+ final DiagramDocument document = new DiagramDocument();
+ document.setEditingDomain(createEditingDomain());
+ return document;
+ }
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain createEditingDomain() {
+ final TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
+ editingDomain.setID("org.eclipse.papyrus.uml.diagram.timing.EditingDomain"); //$NON-NLS-1$
+ final NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createNotifierFilter(editingDomain.getResourceSet())
+ .and(NotificationFilter.createEventTypeFilter(Notification.ADD))
+ .and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES));
+ editingDomain.getResourceSet().eAdapters().add(new Adapter() {
+
+ private Notifier myTarger;
+
+ public Notifier getTarget() {
+ return this.myTarger;
+ }
+
+ public boolean isAdapterForType(final Object type) {
+ return false;
+ }
+
+ public void notifyChanged(final Notification notification) {
+ if (diagramResourceModifiedFilter.matches(notification)) {
+ final Object value = notification.getNewValue();
+ if (value instanceof Resource) {
+ ((Resource) value).setTrackingModification(true);
+ }
+ }
+ }
+
+ public void setTarget(final Notifier newTarget) {
+ this.myTarger = newTarget;
+ }
+
+ });
+
+ return editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentContent(final IDocument document, final IEditorInput element) throws CoreException {
+ final IDiagramDocument diagramDocument = (IDiagramDocument) document;
+ final TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
+ if (element instanceof FileEditorInput) {
+ final IStorage storage = ((FileEditorInput) element).getStorage();
+ final Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
+ document.setContent(diagram);
+ } else if (element instanceof URIEditorInput) {
+ final URI uri = ((URIEditorInput) element).getURI();
+ Resource resource = null;
+ try {
+ resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
+ if (resource == null) {
+ resource = domain.getResourceSet().createResource(uri.trimFragment());
+ }
+ if (!resource.isLoaded()) {
+ try {
+ final Map options = new HashMap(GMFResourceFactory.getDefaultLoadOptions());
+ // @see 171060
+ // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE,
+ // Boolean.TRUE);
+ resource.load(options);
+ } catch (final IOException e) {
+ resource.unload();
+ throw e;
+ }
+ }
+ if (uri.fragment() != null) {
+ final EObject rootElement = resource.getEObject(uri.fragment());
+ if (rootElement instanceof Diagram) {
+ document.setContent(rootElement);
+ return;
+ }
+ } else {
+ for (final Object rootElement : resource.getContents()) {
+ if (rootElement instanceof Diagram) {
+ document.setContent(rootElement);
+ return;
+ }
+ }
+ }
+ throw new RuntimeException(Messages.UMLDocumentProvider_NoDiagramInResourceError);
+ } catch (final Exception e) {
+ CoreException thrownExcp = null;
+ if (e instanceof CoreException) {
+ thrownExcp = (CoreException) e;
+ } else {
+ final String msg = e.getLocalizedMessage();
+ thrownExcp = new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, msg != null ? msg
+ : Messages.UMLDocumentProvider_DiagramLoadingError, e));
+ }
+ throw thrownExcp;
+ }
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public long getModificationStamp(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return computeModificationStamp(info);
+ }
+ return super.getModificationStamp(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isDeleted(final Object element) {
+ final IDiagramDocument document = getDiagramDocument(element);
+ if (document != null) {
+ final Resource diagramResource = document.getDiagram().eResource();
+ if (diagramResource != null) {
+ final IFile file = WorkspaceSynchronizer.getFile(diagramResource);
+ return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
+ }
+ }
+ return super.isDeleted(element);
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSetInfo getResourceSetInfo(final Object editorInput) {
+ return (ResourceSetInfo) super.getElementInfo(editorInput);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void disposeElementInfo(final Object element, final ElementInfo info) {
+ if (info instanceof ResourceSetInfo) {
+ final ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
+ resourceSetInfo.dispose();
+ }
+ super.disposeElementInfo(element, info);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doValidateState(final Object element, final Object computationContext) throws CoreException {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ final LinkedList<IFile> files2Validate = new LinkedList<IFile>();
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ files2Validate.add(file);
+ }
+ }
+ ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
+ }
+
+ super.doValidateState(element, computationContext);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isReadOnly(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (final CoreException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_isModifiable, ex);
+ // Error message to log was initially taken from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+ }
+ return info.isReadOnly();
+ }
+ return super.isReadOnly(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isModifiable(final Object element) {
+ if (!isStateValidated(element)) {
+ if (element instanceof FileEditorInput || element instanceof URIEditorInput) {
+ return true;
+ }
+ }
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (final CoreException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_isModifiable, ex);
+ // Error message to log was initially taken from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+ }
+ return info.isModifiable();
+ }
+ return super.isModifiable(element);
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateCache(final Object element) throws CoreException {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ info.setReadOnly(true);
+ info.setModifiable(false);
+ return;
+ }
+ }
+ info.setReadOnly(false);
+ info.setModifiable(true);
+ return;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doUpdateStateCache(final Object element) throws CoreException {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ info.setUpdateCache(true);
+ }
+ super.doUpdateStateCache(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isSynchronized(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return info.isSynchronized();
+ }
+ return super.isSynchronized(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected ISchedulingRule getResetRule(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ final LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
+ }
+ }
+ return new MultiRule(rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected ISchedulingRule getSaveRule(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ final LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(computeSchedulingRule(file));
+ }
+ }
+ return new MultiRule(rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected ISchedulingRule getSynchronizeRule(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ final LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
+ }
+ }
+ return new MultiRule(rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected ISchedulingRule getValidateStateRule(final Object element) {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ final LinkedList<ISchedulingRule> files = new LinkedList<ISchedulingRule>();
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ final IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ files.add(file);
+ }
+ }
+ return ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule(files.toArray(new IFile[files.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) {
+ if (toCreateOrModify.exists()) {
+ return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
+ }
+
+ IResource parent = toCreateOrModify;
+ do {
+ /*
+ * XXX This is a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
+ * IResourceRuleFactory.createRule should iterate the hierarchy itself.
+ */
+ toCreateOrModify = parent;
+ parent = toCreateOrModify.getParent();
+ } while (parent != null && !parent.exists());
+
+ return ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doSynchronize(final Object element, final IProgressMonitor monitor) throws CoreException {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ handleElementChanged(info, nextResource, monitor);
+ }
+ return;
+ }
+ super.doSynchronize(element, monitor);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doSaveDocument(final IProgressMonitor monitor, final Object element, final IDocument document, final boolean overwrite) throws CoreException {
+ final ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (!overwrite && !info.isSynchronized()) {
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL,
+ Messages.UMLDocumentProvider_UnsynchronizedFileSaveError, null));
+ }
+ info.stopResourceListening();
+ fireElementStateChanging(element);
+ try {
+ monitor.beginTask(Messages.UMLDocumentProvider_SaveDiagramTask, info.getResourceSet().getResources().size() + 1); // "Saving diagram"
+ for (final Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource nextResource = it.next();
+ monitor.setTaskName(NLS.bind(Messages.UMLDocumentProvider_SaveNextResourceTask, nextResource.getURI()));
+ if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
+ try {
+ nextResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ } catch (final IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, EditorStatusCodes.RESOURCE_FAILURE,
+ e.getLocalizedMessage(), null));
+ }
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ info.setModificationStamp(computeModificationStamp(info));
+ } catch (final RuntimeException x) {
+ fireElementStateChangeFailed(element);
+ throw x;
+ } finally {
+ info.startResourceListening();
+ }
+ } else {
+ URI newResoruceURI;
+ List<IFile> affectedFiles = null;
+ if (element instanceof FileEditorInput) {
+ final IFile newFile = ((FileEditorInput) element).getFile();
+ affectedFiles = Collections.singletonList(newFile);
+ newResoruceURI = URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
+ } else if (element instanceof URIEditorInput) {
+ newResoruceURI = ((URIEditorInput) element).getURI();
+ } else {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ if (false == document instanceof IDiagramDocument) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(
+ new Status(
+ IStatus.ERROR,
+ UMLDiagramEditorPlugin.ID,
+ 0,
+ "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ final IDiagramDocument diagramDocument = (IDiagramDocument) document;
+ final Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
+ final Diagram diagramCopy = EcoreUtil.copy(diagramDocument.getDiagram());
+ try {
+ new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation,
+ diagramCopy.getName()), affectedFiles) {
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ newResource.getContents().add(diagramCopy);
+ return CommandResult.newOKCommandResult();
+ }
+ }.execute(monitor, null);
+ newResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ } catch (final ExecutionException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
+ } catch (final IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
+ }
+ newResource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleElementChanged(final ResourceSetInfo info, final Resource changedResource, final IProgressMonitor monitor) {
+ final IFile file = WorkspaceSynchronizer.getFile(changedResource);
+ if (file != null) {
+ try {
+ file.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (final CoreException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError(Messages.UMLDocumentProvider_handleElementContentChanged, ex);
+ // Error message to log was initially taken from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged
+ }
+ }
+ changedResource.unload();
+
+ fireElementContentAboutToBeReplaced(info.getEditorInput());
+ removeUnchangedElementListeners(info.getEditorInput(), info);
+ info.fStatus = null;
+ try {
+ setDocumentContent(info.fDocument, info.getEditorInput());
+ } catch (final CoreException e) {
+ info.fStatus = e.getStatus();
+ }
+ if (!info.fCanBeSaved) {
+ info.setModificationStamp(computeModificationStamp(info));
+ }
+ addUnchangedElementListeners(info.getEditorInput(), info);
+ fireElementContentReplaced(info.getEditorInput());
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleElementMoved(final IEditorInput input, final URI uri) {
+ if (input instanceof FileEditorInput) {
+ final IFile newFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(URI.decode(uri.path())).removeFirstSegments(1));
+ fireElementMoved(input, newFile == null ? null : new FileEditorInput(newFile));
+ return;
+ }
+ // TODO: append suffix to the URI! (use diagram as a parameter)
+ fireElementMoved(input, new URIEditorInput(uri));
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput createInputWithEditingDomain(final IEditorInput editorInput, final TransactionalEditingDomain domain) {
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IDiagramDocument getDiagramDocument(final Object element) {
+ final IDocument doc = getDocument(element);
+ if (doc instanceof IDiagramDocument) {
+ return (IDiagramDocument) doc;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IRunnableContext getOperationRunner(final IProgressMonitor monitor) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected class ResourceSetInfo extends ElementInfo {
+
+ /**
+ * @generated
+ */
+ private long myModificationStamp = IResource.NULL_STAMP;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer mySynchronizer;
+
+ /**
+ * @generated
+ */
+ private final LinkedList<Resource> myUnSynchronizedResources = new LinkedList<Resource>();
+
+ /**
+ * @generated
+ */
+ private final IDiagramDocument myDocument;
+
+ /**
+ * @generated
+ */
+ private final IEditorInput myEditorInput;
+
+ /**
+ * @generated
+ */
+ private boolean myUpdateCache = true;
+
+ /**
+ * @generated
+ */
+ private boolean myModifiable = false;
+
+ /**
+ * @generated
+ */
+ private boolean myReadOnly = true;
+
+ /**
+ * @generated
+ */
+ private final ResourceSetModificationListener myResourceSetListener;
+
+ /**
+ * @generated
+ */
+ public ResourceSetInfo(final IDiagramDocument document, final IEditorInput editorInput) {
+ super(document);
+ this.myDocument = document;
+ this.myEditorInput = editorInput;
+ startResourceListening();
+ this.myResourceSetListener = new ResourceSetModificationListener(this);
+ getResourceSet().eAdapters().add(this.myResourceSetListener);
+ }
+
+ /**
+ * @generated
+ */
+ public long getModificationStamp() {
+ return this.myModificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModificationStamp(final long modificationStamp) {
+ this.myModificationStamp = modificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ return this.myDocument.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSet getResourceSet() {
+ return getEditingDomain().getResourceSet();
+ }
+
+ /**
+ * @generated
+ */
+ public Iterator<Resource> getLoadedResourcesIterator() {
+ return new ArrayList<Resource>(getResourceSet().getResources()).iterator();
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput getEditorInput() {
+ return this.myEditorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ stopResourceListening();
+ getResourceSet().eAdapters().remove(this.myResourceSetListener);
+ for (final Iterator<Resource> it = getLoadedResourcesIterator(); it.hasNext();) {
+ final Resource resource = it.next();
+ resource.unload();
+ }
+ getEditingDomain().dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSynchronized() {
+ return this.myUnSynchronizedResources.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUnSynchronized(final Resource resource) {
+ this.myUnSynchronizedResources.add(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public void setSynchronized(final Resource resource) {
+ this.myUnSynchronizedResources.remove(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public final void stopResourceListening() {
+ this.mySynchronizer.dispose();
+ this.mySynchronizer = null;
+ }
+
+ /**
+ * @generated
+ */
+ public final void startResourceListening() {
+ this.mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isUpdateCache() {
+ return this.myUpdateCache;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUpdateCache(final boolean update) {
+ this.myUpdateCache = update;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isModifiable() {
+ return this.myModifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModifiable(final boolean modifiable) {
+ this.myModifiable = modifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isReadOnly() {
+ return this.myReadOnly;
+ }
+
+ /**
+ * @generated
+ */
+ public void setReadOnly(final boolean readOnly) {
+ this.myReadOnly = readOnly;
+ }
+
+ /**
+ * @generated
+ */
+ private class SynchronizerDelegate implements WorkspaceSynchronizer.Delegate {
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceChanged(final Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ handleElementChanged(ResourceSetInfo.this, resource, null);
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceDeleted(final Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ fireElementDeleted(getEditorInput());
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceMoved(final Resource resource, final URI newURI) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ setUnSynchronized(resource);
+ return true;
+ }
+ }
+ if (ResourceSetInfo.this.myDocument.getDiagram().eResource() == resource) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ handleElementMoved(getEditorInput(), newURI);
+ }
+ });
+ } else {
+ handleResourceDeleted(resource);
+ }
+ return true;
+ }
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ResourceSetModificationListener extends EContentAdapter {
+
+ /**
+ * @generated
+ */
+ private final NotificationFilter myModifiedFilter;
+
+ /**
+ * @generated
+ */
+ private final ResourceSetInfo myInfo;
+
+ /**
+ * @generated
+ */
+ public ResourceSetModificationListener(final ResourceSetInfo info) {
+ this.myInfo = info;
+ this.myModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET).or(NotificationFilter.createEventTypeFilter(Notification.UNSET))
+ .and(NotificationFilter.createFeatureFilter(Resource.class, Resource.RESOURCE__IS_MODIFIED));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void notifyChanged(final Notification notification) {
+ if (notification.getNotifier() instanceof ResourceSet) {
+ super.notifyChanged(notification);
+ }
+ if (!notification.isTouch() && this.myModifiedFilter.matches(notification)) {
+ if (notification.getNotifier() instanceof Resource) {
+ final Resource resource = (Resource) notification.getNotifier();
+ if (resource.isLoaded()) {
+ boolean modified = false;
+ for (final Iterator/* <org.eclipse.emf.ecore.resource.Resource> */it = this.myInfo.getLoadedResourcesIterator(); it.hasNext()
+ && !modified;) {
+ final Resource nextResource = (Resource) it.next();
+ if (nextResource.isLoaded()) {
+ modified = nextResource.isModified();
+ }
+ }
+ boolean dirtyStateChanged = false;
+ synchronized (this.myInfo) {
+ if (modified != this.myInfo.fCanBeSaved) {
+ this.myInfo.fCanBeSaved = modified;
+ dirtyStateChanged = true;
+ }
+ if (!resource.isModified()) {
+ this.myInfo.setSynchronized(resource);
+ }
+ }
+ if (dirtyStateChanged) {
+ fireElementDirtyStateChanged(this.myInfo.getEditorInput(), modified);
+
+ if (!modified) {
+ this.myInfo.setModificationStamp(computeModificationStamp(this.myInfo));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java
new file mode 100644
index 00000000000..43f72c05c8b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLInitDiagramFileAction implements IObjectActionDelegate {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart targetPart;
+
+ /**
+ * @generated
+ */
+ private URI domainModelURI;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(final IAction action, final IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(final IAction action, final ISelection selection) {
+ this.domainModelURI = null;
+ action.setEnabled(false);
+ if (selection instanceof IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ final IFile file = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ this.domainModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ action.setEnabled(true);
+ }
+
+ /**
+ * @generated
+ */
+ private Shell getShell() {
+ return this.targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(final IAction action) {
+ final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ final ResourceSet resourceSet = editingDomain.getResourceSet();
+ EObject diagramRoot = null;
+ try {
+ final Resource resource = resourceSet.getResource(this.domainModelURI, true);
+ diagramRoot = resource.getContents().get(0);
+ } catch (final WrappedException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + this.domainModelURI, ex); //$NON-NLS-1$
+ }
+ if (diagramRoot == null) {
+ MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage);
+ return;
+ }
+ final Wizard wizard = new UMLNewDiagramFileWizard(this.domainModelURI, diagramRoot, editingDomain);
+ wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, TimingDiagramEditPart.MODEL_ID));
+ UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.java
new file mode 100644
index 00000000000..6af06084d2d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.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.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLLinkDescriptor extends UpdaterLinkDescriptor {
+ /**
+ * @generated
+ */
+ public UMLLinkDescriptor(final EObject source, final EObject destination, final IElementType elementType, final int linkVID) {
+ super(source, destination, elementType, linkVID);
+ }
+
+ /**
+ * @generated
+ */
+ public UMLLinkDescriptor(final EObject source, final EObject destination, final EObject linkElement, final IElementType elementType, final int linkVID) {
+ super(source, destination, linkElement, elementType, linkVID);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.java
new file mode 100644
index 00000000000..4644433966c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.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.part;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLMatchingStrategy implements IEditorMatchingStrategy {
+
+ /**
+ * @generated
+ */
+ public boolean matches(final IEditorReference editorRef, final IEditorInput input) {
+ IEditorInput editorInput;
+ try {
+ editorInput = editorRef.getEditorInput();
+ } catch (final PartInitException e) {
+ return false;
+ }
+
+ if (editorInput.equals(input)) {
+ return true;
+ }
+ if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
+ return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
+ }
+ return false;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java
new file mode 100644
index 00000000000..ba863699768
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.io.IOException;
+import java.util.LinkedList;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNewDiagramFileWizard extends Wizard {
+
+ /**
+ * @generated
+ */
+ private final WizardNewFileCreationPage myFileCreationPage;
+
+ /**
+ * @generated
+ */
+ private final ModelElementSelectionPage diagramRootElementSelectionPage;
+
+ /**
+ * @generated
+ */
+ private final TransactionalEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ public UMLNewDiagramFileWizard(final URI domainModelURI, final EObject diagramRoot, final TransactionalEditingDomain editingDomain) {
+ assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$
+ assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$
+ assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$
+
+ this.myFileCreationPage = new WizardNewFileCreationPage(Messages.UMLNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
+ this.myFileCreationPage.setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle);
+ this.myFileCreationPage.setDescription(NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, TimingDiagramEditPart.MODEL_ID));
+ IPath filePath;
+ final String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment());
+ if (domainModelURI.isPlatformResource()) {
+ filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true));
+ } else if (domainModelURI.isFile()) {
+ filePath = new Path(domainModelURI.trimSegments(1).toFileString());
+ } else {
+ // TODO : use some default path
+ throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
+ }
+ this.myFileCreationPage.setContainerFullPath(filePath);
+ this.myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLTiming_diagram")); //$NON-NLS-1$
+
+ this.diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.UMLNewDiagramFileWizard_RootSelectionPageName);
+ this.diagramRootElementSelectionPage.setTitle(Messages.UMLNewDiagramFileWizard_RootSelectionPageTitle);
+ this.diagramRootElementSelectionPage.setDescription(Messages.UMLNewDiagramFileWizard_RootSelectionPageDescription);
+ this.diagramRootElementSelectionPage.setModelElement(diagramRoot);
+
+ this.myEditingDomain = editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void addPages() {
+ addPage(this.myFileCreationPage);
+ addPage(this.diagramRootElementSelectionPage);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ final LinkedList<IFile> affectedFiles = new LinkedList<IFile>();
+ final IFile diagramFile = this.myFileCreationPage.createNewFile();
+ UMLDiagramEditorUtil.setCharset(diagramFile);
+ affectedFiles.add(diagramFile);
+ final URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+ final ResourceSet resourceSet = this.myEditingDomain.getResourceSet();
+ final Resource diagramResource = resourceSet.createResource(diagramModelURI);
+ final AbstractTransactionalCommand command = new AbstractTransactionalCommand(this.myEditingDomain,
+ Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final int diagramVID = UMLVisualIDRegistry.getDiagramVisualID(UMLNewDiagramFileWizard.this.diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID != TimingDiagramEditPart.VISUAL_ID) {
+ return CommandResult.newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError);
+ }
+ final Diagram diagram = ViewService.createDiagram(UMLNewDiagramFileWizard.this.diagramRootElementSelectionPage.getModelElement(),
+ TimingDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ diagramResource.getContents().add(diagram);
+ new UMLDiagramContentInitializer().initDiagramContent(diagram);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
+ diagramResource.save(UMLDiagramEditorUtil.getSaveOptions());
+ UMLDiagramEditorUtil.openDiagram(diagramResource);
+ } catch (final ExecutionException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ } catch (final IOException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
+ } catch (final PartInitException ex) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to open editor", ex); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private static class DiagramRootElementSelectionPage extends ModelElementSelectionPage {
+
+ /**
+ * @generated
+ */
+ protected DiagramRootElementSelectionPage(final String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSelectionTitle() {
+ return Messages.UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean validatePage() {
+ if (this.selectedModelElement == null) {
+ setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
+ return false;
+ }
+ final boolean result = ViewService.getInstance().provides(
+ new CreateDiagramViewOperation(new EObjectAdapter(this.selectedModelElement), TimingDiagramEditPart.MODEL_ID,
+ UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
+ return result;
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java
new file mode 100644
index 00000000000..86300f18a2a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.tooling.runtime.update.UpdaterNodeDescriptor;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLNodeDescriptor extends UpdaterNodeDescriptor {
+ /**
+ * @generated
+ */
+ public UMLNodeDescriptor(final EObject modelElement, final int visualID) {
+ super(modelElement, visualID);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java
new file mode 100644
index 00000000000..fd10e7d2098
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.Tool;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLPaletteFactory extends PaletteFactory.Adapter {
+
+ /**
+ * @generated
+ */
+ private final static String CREATEINTERACTIONCREATIONTOOL = "createInteractionCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATELIFELINECREATIONTOOL = "createLifelineCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATESTATEDEFINITIONCREATIONTOOL = "createStateDefinitionCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATETIMEOBSERVATIONCREATIONTOOL = "createTimeObservationCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATETIMECONSTRAINTCREATIONTOOL = "createTimeConstraintCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEDURATIONOBSERVATIONCREATIONTOOL = "createDurationObservationCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEDURATIONCONSTRAINTCREATIONTOOL = "createDurationConstraintCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEOCCURRENCESPECIFICATIONCREATIONTOOL = "createOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL = "createDestructionOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEGATECREATIONTOOL = "createGateCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEGENERALORDERINGCREATIONTOOL = "createGeneralOrderingCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEMESSAGESYNCCREATIONTOOL = "createMessageSyncCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEMESSAGEASYNCCREATIONTOOL = "createMessageAsyncCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEMESSAGEREPLYCREATIONTOOL = "createMessageReplyCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATECREATEMESSAGECREATIONTOOL = "createCreateMessageCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEDELETEMESSAGECREATIONTOOL = "createDeleteMessageCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATELOSTMESSAGECREATIONTOOL = "createLostMessageCreationTool"; //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ private final static String CREATEFOUNDMESSAGECREATIONTOOL = "createFoundMessageCreationTool"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public UMLPaletteFactory() {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Tool createTool(final String toolId) {
+ if (toolId.equals(CREATEINTERACTIONCREATIONTOOL)) {
+ return createInteractionCreationTool();
+ }
+ if (toolId.equals(CREATELIFELINECREATIONTOOL)) {
+ return createLifelineCreationTool();
+ }
+ if (toolId.equals(CREATESTATEDEFINITIONCREATIONTOOL)) {
+ return createStateDefinitionCreationTool();
+ }
+ if (toolId.equals(CREATETIMEOBSERVATIONCREATIONTOOL)) {
+ return createTimeObservationCreationTool();
+ }
+ if (toolId.equals(CREATETIMECONSTRAINTCREATIONTOOL)) {
+ return createTimeConstraintCreationTool();
+ }
+ if (toolId.equals(CREATEDURATIONOBSERVATIONCREATIONTOOL)) {
+ return createDurationObservationCreationTool();
+ }
+ if (toolId.equals(CREATEDURATIONCONSTRAINTCREATIONTOOL)) {
+ return createDurationConstraintCreationTool();
+ }
+ if (toolId.equals(CREATEOCCURRENCESPECIFICATIONCREATIONTOOL)) {
+ return createOccurrenceSpecificationCreationTool();
+ }
+ if (toolId.equals(CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL)) {
+ return createDestructionOccurrenceSpecificationCreationTool();
+ }
+ if (toolId.equals(CREATEGATECREATIONTOOL)) {
+ return createGateCreationTool();
+ }
+ if (toolId.equals(CREATEGENERALORDERINGCREATIONTOOL)) {
+ return createGeneralOrderingCreationTool();
+ }
+ if (toolId.equals(CREATEMESSAGESYNCCREATIONTOOL)) {
+ return createMessageSyncCreationTool();
+ }
+ if (toolId.equals(CREATEMESSAGEASYNCCREATIONTOOL)) {
+ return createMessageAsyncCreationTool();
+ }
+ if (toolId.equals(CREATEMESSAGEREPLYCREATIONTOOL)) {
+ return createMessageReplyCreationTool();
+ }
+ if (toolId.equals(CREATECREATEMESSAGECREATIONTOOL)) {
+ return createCreateMessageCreationTool();
+ }
+ if (toolId.equals(CREATEDELETEMESSAGECREATIONTOOL)) {
+ return createDeleteMessageCreationTool();
+ }
+ if (toolId.equals(CREATELOSTMESSAGECREATIONTOOL)) {
+ return createLostMessageCreationTool();
+ }
+ if (toolId.equals(CREATEFOUNDMESSAGECREATIONTOOL)) {
+ return createFoundMessageCreationTool();
+ }
+
+ // default return: null
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getTemplate(final String templateId) {
+
+ // default return: null
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createInteractionCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Interaction_2);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createLifelineCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createStateDefinitionCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Node_9);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createTimeObservationCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.TimeObservation_16);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createTimeConstraintCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.TimeConstraint_15);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDurationObservationCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.DurationObservation_17);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDurationConstraintCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.DurationConstraint_18);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createOccurrenceSpecificationCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDestructionOccurrenceSpecificationCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createGateCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Gate_69);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createGeneralOrderingCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+
+ final Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createMessageSyncCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_3);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createMessageAsyncCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_4);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createMessageReplyCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_41);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createCreateMessageCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_44);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDeleteMessageCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_47);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createLostMessageCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_50);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createFoundMessageCreationTool() {
+ final List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Message_53);
+
+ final Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.java
new file mode 100644
index 00000000000..fcb48c44a93
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.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.part;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.common.ui.URIEditorInput;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLUriEditorInputTester extends PropertyTester {
+
+ /**
+ * @generated
+ */
+ public boolean test(final Object receiver, final String method, final Object[] args, final Object expectedValue) {
+ if (false == receiver instanceof URIEditorInput) {
+ return false;
+ }
+ final URIEditorInput editorInput = (URIEditorInput) receiver;
+ return "PapyrusUMLTiming_diagram".equals(editorInput.getURI().fileExtension()); //$NON-NLS-1$
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java
new file mode 100644
index 00000000000..38216479cbf
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java
@@ -0,0 +1,900 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.structure.DiagramStructure;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
+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.CompactLifelineNameEditPart;
+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.DestructionOccurrenceSpecificationAppliedStereotypeEditPart;
+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.DurationConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationNameEditPart;
+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.FullLifelineNameEditPart;
+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.FullStateInvariantAppliedStereotypeEditPart;
+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.GateLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingNameEditPart;
+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.InteractionNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimeRulerCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimingRulerEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationAppliedStereotypeEditPart;
+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.MessageReplyAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationAppliedStereotypeEditPart;
+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.StateInvariantAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationNameEditPart;
+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.expressions.UMLOCLFactory;
+import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This registry is used to determine which type of visual object should be created for the corresponding Diagram, Node,
+ * ChildNode or Link represented by a domain model object.
+ *
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLVisualIDRegistry {
+
+ /**
+ * @generated
+ */
+ private static final String DEBUG_KEY = "org.eclipse.papyrus.uml.diagram.timing/debug/visualID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(final View view) {
+ if (view instanceof Diagram) {
+ if (TimingDiagramEditPart.MODEL_ID.equals(view.getType())) {
+ return TimingDiagramEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getVisualID(view.getType());
+ }
+
+ /**
+ * @generated
+ */
+ public static String getModelID(View view) {
+ final View diagram = view.getDiagram();
+ while (view != diagram) {
+ final EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return annotation.getDetails().get("modelID"); //$NON-NLS-1$
+ }
+ view = (View) view.eContainer();
+ }
+ return diagram != null ? diagram.getType() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(final String type) {
+ try {
+ return Integer.parseInt(type);
+ } catch (final NumberFormatException e) {
+ if (Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption(DEBUG_KEY))) {
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to parse view type as a visualID number: " + type);
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static String getType(final int visualID) {
+ return Integer.toString(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ public static int getDiagramVisualID(final EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package) domainElement)) {
+ return TimingDiagramEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getNodeVisualID(final View containerView, final EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ final String containerModelID = org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getModelID(containerView);
+ if (!TimingDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ return -1;
+ }
+ int containerVisualID;
+ if (TimingDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = TimingDiagramEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ switch (containerVisualID) {
+ case TimingDiagramEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getInteraction().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return InteractionEditPartTN.VISUAL_ID;
+ }
+ break;
+ case InteractionEditPartTN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getGate().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return GateEditPart.VISUAL_ID;
+ }
+ break;
+ case InteractionCompartmentEditPartTN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf(domainElement.eClass()) && isLifeline_19(containerView, (Lifeline) domainElement)) {
+ return FullLifelineEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getLifeline().isSuperTypeOf(domainElement.eClass()) && isLifeline_20(containerView, (Lifeline) domainElement)) {
+ return CompactLifelineEditPartCN.VISUAL_ID;
+ }
+ break;
+ case FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getStateInvariant().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return FullStateInvariantEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getOccurrenceSpecification().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return OccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessageOccurrenceSpecification().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return MessageOccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDurationConstraint().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return DurationConstraintEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDurationObservation().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return DurationObservationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getTimeConstraint().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return TimeConstraintEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getTimeObservation().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return TimeObservationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getGeneralOrdering().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return GeneralOrderingEditPart.VISUAL_ID;
+ }
+ break;
+ case CompactLifelineCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getStateInvariant().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return CompactStateInvariantEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getOccurrenceSpecification().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return OccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessageOccurrenceSpecification().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return MessageOccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDurationConstraint().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return DurationConstraintEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDurationObservation().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return DurationObservationEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getTimeConstraint().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return TimeConstraintEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getTimeObservation().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return TimeObservationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getGeneralOrdering().isSuperTypeOf(domainElement.eClass())
+
+ ) {
+ return GeneralOrderingEditPart.VISUAL_ID;
+ }
+ break;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateNode(final View containerView, final int nodeVisualID) {
+ final String containerModelID = org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getModelID(containerView);
+ if (!TimingDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ return false;
+ }
+ int containerVisualID;
+ if (TimingDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = TimingDiagramEditPart.VISUAL_ID;
+ } else {
+ return false;
+ }
+ }
+ switch (containerVisualID) {
+ case TimingDiagramEditPart.VISUAL_ID:
+ if (InteractionEditPartTN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InteractionEditPartTN.VISUAL_ID:
+ if (InteractionNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (InteractionCompartmentEditPartTN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeRulerCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (GateEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FullLifelineEditPartCN.VISUAL_ID:
+ if (FullLifelineNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ if (CompactLifelineNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CompactLifelineCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ if (FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ if (CompactStateInvariantNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (StateInvariantAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ if (OccurrenceSpecificationLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ if (MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case StateDefinitionEditPart.VISUAL_ID:
+ if (StateDefinitionLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case TimeConstraintEditPart.VISUAL_ID:
+ if (TimeConstraintSpecificationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeConstraintAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case TimeObservationEditPart.VISUAL_ID:
+ if (TimeObservationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeObservationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ if (DurationConstraintSpecificationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DurationObservationEditPartCN.VISUAL_ID:
+ if (DurationObservationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case GeneralOrderingEditPart.VISUAL_ID:
+ if (GeneralOrderingNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FreeTimingRulerEditPartCN.VISUAL_ID:
+ if (FreeTimeRulerCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case LinearTimingRulerEditPartCN.VISUAL_ID:
+ if (LinearTimeRulerCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case TickEditPart.VISUAL_ID:
+ if (TickNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ if (DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case GateEditPart.VISUAL_ID:
+ if (GateLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case InteractionCompartmentEditPartTN.VISUAL_ID:
+ if (FullLifelineEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CompactLifelineEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID:
+ if (StateDefinitionEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID:
+ if (FullStateInvariantEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (OccurrenceSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageOccurrenceSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DurationConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DurationObservationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (FullStateInvariantVerticalLineEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeConstraintEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeObservationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (GeneralOrderingEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CompactLifelineCompartmentEditPartCN.VISUAL_ID:
+ if (CompactStateInvariantEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (OccurrenceSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageOccurrenceSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DurationConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DurationObservationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeConstraintEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (TimeObservationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (GeneralOrderingEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case TimeRulerCompartmentEditPartCN.VISUAL_ID:
+ if (FreeTimingRulerEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (LinearTimingRulerEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ if (FreeTimingRulerEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ if (FreeTimingRulerEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case FreeTimeRulerCompartmentEditPart.VISUAL_ID:
+ if (TickEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case LinearTimeRulerCompartmentEditPart.VISUAL_ID:
+ if (TickEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageSyncEditPart.VISUAL_ID:
+ if (MessageSyncNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageSyncAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageAsyncEditPart.VISUAL_ID:
+ if (MessageAsyncNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageAsyncAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageReplyEditPart.VISUAL_ID:
+ if (MessageReplyNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageReplyAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageCreateEditPart.VISUAL_ID:
+ if (MessageCreateNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageCreateAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageDeleteEditPart.VISUAL_ID:
+ if (MessageDeleteNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageDeleteAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageLostEditPart.VISUAL_ID:
+ if (MessageLostNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageLostAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case MessageFoundEditPart.VISUAL_ID:
+ if (MessageFoundNameLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (MessageFoundAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getLinkWithClassVisualID(final EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_3((Message) domainElement)
+
+ ) {
+ return MessageSyncEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_4((Message) domainElement)
+
+ ) {
+ return MessageAsyncEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_41((Message) domainElement)
+
+ ) {
+ return MessageReplyEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_44((Message) domainElement)
+
+ ) {
+ return MessageCreateEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_47((Message) domainElement)
+
+ ) {
+ return MessageDeleteEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_50((Message) domainElement)
+
+ ) {
+ return MessageLostEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getMessage().isSuperTypeOf(domainElement.eClass())
+
+ && isMessage_53((Message) domainElement)
+
+ ) {
+ return MessageFoundEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * User can change implementation of this method to handle some specific situations not covered by default logic.
+ *
+ * @generated
+ */
+ private static boolean isDiagram(final Package element) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+
+ private static boolean isLifeline_19(final View containerView, final Lifeline domainElement) {
+
+ return LifelineUtils.getLifelineType(domainElement) == LifelineUtils.LifelineType.full;
+ }
+
+ /**
+ * @generated
+ */
+
+ private static boolean isLifeline_20(final View containerView, final Lifeline domainElement) {
+
+ return LifelineUtils.getLifelineType(domainElement) == LifelineUtils.LifelineType.compact;
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_3(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_4(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(1, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_41(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_44(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(3, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_47(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(4, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_50(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(5, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean isMessage_53(final Message domainElement) {
+ final Object result = UMLOCLFactory.getExpression(6, UMLPackage.eINSTANCE.getMessage(), null).evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean checkNodeVisualID(final View containerView, final EObject domainElement, final int candidate) {
+ if (candidate == -1) {
+ // unrecognized id is always bad
+ return false;
+ }
+ final int basic = getNodeVisualID(containerView, domainElement);
+ return basic == candidate;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isCompartmentVisualID(final int visualID) {
+ switch (visualID) {
+ case InteractionCompartmentEditPartTN.VISUAL_ID:
+ case FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID:
+ case FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID:
+ case CompactLifelineCompartmentEditPartCN.VISUAL_ID:
+ case TimeRulerCompartmentEditPartCN.VISUAL_ID:
+ case FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ case CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID:
+ case FreeTimeRulerCompartmentEditPart.VISUAL_ID:
+ case LinearTimeRulerCompartmentEditPart.VISUAL_ID:
+ return true;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isSemanticLeafVisualID(final int visualID) {
+ switch (visualID) {
+ case TimingDiagramEditPart.VISUAL_ID:
+ return false;
+ case StateDefinitionEditPart.VISUAL_ID:
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ case TimeConstraintEditPart.VISUAL_ID:
+ case TimeObservationEditPart.VISUAL_ID:
+ case DurationObservationEditPartCN.VISUAL_ID:
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ case FreeTimingRulerEditPartCN.VISUAL_ID:
+ case LinearTimingRulerEditPartCN.VISUAL_ID:
+ case TickEditPart.VISUAL_ID:
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ case FullStateInvariantVerticalLineEditPart.VISUAL_ID:
+ case LifelineEditPart.VISUAL_ID:
+ case GeneralOrderingEditPart.VISUAL_ID:
+ case GateEditPart.VISUAL_ID:
+ return true;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() {
+ /**
+ * @generated
+ */
+
+ @Override
+ public int getVisualID(final View view) {
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getVisualID(view);
+ }
+
+ /**
+ * @generated
+ */
+
+ @Override
+ public String getModelID(final View view) {
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getModelID(view);
+ }
+
+ /**
+ * @generated
+ */
+
+ @Override
+ public int getNodeVisualID(final View containerView, final EObject domainElement) {
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ }
+
+ /**
+ * @generated
+ */
+
+ @Override
+ public boolean checkNodeVisualID(final View containerView, final EObject domainElement, final int candidate) {
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.checkNodeVisualID(containerView, domainElement, candidate);
+ }
+
+ /**
+ * @generated
+ */
+
+ @Override
+ public boolean isCompartmentVisualID(final int visualID) {
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.isCompartmentVisualID(visualID);
+ }
+
+ /**
+ * @generated
+ */
+
+ @Override
+ public boolean isSemanticLeafVisualID(final int visualID) {
+ return org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry.isSemanticLeafVisualID(visualID);
+ }
+ };
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java
new file mode 100644
index 00000000000..24a0bdea944
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.part;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLMarkerNavigationProvider;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLValidationProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class ValidateAction extends Action {
+
+ /**
+ * @generated
+ */
+ private final IWorkbenchPage page;
+
+ /**
+ * @generated
+ */
+ public ValidateAction(final IWorkbenchPage page) {
+ setText(Messages.ValidateActionMessage);
+ this.page = page;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void run() {
+ final IWorkbenchPart workbenchPart = this.page.getActivePart();
+ if (workbenchPart instanceof IDiagramWorkbenchPart) {
+ final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
+ try {
+ new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ runValidation(part.getDiagramEditPart(), part.getDiagram());
+ }
+ }).run(new NullProgressMonitor());
+ } catch (final Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void runValidation(final View view) {
+ try {
+ if (UMLDiagramEditorUtil.openDiagram(view.eResource())) {
+ final IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (editorPart instanceof IDiagramWorkbenchPart) {
+ runValidation(((IDiagramWorkbenchPart) editorPart).getDiagramEditPart(), view);
+ } else {
+ runNonUIValidation(view);
+ }
+ }
+ } catch (final Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void runNonUIValidation(final View view) {
+ final DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram());
+ runValidation(diagramEditPart, view);
+ }
+
+ /**
+ * @generated
+ */
+ public static void runValidation(final DiagramEditPart diagramEditPart, final View view) {
+ final DiagramEditPart fpart = diagramEditPart;
+ final View fview = view;
+ final TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
+ UMLValidationProvider.runWithConstraints(txDomain, new Runnable() {
+
+ public void run() {
+ validate(fpart, fview);
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ private static Diagnostic runEMFValidator(final View target) {
+ if (target.isSetElement() && target.getElement() != null) {
+ return new Diagnostician() {
+
+ @Override
+ public String getObjectLabel(final EObject eObject) {
+ return EMFCoreUtil.getQualifiedName(eObject, true);
+ }
+ }.validate(target.getElement());
+ }
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ private static void validate(final DiagramEditPart diagramEditPart, final View view) {
+ final IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null;
+ if (target != null) {
+ UMLMarkerNavigationProvider.deleteMarkers(target);
+ }
+ final Diagnostic diagnostic = runEMFValidator(view);
+ createMarkers(target, diagnostic, diagramEditPart);
+ final IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
+ validator.setIncludeLiveConstraints(true);
+ if (view.isSetElement() && view.getElement() != null) {
+ final IStatus status = validator.validate(view.getElement());
+ createMarkers(target, status, diagramEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void createMarkers(final IFile target, final IStatus validationStatus, final DiagramEditPart diagramEditPart) {
+ if (validationStatus.isOK()) {
+ return;
+ }
+ final IStatus rootStatus = validationStatus;
+ final List allStatuses = new ArrayList();
+ final UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(),
+ collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses));
+ for (final Iterator it = allStatuses.iterator(); it.hasNext();) {
+ final IConstraintStatus nextStatus = (IConstraintStatus) it.next();
+ final View view = UMLDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true),
+ nextStatus.getMessage(), nextStatus.getSeverity());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void createMarkers(final IFile target, final Diagnostic emfValidationStatus, final DiagramEditPart diagramEditPart) {
+ if (emfValidationStatus.getSeverity() == Diagnostic.OK) {
+ return;
+ }
+ final Diagnostic rootStatus = emfValidationStatus;
+ final List allDiagnostics = new ArrayList();
+ final UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(),
+ collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics));
+ for (final Object element2 : emfValidationStatus.getChildren()) {
+ final Diagnostic nextDiagnostic = (Diagnostic) element2;
+ final List data = nextDiagnostic.getData();
+ if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
+ final EObject element = (EObject) data.get(0);
+ final View view = UMLDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true),
+ nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void addMarker(final EditPartViewer viewer, final IFile target, final String elementId, final String location, final String message,
+ final int statusSeverity) {
+ if (target == null) {
+ return;
+ }
+ UMLMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity);
+ }
+
+ /**
+ * @generated
+ */
+ private static int diagnosticToStatusSeverity(final int diagnosticSeverity) {
+ if (diagnosticSeverity == Diagnostic.OK) {
+ return IStatus.OK;
+ } else if (diagnosticSeverity == Diagnostic.INFO) {
+ return IStatus.INFO;
+ } else if (diagnosticSeverity == Diagnostic.WARNING) {
+ return IStatus.WARNING;
+ } else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
+ return IStatus.ERROR;
+ }
+ return IStatus.INFO;
+ }
+
+ /**
+ * @generated
+ */
+ private static Set<EObject> collectTargetElements(final IStatus status, final Set<EObject> targetElementCollector, final List allConstraintStatuses) {
+ if (status instanceof IConstraintStatus) {
+ targetElementCollector.add(((IConstraintStatus) status).getTarget());
+ allConstraintStatuses.add(status);
+ }
+ if (status.isMultiStatus()) {
+ final IStatus[] children = status.getChildren();
+ for (final IStatus element : children) {
+ collectTargetElements(element, targetElementCollector, allConstraintStatuses);
+ }
+ }
+ return targetElementCollector;
+ }
+
+ /**
+ * @generated
+ */
+ private static Set<EObject> collectTargetElements(final Diagnostic diagnostic, final Set<EObject> targetElementCollector, final List allDiagnostics) {
+ final List data = diagnostic.getData();
+ EObject target = null;
+ if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
+ target = (EObject) data.get(0);
+ targetElementCollector.add(target);
+ allDiagnostics.add(diagnostic);
+ }
+ if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
+ for (final Object element : diagnostic.getChildren()) {
+ collectTargetElements((Diagnostic) element, targetElementCollector, allDiagnostics);
+ }
+ }
+ return targetElementCollector;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java
new file mode 100644
index 00000000000..49ea0062fb7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactLifelinePreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static final String compartments[] = { "CompactLifelineCompartment", "CompactLifelineTimeRuler" };
+
+ /**
+ * @generated
+ */
+ public CompactLifelinePreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_CompactLifeline");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_CompactLifeline";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ map = getStaticCompartmentTitleVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeCompartmentsList() {
+ for (final String name : compartments) {
+ this.compartmentsList.add(name);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ map.put("CompactLifelineCompartment", Boolean.TRUE);
+ map.put("CompactLifelineTimeRuler", Boolean.TRUE);
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
+ return getStaticCompartmentTitleVisibilityPreferences();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactStateInvariantPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactStateInvariantPreferencePage.java
new file mode 100644
index 00000000000..6760aed22d6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactStateInvariantPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class CompactStateInvariantPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public CompactStateInvariantPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_CompactStateInvariant");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_CompactStateInvariant";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DestructionOccurrenceSpecificationPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DestructionOccurrenceSpecificationPreferencePage.java
new file mode 100644
index 00000000000..972f61fc2e5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DestructionOccurrenceSpecificationPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DestructionOccurrenceSpecificationPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DestructionOccurrenceSpecificationPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_DestructionOccurrenceSpecification");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_DestructionOccurrenceSpecification";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramAppearancePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramAppearancePreferencePage.java
new file mode 100644
index 00000000000..45d61f36437
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramAppearancePreferencePage.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramAppearancePreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramConnectionsPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramConnectionsPreferencePage.java
new file mode 100644
index 00000000000..0dc3680a60a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramConnectionsPreferencePage.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramConnectionsPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramGeneralPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramGeneralPreferencePage.java
new file mode 100644
index 00000000000..460dc34cc60
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramGeneralPreferencePage.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.preferences;
+
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramGeneralPreferencePage extends DiagramPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramGeneralPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID);
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPreferenceInitializer.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPreferenceInitializer.java
new file mode 100644
index 00000000000..1d2a02a7141
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPreferenceInitializer.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * @generated
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ final IPreferenceStore store = getPreferenceStore();
+
+ InteractionPreferencePage.initDefaults(store);
+
+ TimeConstraintPreferencePage.initDefaults(store);
+
+ TimeObservationPreferencePage.initDefaults(store);
+
+ VerticalLineStateInvariantPreferencePage.initDefaults(store);
+
+ GeneralOrderingPreferencePage.initDefaults(store);
+
+ CompactStateInvariantPreferencePage.initDefaults(store);
+
+ LinearTimingRulerPreferencePage.initDefaults(store);
+
+ LifelinePreferencePage.initDefaults(store);
+
+ DurationConstraintPreferencePage.initDefaults(store);
+
+ DurationObservationPreferencePage.initDefaults(store);
+
+ TickPreferencePage.initDefaults(store);
+
+ FreeTimingRulerPreferencePage.initDefaults(store);
+
+ FullLifelinePreferencePage.initDefaults(store);
+
+ MessageOccurrenceSpecificationPreferencePage.initDefaults(store);
+
+ OccurrenceSpecificationPreferencePage.initDefaults(store);
+
+ DestructionOccurrenceSpecificationPreferencePage.initDefaults(store);
+
+ FullStateInvariantPreferencePage.initDefaults(store);
+
+ CompactLifelinePreferencePage.initDefaults(store);
+
+ GatePreferencePage.initDefaults(store);
+
+ StateDefinitionPreferencePage.initDefaults(store);
+
+ MessageAsyncPreferencePage.initDefaults(store);
+
+ MessageSyncPreferencePage.initDefaults(store);
+
+ MessageReplyPreferencePage.initDefaults(store);
+
+ MessageDeletePreferencePage.initDefaults(store);
+
+ MessageCreatePreferencePage.initDefaults(store);
+
+ MessageLostPreferencePage.initDefaults(store);
+
+ MessageFoundPreferencePage.initDefaults(store);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPrintingPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPrintingPreferencePage.java
new file mode 100644
index 00000000000..02e0e3abe7b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPrintingPreferencePage.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramPrintingPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramRulersAndGridPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramRulersAndGridPreferencePage.java
new file mode 100644
index 00000000000..5dd8a6b3f71
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramRulersAndGridPreferencePage.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramRulersAndGridPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationConstraintPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationConstraintPreferencePage.java
new file mode 100644
index 00000000000..07da09bb590
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationConstraintPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationConstraintPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DurationConstraintPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_DurationConstraint");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_DurationConstraint";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationObservationPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationObservationPreferencePage.java
new file mode 100644
index 00000000000..7cdb3ca0eab
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationObservationPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class DurationObservationPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DurationObservationPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_DurationObservation");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_DurationObservation";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.java
new file mode 100644
index 00000000000..4a63fe54b4c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.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.preferences;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FreeTimingRulerPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static final String compartments[] = { "FreeTimeRulerCompartment" };
+
+ /**
+ * @generated
+ */
+ public FreeTimingRulerPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_FreeTimingRuler");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_FreeTimingRuler";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ map = getStaticCompartmentTitleVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeCompartmentsList() {
+ for (final String name : compartments) {
+ this.compartmentsList.add(name);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ map.put("FreeTimeRulerCompartment", Boolean.TRUE);
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
+ return getStaticCompartmentTitleVisibilityPreferences();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java
new file mode 100644
index 00000000000..80b8811d0ad
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullLifelinePreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static final String compartments[] = { "FullLifelineStateDefinitionCompartment", "FullLifelineTimelineCompartment", "FullLifelineTimeRuler" };
+
+ /**
+ * @generated
+ */
+ public FullLifelinePreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_FullLifeline");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_FullLifeline";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ map = getStaticCompartmentTitleVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeCompartmentsList() {
+ for (final String name : compartments) {
+ this.compartmentsList.add(name);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ map.put("FullLifelineStateDefinitionCompartment", Boolean.TRUE);
+ map.put("FullLifelineTimelineCompartment", Boolean.TRUE);
+ map.put("FullLifelineTimeRuler", Boolean.TRUE);
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
+ return getStaticCompartmentTitleVisibilityPreferences();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullStateInvariantPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullStateInvariantPreferencePage.java
new file mode 100644
index 00000000000..843bb2955f1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullStateInvariantPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class FullStateInvariantPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public FullStateInvariantPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_FullStateInvariant");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_FullStateInvariant";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GatePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GatePreferencePage.java
new file mode 100644
index 00000000000..5dc8275d1f4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GatePreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GatePreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public GatePreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_Gate");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_Gate";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GeneralOrderingPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GeneralOrderingPreferencePage.java
new file mode 100644
index 00000000000..9c58d1149a5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GeneralOrderingPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class GeneralOrderingPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public GeneralOrderingPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_GeneralOrdering");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_GeneralOrdering";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java
new file mode 100644
index 00000000000..23549bb1d20
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class InteractionPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static final String compartments[] = { "InteractionCompartment", "TimeRulerCompartment" };
+
+ /**
+ * @generated
+ */
+ public InteractionPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_Interaction");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_Interaction";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 600);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 400);
+
+ Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ map = getStaticCompartmentTitleVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeCompartmentsList() {
+ for (final String name : compartments) {
+ this.compartmentsList.add(name);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ map.put("InteractionCompartment", Boolean.TRUE);
+ map.put("TimeRulerCompartment", Boolean.TRUE);
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
+ return getStaticCompartmentTitleVisibilityPreferences();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LifelinePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LifelinePreferencePage.java
new file mode 100644
index 00000000000..de07c88bb0c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LifelinePreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LifelinePreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public LifelinePreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_Lifeline");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_Lifeline";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.java
new file mode 100644
index 00000000000..bf7e51e2a18
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.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.preferences;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class LinearTimingRulerPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public static final String compartments[] = { "LinearTimeRulerCompartment" };
+
+ /**
+ * @generated
+ */
+ public LinearTimingRulerPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_LinearTimingRuler");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_LinearTimingRuler";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ map = getStaticCompartmentTitleVisibilityPreferences();
+ for (final String name : map.keySet()) {
+ final String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ store.setDefault(preferenceName, map.get(name));
+ }
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeCompartmentsList() {
+ for (final String name : compartments) {
+ this.compartmentsList.add(name);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ map.put("LinearTimeRulerCompartment", Boolean.TRUE);
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ private static TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences() {
+ final TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
+ return map;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
+ return getStaticCompartmentTitleVisibilityPreferences();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageAsyncPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageAsyncPreferencePage.java
new file mode 100644
index 00000000000..517d3acdcf6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageAsyncPreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageAsyncPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageAsyncPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageAsync");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageCreatePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageCreatePreferencePage.java
new file mode 100644
index 00000000000..23e8d748cf2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageCreatePreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageCreatePreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageCreatePreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageCreate");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageDeletePreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageDeletePreferencePage.java
new file mode 100644
index 00000000000..eaef748996a
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageDeletePreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageDeletePreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageDeletePreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageDelete");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageFoundPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageFoundPreferencePage.java
new file mode 100644
index 00000000000..6de2d4061a6
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageFoundPreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageFoundPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageFoundPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageFound");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageLostPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageLostPreferencePage.java
new file mode 100644
index 00000000000..67e6abd3677
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageLostPreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageLostPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageLostPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageLost");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageOccurrenceSpecificationPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageOccurrenceSpecificationPreferencePage.java
new file mode 100644
index 00000000000..9ea31f974d9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageOccurrenceSpecificationPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageOccurrenceSpecificationPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageOccurrenceSpecificationPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageOccurrenceSpecification");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_MessageOccurrenceSpecification";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageReplyPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageReplyPreferencePage.java
new file mode 100644
index 00000000000..833c8dc6dad
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageReplyPreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageReplyPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageReplyPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageReply");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageSyncPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageSyncPreferencePage.java
new file mode 100644
index 00000000000..186e43f2628
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageSyncPreferencePage.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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class MessageSyncPreferencePage extends AbstractPapyrusLinkPreferencePage {
+
+ /**
+ * @generated
+ */
+ public MessageSyncPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_MessageSync");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/OccurrenceSpecificationPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/OccurrenceSpecificationPreferencePage.java
new file mode 100644
index 00000000000..c731e5dab8d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/OccurrenceSpecificationPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class OccurrenceSpecificationPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public OccurrenceSpecificationPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_OccurrenceSpecification");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_OccurrenceSpecification";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 4);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 4);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/StateDefinitionPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/StateDefinitionPreferencePage.java
new file mode 100644
index 00000000000..24807648696
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/StateDefinitionPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class StateDefinitionPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public StateDefinitionPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_StateDefinition");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_StateDefinition";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TickPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TickPreferencePage.java
new file mode 100644
index 00000000000..918962de9c2
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TickPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TickPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public TickPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_Tick");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_Tick";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 5);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 12);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeConstraintPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeConstraintPreferencePage.java
new file mode 100644
index 00000000000..db72955452c
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeConstraintPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeConstraintPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public TimeConstraintPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_TimeConstraint");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_TimeConstraint";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeObservationPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeObservationPreferencePage.java
new file mode 100644
index 00000000000..bfb07108d2b
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeObservationPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class TimeObservationPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public TimeObservationPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_TimeObservation");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_TimeObservation";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/VerticalLineStateInvariantPreferencePage.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/VerticalLineStateInvariantPreferencePage.java
new file mode 100644
index 00000000000..148ee1ee229
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/VerticalLineStateInvariantPreferencePage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class VerticalLineStateInvariantPreferencePage extends AbstractPapyrusNodePreferencePage {
+
+ /**
+ * @generated
+ */
+ public VerticalLineStateInvariantPreferencePage() {
+ super();
+ setPreferenceKey(TimingDiagramEditPart.MODEL_ID + "_VerticalLineStateInvariant");
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getBundleId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public static void initDefaults(final IPreferenceStore store) {
+
+ final String key = TimingDiagramEditPart.MODEL_ID + "_VerticalLineStateInvariant";
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
+
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new
+ // org.eclipse.swt.graphics.RGB(255, 255, 255));
+ // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new
+ // org.eclipse.swt.graphics.RGB(0, 0, 0));
+
+ // Set the default for the gradient
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter =
+ // new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ // new org.eclipse.swt.graphics.RGB(255, 255, 255),
+ // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
+ // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,
+ // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT),
+ // gradientPreferenceConverter.getPreferenceValue());
+
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.java
new file mode 100644
index 00000000000..0d483014dd1
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.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.providers;
+
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class ElementInitializers {
+
+ protected ElementInitializers() {
+ // use #getInstance to access cached instance
+ }
+
+ /**
+ * @generated
+ */
+ public static ElementInitializers getInstance() {
+ ElementInitializers cached = UMLDiagramEditorPlugin.getInstance().getElementInitializers();
+ if (cached == null) {
+ UMLDiagramEditorPlugin.getInstance().setElementInitializers(cached = new ElementInitializers());
+ }
+ return cached;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java
new file mode 100644
index 00000000000..18089c2e652
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import java.lang.ref.WeakReference;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.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;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLEditPartProvider extends AbstractEditPartProvider {
+
+ /**
+ * @generated
+ */
+ private EditPartFactory factory;
+
+ /**
+ * @generated
+ */
+ private boolean allowCaching;
+
+ /**
+ * @generated
+ */
+ private WeakReference cachedPart;
+
+ /**
+ * @generated
+ */
+ private WeakReference cachedView;
+
+ /**
+ * @generated
+ */
+ public UMLEditPartProvider() {
+ setFactory(new UMLEditPartFactory());
+ setAllowCaching(true);
+ }
+
+ /**
+ * @generated
+ */
+ public final EditPartFactory getFactory() {
+ return this.factory;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFactory(final EditPartFactory factory) {
+ this.factory = factory;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isAllowCaching() {
+ return this.allowCaching;
+ }
+
+ /**
+ * @generated
+ */
+ protected synchronized void setAllowCaching(final boolean allowCaching) {
+ this.allowCaching = allowCaching;
+ if (!allowCaching) {
+ this.cachedPart = null;
+ this.cachedView = null;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IGraphicalEditPart createEditPart(final View view) {
+ final EditPart part = this.factory.createEditPart(null, view);
+ if (part instanceof IGraphicalEditPart) {
+ return (IGraphicalEditPart) part;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IGraphicalEditPart getCachedPart(final View view) {
+ if (this.cachedView != null && this.cachedView.get() == view) {
+ return (IGraphicalEditPart) this.cachedPart.get();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public synchronized IGraphicalEditPart createGraphicEditPart(final View view) {
+ if (isAllowCaching()) {
+ final IGraphicalEditPart part = getCachedPart(view);
+ this.cachedPart = null;
+ this.cachedView = null;
+ if (part != null) {
+ return part;
+ }
+ }
+ return createEditPart(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public synchronized boolean provides(final IOperation operation) {
+ if (operation instanceof CreateGraphicEditPartOperation) {
+ final View view = ((IEditPartOperation) operation).getView();
+ if (!TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
+ return false;
+ }
+ if (isAllowCaching() && getCachedPart(view) != null) {
+ return true;
+ }
+ final IGraphicalEditPart part = createEditPart(view);
+ if (part != null) {
+ if (isAllowCaching()) {
+ this.cachedPart = new WeakReference(part);
+ this.cachedView = new WeakReference(view);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java
new file mode 100644
index 00000000000..e928033e007
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java
@@ -0,0 +1,463 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+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.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimingRulerEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
+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.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimingRulerEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionEditPart;
+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.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLElementTypes {
+
+ /**
+ * @generated
+ */
+ private UMLElementTypes() {
+ }
+
+ /**
+ * @generated
+ */
+ private static Map<IElementType, ENamedElement> elements;
+
+ /**
+ * @generated
+ */
+ private static ImageRegistry imageRegistry;
+
+ /**
+ * @generated
+ */
+ private static Set<IElementType> KNOWN_ELEMENT_TYPES;
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_1 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Package_1"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Interaction_2 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Interaction_2"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Lifeline_19 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Lifeline_19"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Lifeline_20 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Lifeline_20"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType StateInvariant_11 = getElementType("org.eclipse.papyrus.uml.diagram.timing.FullStateInvariant_11"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType StateInvariant_28 = getElementType("org.eclipse.papyrus.uml.diagram.timing.CompactStateInvariant_28"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType OccurrenceSpecification_12 = getElementType("org.eclipse.papyrus.uml.diagram.timing.OccurrenceSpecification_12"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType MessageOccurrenceSpecification_13 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageOccurrenceSpecification_13"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Node_9 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Node_9"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Node_39 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Node_39"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType TimeConstraint_15 = getElementType("org.eclipse.papyrus.uml.diagram.timing.TimeConstraint_15"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType TimeObservation_16 = getElementType("org.eclipse.papyrus.uml.diagram.timing.TimeObservation_16"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType DurationConstraint_18 = getElementType("org.eclipse.papyrus.uml.diagram.timing.DurationConstraint_18"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType DurationObservation_17 = getElementType("org.eclipse.papyrus.uml.diagram.timing.DurationObservation_17"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType GeneralOrdering_67 = getElementType("org.eclipse.papyrus.uml.diagram.timing.GeneralOrdering_67"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Node_24 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Node_24"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Node_25 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Node_25"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Node_26 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Node_26"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType DestructionOccurrenceSpecification_27 = getElementType("org.eclipse.papyrus.uml.diagram.timing.DestructionOccurrenceSpecification_27"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Lifeline_40 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Lifeline_40"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Gate_69 = getElementType("org.eclipse.papyrus.uml.diagram.timing.Gate_69"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_3 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageSync_3"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_4 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageAsync_4"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_41 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageReply_41"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_44 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageCreate_44"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_47 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageDelete_47"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_50 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageLost_50"); //$NON-NLS-1$
+ /**
+ * @generated
+ */
+ public static final IElementType Message_53 = getElementType("org.eclipse.papyrus.uml.diagram.timing.MessageFound_53"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = new ImageRegistry();
+ }
+ return imageRegistry;
+ }
+
+ /**
+ * @generated
+ */
+ private static String getImageRegistryKey(final ENamedElement element) {
+ return element.getName();
+ }
+
+ /**
+ * @generated
+ */
+ private static ImageDescriptor getProvidedImageDescriptor(ENamedElement element) {
+ if (element instanceof EStructuralFeature) {
+ final EStructuralFeature feature = ((EStructuralFeature) element);
+ final EClass eContainingClass = feature.getEContainingClass();
+ final EClassifier eType = feature.getEType();
+ if (eContainingClass != null && !eContainingClass.isAbstract()) {
+ element = eContainingClass;
+ } else if (eType instanceof EClass && !((EClass) eType).isAbstract()) {
+ element = eType;
+ }
+ }
+ if (element instanceof EClass) {
+ final EClass eClass = (EClass) element;
+ if (!eClass.isAbstract()) {
+ return UMLDiagramEditorPlugin.getInstance().getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass));
+ }
+ }
+ // TODO : support structural features
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(final ENamedElement element) {
+ final String key = getImageRegistryKey(element);
+ ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
+ if (imageDescriptor == null) {
+ imageDescriptor = getProvidedImageDescriptor(element);
+ if (imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(key, imageDescriptor);
+ }
+ return imageDescriptor;
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(final ENamedElement element) {
+ final String key = getImageRegistryKey(element);
+ Image image = getImageRegistry().get(key);
+ if (image == null) {
+ ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
+ if (imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(key, imageDescriptor);
+ image = getImageRegistry().get(key);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(final IAdaptable hint) {
+ final ENamedElement element = getElement(hint);
+ if (element == null) {
+ return null;
+ }
+ return getImageDescriptor(element);
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(final IAdaptable hint) {
+ final ENamedElement element = getElement(hint);
+ if (element == null) {
+ return null;
+ }
+ return getImage(element);
+ }
+
+ /**
+ * Returns 'type' of the ecore object associated with the hint.
+ *
+ * @generated
+ */
+ public static ENamedElement getElement(final IAdaptable hint) {
+ final Object type = hint.getAdapter(IElementType.class);
+ if (elements == null) {
+ elements = new IdentityHashMap<IElementType, ENamedElement>();
+
+ elements.put(Package_1, UMLPackage.eINSTANCE.getPackage());
+
+ elements.put(Interaction_2, UMLPackage.eINSTANCE.getInteraction());
+
+ elements.put(Lifeline_19, UMLPackage.eINSTANCE.getLifeline());
+
+ elements.put(Lifeline_20, UMLPackage.eINSTANCE.getLifeline());
+
+ elements.put(StateInvariant_11, UMLPackage.eINSTANCE.getStateInvariant());
+
+ elements.put(StateInvariant_28, UMLPackage.eINSTANCE.getStateInvariant());
+
+ elements.put(OccurrenceSpecification_12, UMLPackage.eINSTANCE.getOccurrenceSpecification());
+
+ elements.put(MessageOccurrenceSpecification_13, UMLPackage.eINSTANCE.getMessageOccurrenceSpecification());
+
+ elements.put(TimeConstraint_15, UMLPackage.eINSTANCE.getTimeConstraint());
+
+ elements.put(TimeObservation_16, UMLPackage.eINSTANCE.getTimeObservation());
+
+ elements.put(DurationConstraint_18, UMLPackage.eINSTANCE.getDurationConstraint());
+
+ elements.put(DurationObservation_17, UMLPackage.eINSTANCE.getDurationObservation());
+
+ elements.put(GeneralOrdering_67, UMLPackage.eINSTANCE.getGeneralOrdering());
+
+ elements.put(DestructionOccurrenceSpecification_27, UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification());
+
+ elements.put(Lifeline_40, UMLPackage.eINSTANCE.getLifeline());
+
+ elements.put(Gate_69, UMLPackage.eINSTANCE.getGate());
+
+ elements.put(Message_3, UMLPackage.eINSTANCE.getMessage());
+
+ elements.put(Message_4, UMLPackage.eINSTANCE.getMessage());
+
+ elements.put(Message_41, UMLPackage.eINSTANCE.getMessage());
+
+ elements.put(Message_44, UMLPackage.eINSTANCE.getMessage());
+
+ elements.put(Message_47, UMLPackage.eINSTANCE.getMessage());
+
+ elements.put(Message_50, UMLPackage.eINSTANCE.getMessage());
+
+ elements.put(Message_53, UMLPackage.eINSTANCE.getMessage());
+ }
+ return elements.get(type);
+ }
+
+ /**
+ * @generated
+ */
+ private static IElementType getElementType(final String id) {
+ return ElementTypeRegistry.getInstance().getType(id);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isKnownElementType(final IElementType elementType) {
+ if (KNOWN_ELEMENT_TYPES == null) {
+ KNOWN_ELEMENT_TYPES = new HashSet<IElementType>();
+ KNOWN_ELEMENT_TYPES.add(Package_1);
+ KNOWN_ELEMENT_TYPES.add(Interaction_2);
+ KNOWN_ELEMENT_TYPES.add(Lifeline_19);
+ KNOWN_ELEMENT_TYPES.add(Lifeline_20);
+ KNOWN_ELEMENT_TYPES.add(StateInvariant_11);
+ KNOWN_ELEMENT_TYPES.add(StateInvariant_28);
+ KNOWN_ELEMENT_TYPES.add(OccurrenceSpecification_12);
+ KNOWN_ELEMENT_TYPES.add(MessageOccurrenceSpecification_13);
+ KNOWN_ELEMENT_TYPES.add(Node_9);
+ KNOWN_ELEMENT_TYPES.add(Node_39);
+ KNOWN_ELEMENT_TYPES.add(TimeConstraint_15);
+ KNOWN_ELEMENT_TYPES.add(TimeObservation_16);
+ KNOWN_ELEMENT_TYPES.add(DurationConstraint_18);
+ KNOWN_ELEMENT_TYPES.add(DurationObservation_17);
+ KNOWN_ELEMENT_TYPES.add(GeneralOrdering_67);
+ KNOWN_ELEMENT_TYPES.add(Node_24);
+ KNOWN_ELEMENT_TYPES.add(Node_25);
+ KNOWN_ELEMENT_TYPES.add(Node_26);
+ KNOWN_ELEMENT_TYPES.add(DestructionOccurrenceSpecification_27);
+ KNOWN_ELEMENT_TYPES.add(Lifeline_40);
+ KNOWN_ELEMENT_TYPES.add(Gate_69);
+ KNOWN_ELEMENT_TYPES.add(Message_3);
+ KNOWN_ELEMENT_TYPES.add(Message_4);
+ KNOWN_ELEMENT_TYPES.add(Message_41);
+ KNOWN_ELEMENT_TYPES.add(Message_44);
+ KNOWN_ELEMENT_TYPES.add(Message_47);
+ KNOWN_ELEMENT_TYPES.add(Message_50);
+ KNOWN_ELEMENT_TYPES.add(Message_53);
+ }
+ return KNOWN_ELEMENT_TYPES.contains(elementType);
+ }
+
+ /**
+ * @generated
+ */
+ public static IElementType getElementType(final int visualID) {
+ switch (visualID) {
+ case TimingDiagramEditPart.VISUAL_ID:
+ return Package_1;
+ case InteractionEditPartTN.VISUAL_ID:
+ return Interaction_2;
+ case FullLifelineEditPartCN.VISUAL_ID:
+ return Lifeline_19;
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return Lifeline_20;
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ return StateInvariant_11;
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ return StateInvariant_28;
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return OccurrenceSpecification_12;
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return MessageOccurrenceSpecification_13;
+ case StateDefinitionEditPart.VISUAL_ID:
+ return Node_9;
+ case FullStateInvariantVerticalLineEditPart.VISUAL_ID:
+ return Node_39;
+ case TimeConstraintEditPart.VISUAL_ID:
+ return TimeConstraint_15;
+ case TimeObservationEditPart.VISUAL_ID:
+ return TimeObservation_16;
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ return DurationConstraint_18;
+ case DurationObservationEditPartCN.VISUAL_ID:
+ return DurationObservation_17;
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return GeneralOrdering_67;
+ case FreeTimingRulerEditPartCN.VISUAL_ID:
+ return Node_24;
+ case LinearTimingRulerEditPartCN.VISUAL_ID:
+ return Node_25;
+ case TickEditPart.VISUAL_ID:
+ return Node_26;
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return DestructionOccurrenceSpecification_27;
+ case LifelineEditPart.VISUAL_ID:
+ return Lifeline_40;
+ case GateEditPart.VISUAL_ID:
+ return Gate_69;
+ case MessageSyncEditPart.VISUAL_ID:
+ return Message_3;
+ case MessageAsyncEditPart.VISUAL_ID:
+ return Message_4;
+ case MessageReplyEditPart.VISUAL_ID:
+ return Message_41;
+ case MessageCreateEditPart.VISUAL_ID:
+ return Message_44;
+ case MessageDeleteEditPart.VISUAL_ID:
+ return Message_47;
+ case MessageLostEditPart.VISUAL_ID:
+ return Message_50;
+ case MessageFoundEditPart.VISUAL_ID:
+ return Message_53;
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java
new file mode 100644
index 00000000000..9e95ba98f87
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation;
+import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLIconProvider extends AbstractProvider implements IIconProvider {
+
+ /**
+ * @generated
+ */
+ public Image getIcon(final IAdaptable hint, final int flags) {
+ return UMLElementTypes.getImage(hint);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(final IOperation operation) {
+ if (operation instanceof GetIconOperation) {
+ return ((GetIconOperation) operation).execute(this) != null;
+ }
+ return false;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java
new file mode 100644
index 00000000000..97329441f74
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorUtil;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
+
+ /**
+ * @generated
+ */
+ public static final String MARKER_TYPE = UMLDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doGotoMarker(final IMarker marker) {
+ final String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
+ if (elementId == null || !(getEditor() instanceof DiagramEditor)) {
+ return;
+ }
+ final DiagramEditor editor = (DiagramEditor) getEditor();
+ final Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ final EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
+ if (targetView == null) {
+ return;
+ }
+ final EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView);
+ if (targetEditPart != null) {
+ UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart }));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void deleteMarkers(final IResource resource) {
+ try {
+ resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ } catch (final CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Failed to delete validation markers", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static IMarker addMarker(final IFile file, final String elementId, final String location, final String message, final int statusSeverity) {
+ IMarker marker = null;
+ try {
+ marker = file.createMarker(MARKER_TYPE);
+ marker.setAttribute(IMarker.MESSAGE, message);
+ marker.setAttribute(IMarker.LOCATION, location);
+ marker.setAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, elementId);
+ int markerSeverity = IMarker.SEVERITY_INFO;
+ if (statusSeverity == IStatus.WARNING) {
+ markerSeverity = IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
+ markerSeverity = IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(IMarker.SEVERITY, markerSeverity);
+ } catch (final CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
+ }
+ return marker;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java
new file mode 100644
index 00000000000..4d25b5d4fa8
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java
@@ -0,0 +1,469 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.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.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FreeTimeRulerCompartmentEditPart;
+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.GateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimeRulerCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.Messages;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLModelingAssistantProvider extends ModelingAssistantProvider {
+
+ /**
+ * @generated
+ */
+ @Override
+ public List getTypesForPopupBar(final IAdaptable host) {
+ final IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
+ if (editPart instanceof TimingDiagramEditPart) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Interaction_2);
+ return types;
+ }
+ if (editPart instanceof InteractionEditPartTN) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(5);
+ types.add(UMLElementTypes.Gate_69);
+ types.add(UMLElementTypes.Lifeline_19);
+ types.add(UMLElementTypes.Lifeline_20);
+ types.add(UMLElementTypes.Node_24);
+ types.add(UMLElementTypes.Node_25);
+ return types;
+ }
+ if (editPart instanceof FullLifelineEditPartCN) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.Node_9);
+ types.add(UMLElementTypes.Node_24);
+ return types;
+ }
+ if (editPart instanceof CompactLifelineEditPartCN) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Node_24);
+ return types;
+ }
+ if (editPart instanceof FullLifelineTimelineCompartmentEditPartCN) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(10);
+ types.add(UMLElementTypes.StateInvariant_11);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.Node_39);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ return types;
+ }
+ if (editPart instanceof CompactLifelineCompartmentEditPartCN) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(9);
+ types.add(UMLElementTypes.StateInvariant_28);
+ types.add(UMLElementTypes.OccurrenceSpecification_12);
+ types.add(UMLElementTypes.MessageOccurrenceSpecification_13);
+ types.add(UMLElementTypes.DestructionOccurrenceSpecification_27);
+ types.add(UMLElementTypes.DurationConstraint_18);
+ types.add(UMLElementTypes.DurationObservation_17);
+ types.add(UMLElementTypes.TimeConstraint_15);
+ types.add(UMLElementTypes.TimeObservation_16);
+ types.add(UMLElementTypes.GeneralOrdering_67);
+ return types;
+ }
+ if (editPart instanceof FreeTimeRulerCompartmentEditPart) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Node_26);
+ return types;
+ }
+ if (editPart instanceof LinearTimeRulerCompartmentEditPart) {
+ final ArrayList<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Node_26);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List getRelTypesOnSource(final IAdaptable source) {
+ final IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof InteractionEditPartTN) {
+ return ((InteractionEditPartTN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof FullLifelineEditPartCN) {
+ return ((FullLifelineEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof CompactLifelineEditPartCN) {
+ return ((CompactLifelineEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof FullStateInvariantEditPartCN) {
+ return ((FullStateInvariantEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof CompactStateInvariantEditPartCN) {
+ return ((CompactStateInvariantEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ return ((OccurrenceSpecificationEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ return ((MessageOccurrenceSpecificationEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof TimeConstraintEditPart) {
+ return ((TimeConstraintEditPart) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof TimeObservationEditPart) {
+ return ((TimeObservationEditPart) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof DurationConstraintEditPartCN) {
+ return ((DurationConstraintEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof DurationObservationEditPartCN) {
+ return ((DurationObservationEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof GeneralOrderingEditPart) {
+ return ((GeneralOrderingEditPart) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ return ((DestructionOccurrenceSpecificationEditPartCN) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof LifelineEditPart) {
+ return ((LifelineEditPart) sourceEditPart).getMARelTypesOnSource();
+ }
+ if (sourceEditPart instanceof GateEditPart) {
+ return ((GateEditPart) sourceEditPart).getMARelTypesOnSource();
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List getRelTypesOnTarget(final IAdaptable target) {
+ final IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (targetEditPart instanceof InteractionEditPartTN) {
+ return ((InteractionEditPartTN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof FullLifelineEditPartCN) {
+ return ((FullLifelineEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof CompactLifelineEditPartCN) {
+ return ((CompactLifelineEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ return ((FullStateInvariantEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ return ((CompactStateInvariantEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ return ((OccurrenceSpecificationEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ return ((MessageOccurrenceSpecificationEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof TimeConstraintEditPart) {
+ return ((TimeConstraintEditPart) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof TimeObservationEditPart) {
+ return ((TimeObservationEditPart) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof DurationConstraintEditPartCN) {
+ return ((DurationConstraintEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof DurationObservationEditPartCN) {
+ return ((DurationObservationEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof GeneralOrderingEditPart) {
+ return ((GeneralOrderingEditPart) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ return ((DestructionOccurrenceSpecificationEditPartCN) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof LifelineEditPart) {
+ return ((LifelineEditPart) targetEditPart).getMARelTypesOnTarget();
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ return ((GateEditPart) targetEditPart).getMARelTypesOnTarget();
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List getRelTypesOnSourceAndTarget(final IAdaptable source, final IAdaptable target) {
+ final IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ final IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof InteractionEditPartTN) {
+ return ((InteractionEditPartTN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof FullLifelineEditPartCN) {
+ return ((FullLifelineEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof CompactLifelineEditPartCN) {
+ return ((CompactLifelineEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof FullStateInvariantEditPartCN) {
+ return ((FullStateInvariantEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof CompactStateInvariantEditPartCN) {
+ return ((CompactStateInvariantEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ return ((OccurrenceSpecificationEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ return ((MessageOccurrenceSpecificationEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof TimeConstraintEditPart) {
+ return ((TimeConstraintEditPart) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof TimeObservationEditPart) {
+ return ((TimeObservationEditPart) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof DurationConstraintEditPartCN) {
+ return ((DurationConstraintEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof DurationObservationEditPartCN) {
+ return ((DurationObservationEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof GeneralOrderingEditPart) {
+ return ((GeneralOrderingEditPart) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ return ((DestructionOccurrenceSpecificationEditPartCN) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof LifelineEditPart) {
+ return ((LifelineEditPart) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ if (sourceEditPart instanceof GateEditPart) {
+ return ((GateEditPart) sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List getTypesForSource(final IAdaptable target, final IElementType relationshipType) {
+ final IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (targetEditPart instanceof InteractionEditPartTN) {
+ return ((InteractionEditPartTN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof FullLifelineEditPartCN) {
+ return ((FullLifelineEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof CompactLifelineEditPartCN) {
+ return ((CompactLifelineEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof FullStateInvariantEditPartCN) {
+ return ((FullStateInvariantEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ return ((CompactStateInvariantEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ return ((OccurrenceSpecificationEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ return ((MessageOccurrenceSpecificationEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof TimeConstraintEditPart) {
+ return ((TimeConstraintEditPart) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof TimeObservationEditPart) {
+ return ((TimeObservationEditPart) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof DurationConstraintEditPartCN) {
+ return ((DurationConstraintEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof DurationObservationEditPartCN) {
+ return ((DurationObservationEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof GeneralOrderingEditPart) {
+ return ((GeneralOrderingEditPart) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ return ((DestructionOccurrenceSpecificationEditPartCN) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof LifelineEditPart) {
+ return ((LifelineEditPart) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ if (targetEditPart instanceof GateEditPart) {
+ return ((GateEditPart) targetEditPart).getMATypesForSource(relationshipType);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List getTypesForTarget(final IAdaptable source, final IElementType relationshipType) {
+ final IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof InteractionEditPartTN) {
+ return ((InteractionEditPartTN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof FullLifelineEditPartCN) {
+ return ((FullLifelineEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof CompactLifelineEditPartCN) {
+ return ((CompactLifelineEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof FullStateInvariantEditPartCN) {
+ return ((FullStateInvariantEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof CompactStateInvariantEditPartCN) {
+ return ((CompactStateInvariantEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof OccurrenceSpecificationEditPartCN) {
+ return ((OccurrenceSpecificationEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof MessageOccurrenceSpecificationEditPartCN) {
+ return ((MessageOccurrenceSpecificationEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof TimeConstraintEditPart) {
+ return ((TimeConstraintEditPart) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof TimeObservationEditPart) {
+ return ((TimeObservationEditPart) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof DurationConstraintEditPartCN) {
+ return ((DurationConstraintEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof DurationObservationEditPartCN) {
+ return ((DurationObservationEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof GeneralOrderingEditPart) {
+ return ((GeneralOrderingEditPart) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ return ((DestructionOccurrenceSpecificationEditPartCN) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof LifelineEditPart) {
+ return ((LifelineEditPart) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ if (sourceEditPart instanceof GateEditPart) {
+ return ((GateEditPart) sourceEditPart).getMATypesForTarget(relationshipType);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EObject selectExistingElementForSource(final IAdaptable target, final IElementType relationshipType) {
+ return selectExistingElement(target, getTypesForSource(target, relationshipType));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EObject selectExistingElementForTarget(final IAdaptable source, final IElementType relationshipType) {
+ return selectExistingElement(source, getTypesForTarget(source, relationshipType));
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject selectExistingElement(final IAdaptable host, final Collection types) {
+ if (types.isEmpty()) {
+ return null;
+ }
+ final IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
+ if (editPart == null) {
+ return null;
+ }
+ final Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
+ final HashSet<EObject> elements = new HashSet<EObject>();
+ for (final Iterator<EObject> it = diagram.getElement().eAllContents(); it.hasNext();) {
+ final EObject element = it.next();
+ if (isApplicableElement(element, types)) {
+ elements.add(element);
+ }
+ }
+ if (elements.isEmpty()) {
+ return null;
+ }
+ return selectElement(elements.toArray(new EObject[elements.size()]));
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isApplicableElement(final EObject element, final Collection types) {
+ final IElementType type = ElementTypeRegistry.getInstance().getElementType(element);
+ return types.contains(type);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject selectElement(final EObject[] elements) {
+ final Shell shell = Display.getCurrent().getActiveShell();
+ final ILabelProvider labelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ final ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
+ dialog.setMessage(Messages.UMLModelingAssistantProviderMessage);
+ dialog.setTitle(Messages.UMLModelingAssistantProviderTitle);
+ dialog.setMultipleSelection(false);
+ dialog.setElements(elements);
+ EObject selected = null;
+ if (dialog.open() == Window.OK) {
+ selected = (EObject) dialog.getFirstResult();
+ }
+ return selected;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java
new file mode 100644
index 00000000000..399a691a8a4
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java
@@ -0,0 +1,800 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
+import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.ConstraintParser;
+import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.StateDefinitionParser;
+import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.TickParser;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactLifelineNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.CompactStateInvariantNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateDefinitionLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.StateInvariantAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.parsers.MessageFormatParser;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLParserProvider extends AbstractProvider implements IParserProvider {
+
+ /**
+ * @generated
+ */
+ private IParser interactionName_37Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getInteractionName_37Parser() {
+ if (this.interactionName_37Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.interactionName_37Parser = parser;
+ }
+ return this.interactionName_37Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser lifelineName_21Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getLifelineName_21Parser() {
+ if (this.lifelineName_21Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.lifelineName_21Parser = parser;
+ }
+ return this.lifelineName_21Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser lifelineName_22Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getLifelineName_22Parser() {
+ if (this.lifelineName_22Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.lifelineName_22Parser = parser;
+ }
+ return this.lifelineName_22Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser stateInvariantName_62Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getStateInvariantName_62Parser() {
+ if (this.stateInvariantName_62Parser == null) {
+ this.stateInvariantName_62Parser = new AppliedStereotypeParser();
+ }
+ return this.stateInvariantName_62Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser stateInvariantName_31Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getStateInvariantName_31Parser() {
+ if (this.stateInvariantName_31Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.stateInvariantName_31Parser = parser;
+ }
+ return this.stateInvariantName_31Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser stateInvariantName_64Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getStateInvariantName_64Parser() {
+ if (this.stateInvariantName_64Parser == null) {
+ this.stateInvariantName_64Parser = new AppliedStereotypeParser();
+ }
+ return this.stateInvariantName_64Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser occurrenceSpecificationName_10Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getOccurrenceSpecificationName_10Parser() {
+ if (this.occurrenceSpecificationName_10Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.occurrenceSpecificationName_10Parser = parser;
+ }
+ return this.occurrenceSpecificationName_10Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser occurrenceSpecificationName_58Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getOccurrenceSpecificationName_58Parser() {
+ if (this.occurrenceSpecificationName_58Parser == null) {
+ this.occurrenceSpecificationName_58Parser = new AppliedStereotypeParser();
+ }
+ return this.occurrenceSpecificationName_58Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageOccurrenceSpecificationName_14Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageOccurrenceSpecificationName_14Parser() {
+ if (this.messageOccurrenceSpecificationName_14Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageOccurrenceSpecificationName_14Parser = parser;
+ }
+ return this.messageOccurrenceSpecificationName_14Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageOccurrenceSpecificationName_59Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageOccurrenceSpecificationName_59Parser() {
+ if (this.messageOccurrenceSpecificationName_59Parser == null) {
+ this.messageOccurrenceSpecificationName_59Parser = new AppliedStereotypeParser();
+ }
+ return this.messageOccurrenceSpecificationName_59Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private StateDefinitionParser nodeLabel_38Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getNodeLabel_38Parser() {
+ if (this.nodeLabel_38Parser == null) {
+ this.nodeLabel_38Parser = new StateDefinitionParser();
+ }
+ return this.nodeLabel_38Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private ConstraintParser timeConstraintSpecification_30Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getTimeConstraintSpecification_30Parser() {
+ if (this.timeConstraintSpecification_30Parser == null) {
+ this.timeConstraintSpecification_30Parser = new ConstraintParser();
+ }
+ return this.timeConstraintSpecification_30Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser timeConstraintName_65Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getTimeConstraintName_65Parser() {
+ if (this.timeConstraintName_65Parser == null) {
+ this.timeConstraintName_65Parser = new AppliedStereotypeParser();
+ }
+ return this.timeConstraintName_65Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser timeObservationName_34Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getTimeObservationName_34Parser() {
+ if (this.timeObservationName_34Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.timeObservationName_34Parser = parser;
+ }
+ return this.timeObservationName_34Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser timeObservationName_66Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getTimeObservationName_66Parser() {
+ if (this.timeObservationName_66Parser == null) {
+ this.timeObservationName_66Parser = new AppliedStereotypeParser();
+ }
+ return this.timeObservationName_66Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private ConstraintParser durationConstraintSpecification_33Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDurationConstraintSpecification_33Parser() {
+ if (this.durationConstraintSpecification_33Parser == null) {
+ this.durationConstraintSpecification_33Parser = new ConstraintParser();
+ }
+ return this.durationConstraintSpecification_33Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser durationObservationName_35Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDurationObservationName_35Parser() {
+ if (this.durationObservationName_35Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.durationObservationName_35Parser = parser;
+ }
+ return this.durationObservationName_35Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser generalOrderingName_68Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getGeneralOrderingName_68Parser() {
+ if (this.generalOrderingName_68Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.generalOrderingName_68Parser = parser;
+ }
+ return this.generalOrderingName_68Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private TickParser nodeLabel_36Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getNodeLabel_36Parser() {
+ if (this.nodeLabel_36Parser == null) {
+ this.nodeLabel_36Parser = new TickParser();
+ }
+ return this.nodeLabel_36Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser destructionOccurrenceSpecificationName_32Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDestructionOccurrenceSpecificationName_32Parser() {
+ if (this.destructionOccurrenceSpecificationName_32Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.destructionOccurrenceSpecificationName_32Parser = parser;
+ }
+ return this.destructionOccurrenceSpecificationName_32Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser destructionOccurrenceSpecificationName_63Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDestructionOccurrenceSpecificationName_63Parser() {
+ if (this.destructionOccurrenceSpecificationName_63Parser == null) {
+ this.destructionOccurrenceSpecificationName_63Parser = new AppliedStereotypeParser();
+ }
+ return this.destructionOccurrenceSpecificationName_63Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser gateName_70Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getGateName_70Parser() {
+ if (this.gateName_70Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.gateName_70Parser = parser;
+ }
+ return this.gateName_70Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_56Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_56Parser() {
+ if (this.messageName_56Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_56Parser = parser;
+ }
+ return this.messageName_56Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_57Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_57Parser() {
+ if (this.messageLabel_57Parser == null) {
+ this.messageLabel_57Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_57Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_60Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_60Parser() {
+ if (this.messageName_60Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_60Parser = parser;
+ }
+ return this.messageName_60Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_61Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_61Parser() {
+ if (this.messageLabel_61Parser == null) {
+ this.messageLabel_61Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_61Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_42Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_42Parser() {
+ if (this.messageName_42Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_42Parser = parser;
+ }
+ return this.messageName_42Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_43Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_43Parser() {
+ if (this.messageLabel_43Parser == null) {
+ this.messageLabel_43Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_43Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_45Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_45Parser() {
+ if (this.messageName_45Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_45Parser = parser;
+ }
+ return this.messageName_45Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_46Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_46Parser() {
+ if (this.messageLabel_46Parser == null) {
+ this.messageLabel_46Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_46Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_48Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_48Parser() {
+ if (this.messageName_48Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_48Parser = parser;
+ }
+ return this.messageName_48Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_49Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_49Parser() {
+ if (this.messageLabel_49Parser == null) {
+ this.messageLabel_49Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_49Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_51Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_51Parser() {
+ if (this.messageName_51Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_51Parser = parser;
+ }
+ return this.messageName_51Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_52Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_52Parser() {
+ if (this.messageLabel_52Parser == null) {
+ this.messageLabel_52Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_52Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser messageName_54Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageName_54Parser() {
+ if (this.messageName_54Parser == null) {
+ final EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ final MessageFormatParser parser = new MessageFormatParser(features);
+ this.messageName_54Parser = parser;
+ }
+ return this.messageName_54Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser messageLabel_55Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getMessageLabel_55Parser() {
+ if (this.messageLabel_55Parser == null) {
+ this.messageLabel_55Parser = new AppliedStereotypeParser();
+ }
+ return this.messageLabel_55Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser getParser(final int visualID) {
+ switch (visualID) {
+ case InteractionNameEditPart.VISUAL_ID:
+ return getInteractionName_37Parser();
+ case FullLifelineNameEditPart.VISUAL_ID:
+ return getLifelineName_21Parser();
+ case CompactLifelineNameEditPart.VISUAL_ID:
+ return getLifelineName_22Parser();
+ case FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID:
+ return getStateInvariantName_62Parser();
+ case CompactStateInvariantNameEditPart.VISUAL_ID:
+ return getStateInvariantName_31Parser();
+ case StateInvariantAppliedStereotypeEditPart.VISUAL_ID:
+ return getStateInvariantName_64Parser();
+ case OccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ return getOccurrenceSpecificationName_10Parser();
+ case OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return getOccurrenceSpecificationName_58Parser();
+ case MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ return getMessageOccurrenceSpecificationName_14Parser();
+ case MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageOccurrenceSpecificationName_59Parser();
+ case StateDefinitionLabelEditPart.VISUAL_ID:
+ return getNodeLabel_38Parser();
+ case TimeConstraintSpecificationEditPart.VISUAL_ID:
+ return getTimeConstraintSpecification_30Parser();
+ case TimeConstraintAppliedStereotypeEditPart.VISUAL_ID:
+ return getTimeConstraintName_65Parser();
+ case TimeObservationNameEditPart.VISUAL_ID:
+ return getTimeObservationName_34Parser();
+ case TimeObservationAppliedStereotypeEditPart.VISUAL_ID:
+ return getTimeObservationName_66Parser();
+ case DurationConstraintSpecificationEditPart.VISUAL_ID:
+ return getDurationConstraintSpecification_33Parser();
+ case DurationObservationNameEditPart.VISUAL_ID:
+ return getDurationObservationName_35Parser();
+ case GeneralOrderingNameEditPart.VISUAL_ID:
+ return getGeneralOrderingName_68Parser();
+ case TickNameEditPart.VISUAL_ID:
+ return getNodeLabel_36Parser();
+ case DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID:
+ return getDestructionOccurrenceSpecificationName_32Parser();
+ case DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID:
+ return getDestructionOccurrenceSpecificationName_63Parser();
+ case GateLabelEditPart.VISUAL_ID:
+ return getGateName_70Parser();
+ case MessageSyncNameLabelEditPart.VISUAL_ID:
+ return getMessageName_56Parser();
+ case MessageSyncAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_57Parser();
+ case MessageAsyncNameLabelEditPart.VISUAL_ID:
+ return getMessageName_60Parser();
+ case MessageAsyncAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_61Parser();
+ case MessageReplyNameLabelEditPart.VISUAL_ID:
+ return getMessageName_42Parser();
+ case MessageReplyAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_43Parser();
+ case MessageCreateNameLabelEditPart.VISUAL_ID:
+ return getMessageName_45Parser();
+ case MessageCreateAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_46Parser();
+ case MessageDeleteNameLabelEditPart.VISUAL_ID:
+ return getMessageName_48Parser();
+ case MessageDeleteAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_49Parser();
+ case MessageLostNameLabelEditPart.VISUAL_ID:
+ return getMessageName_51Parser();
+ case MessageLostAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_52Parser();
+ case MessageFoundNameLabelEditPart.VISUAL_ID:
+ return getMessageName_54Parser();
+ case MessageFoundAppliedStereotypeEditPart.VISUAL_ID:
+ return getMessageLabel_55Parser();
+ }
+ return null;
+ }
+
+ /**
+ * Utility method that consults ParserService
+ *
+ * @generated
+ */
+ public static IParser getParser(final IElementType type, final EObject object, final String parserHint) {
+ return ParserService.getInstance().getParser(new HintAdapter(type, object, parserHint));
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser(final IAdaptable hint) {
+ final String vid = (String) hint.getAdapter(String.class);
+ if (vid != null) {
+ return getParser(UMLVisualIDRegistry.getVisualID(vid));
+ }
+ final View view = (View) hint.getAdapter(View.class);
+ if (view != null) {
+ return getParser(UMLVisualIDRegistry.getVisualID(view));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(final IOperation operation) {
+ if (operation instanceof GetParserOperation) {
+ final IAdaptable hint = ((GetParserOperation) operation).getHint();
+ if (UMLElementTypes.getElement(hint) == null) {
+ return false;
+ }
+ return getParser(hint) != null;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ private static class HintAdapter extends ParserHintAdapter {
+
+ /**
+ * @generated
+ */
+ private final IElementType elementType;
+
+ /**
+ * @generated
+ */
+ public HintAdapter(final IElementType type, final EObject object, final String parserHint) {
+ super(object, parserHint);
+ assert type != null;
+ this.elementType = type;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getAdapter(final Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return this.elementType;
+ }
+ return super.getAdapter(adapter);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java
new file mode 100644
index 00000000000..b3662c738fa
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import org.eclipse.gef.EditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider implements IDecoratorProvider {
+
+ /**
+ * @generated
+ */
+ @Override
+ public void createDecorators(final IDecoratorTarget decoratorTarget) {
+ final EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
+ if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
+ final Object model = editPart.getModel();
+ if ((model instanceof View)) {
+ final View view = (View) model;
+ if (!(view instanceof Edge) && !view.isSetElement()) {
+ return;
+ }
+ }
+ final EditDomain ed = editPart.getViewer().getEditDomain();
+ if (!(ed instanceof DiagramEditDomain)) {
+ return;
+ }
+ if (((DiagramEditDomain) ed).getEditorPart() instanceof UMLDiagramEditor) {
+ decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean provides(final IOperation operation) {
+ if (!(operation instanceof CreateDecoratorsOperation)) {
+ return false;
+ }
+ final IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
+ final View view = (View) decoratorTarget.getAdapter(View.class);
+ return view != null && TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.java
new file mode 100644
index 00000000000..89bce3b8d85
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.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.providers;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLValidationProvider {
+
+ /**
+ * @generated
+ */
+ private static boolean constraintsActive = false;
+
+ /**
+ * @generated
+ */
+ public static boolean shouldConstraintsBePrivate() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void runWithConstraints(final TransactionalEditingDomain editingDomain, final Runnable operation) {
+ final Runnable op = operation;
+ final Runnable task = new Runnable() {
+ public void run() {
+ try {
+ constraintsActive = true;
+ op.run();
+ } finally {
+ constraintsActive = false;
+ }
+ }
+ };
+ if (editingDomain != null) {
+ try {
+ editingDomain.runExclusive(task);
+ } catch (final Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$
+ }
+ } else {
+ task.run();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static boolean isInDefaultEditorContext(final Object object) {
+ if (shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
+ }
+ if (object instanceof View) {
+ return constraintsActive && TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View) object));
+ }
+ return true;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java
new file mode 100644
index 00000000000..8f2e801f793
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java
@@ -0,0 +1,1453 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.providers;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.FillStyle;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.MeasurementUnit;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+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.CompactLifelineNameEditPart;
+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.DestructionOccurrenceSpecificationAppliedStereotypeEditPart;
+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.DurationConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationNameEditPart;
+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.FullLifelineNameEditPart;
+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.FullStateInvariantAppliedStereotypeEditPart;
+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.GateLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingNameEditPart;
+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.InteractionNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimeRulerCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LinearTimingRulerEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageAsyncNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageCreateNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageDeleteNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationAppliedStereotypeEditPart;
+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.MessageReplyAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageReplyNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageSyncNameLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationAppliedStereotypeEditPart;
+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.StateInvariantAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeRulerCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.FontData;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLViewProvider extends AbstractProvider implements IViewProvider {
+
+ /**
+ * @generated
+ */
+ public final boolean provides(final IOperation operation) {
+ if (operation instanceof CreateViewForKindOperation) {
+ return provides((CreateViewForKindOperation) operation);
+ }
+ assert operation instanceof CreateViewOperation;
+ if (operation instanceof CreateDiagramViewOperation) {
+ return provides((CreateDiagramViewOperation) operation);
+ } else if (operation instanceof CreateEdgeViewOperation) {
+ return provides((CreateEdgeViewOperation) operation);
+ } else if (operation instanceof CreateNodeViewOperation) {
+ return provides((CreateNodeViewOperation) operation);
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean provides(final CreateViewForKindOperation op) {
+ /*
+ * if (op.getViewKind() == Node.class) return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(),
+ * op.getSemanticHint()) != null; if (op.getViewKind() == Edge.class) return
+ * getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
+ */
+
+ // check Diagram Type should be the class diagram
+ final String modelID = UMLVisualIDRegistry.getModelID(op.getContainerView());
+ if (!getDiagramProvidedId().equals(modelID)) {
+ return false;
+ }
+
+ final int visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
+ if (Node.class.isAssignableFrom(op.getViewKind())) {
+ return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
+ }
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDiagramProvidedId() {
+ /*
+ * Indicates for which diagram this provider works for. <p> This method can be overloaded when diagram editor
+ * inherits from another one, but should never be <code>null</code> </p>
+ *
+ * @return the unique identifier of the diagram for which views are provided.
+ */
+ return TimingDiagramEditPart.MODEL_ID;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean provides(final CreateDiagramViewOperation op) {
+ return TimingDiagramEditPart.MODEL_ID.equals(op.getSemanticHint())
+ && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != -1;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean provides(final CreateNodeViewOperation op) {
+ if (op.getContainerView() == null) {
+ return false;
+ }
+ final IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
+ final EObject domainElement = getSemanticElement(op.getSemanticAdapter());
+ int visualID;
+ if (op.getSemanticHint() == null) {
+ // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
+ // In this situation there should be NO elementType, visualID will be determined
+ // by VisualIDRegistry.getNodeVisualID() for domainElement.
+ if (elementType != null || domainElement == null) {
+ return false;
+ }
+ visualID = UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement);
+ } else {
+ visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
+ if (elementType != null) {
+ if (elementType instanceof IExtendedHintedElementType) {
+ final IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
+ if (!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
+ return false; // foreign element type.
+ }
+ } else {
+ if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return false; // foreign element type
+ }
+ }
+ final String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
+ if (!op.getSemanticHint().equals(elementTypeHint)) {
+ return false; // if semantic hint is specified it should be the same as in element type
+ }
+ if (domainElement != null && visualID != UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
+ return false; // visual id for node EClass should match visual id from element type
+ }
+ } else {
+ if (!TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) {
+ return false; // foreign diagram
+ }
+ switch (visualID) {
+ case StateDefinitionEditPart.VISUAL_ID:
+ case FullStateInvariantVerticalLineEditPart.VISUAL_ID:
+ case FreeTimingRulerEditPartCN.VISUAL_ID:
+ case LinearTimingRulerEditPartCN.VISUAL_ID:
+ case TickEditPart.VISUAL_ID:
+ break; // pure design element
+ case InteractionEditPartTN.VISUAL_ID:
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ case TimeConstraintEditPart.VISUAL_ID:
+ case TimeObservationEditPart.VISUAL_ID:
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ case DurationObservationEditPartCN.VISUAL_ID:
+ case GeneralOrderingEditPart.VISUAL_ID:
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ case LifelineEditPart.VISUAL_ID:
+ case GateEditPart.VISUAL_ID:
+ case FullLifelineEditPartCN.VISUAL_ID:
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ if (domainElement == null || visualID != UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
+ return false; // visual id in semantic hint should match visual id for domain element
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+ }
+ return InteractionEditPartTN.VISUAL_ID == visualID || FullLifelineEditPartCN.VISUAL_ID == visualID || CompactLifelineEditPartCN.VISUAL_ID == visualID
+ || FullStateInvariantEditPartCN.VISUAL_ID == visualID || CompactStateInvariantEditPartCN.VISUAL_ID == visualID
+ || OccurrenceSpecificationEditPartCN.VISUAL_ID == visualID || MessageOccurrenceSpecificationEditPartCN.VISUAL_ID == visualID
+ || StateDefinitionEditPart.VISUAL_ID == visualID || FullStateInvariantVerticalLineEditPart.VISUAL_ID == visualID
+ || TimeConstraintEditPart.VISUAL_ID == visualID || TimeObservationEditPart.VISUAL_ID == visualID
+ || DurationConstraintEditPartCN.VISUAL_ID == visualID || DurationObservationEditPartCN.VISUAL_ID == visualID
+ || GeneralOrderingEditPart.VISUAL_ID == visualID || FreeTimingRulerEditPartCN.VISUAL_ID == visualID
+ || LinearTimingRulerEditPartCN.VISUAL_ID == visualID || TickEditPart.VISUAL_ID == visualID
+ || DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID == visualID || LifelineEditPart.VISUAL_ID == visualID
+ || GateEditPart.VISUAL_ID == visualID;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean provides(final CreateEdgeViewOperation op) {
+ final IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
+ // RS: add code for extended types creation
+ if (elementType instanceof IExtendedHintedElementType) {
+ final IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
+ if (!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
+ return false; // foreign element type.
+ }
+ } else {
+ if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return false; // foreign element type
+ }
+ }
+ // if (!org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes.isKnownElementType(elementType) ||
+ // (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
+ // return false; // foreign element type
+ // }
+ // END R.S.
+ final String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
+ if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
+ return false; // our hint is visual id and must be specified, and it should be the same as in element type
+ }
+ final int visualID = UMLVisualIDRegistry.getVisualID(elementTypeHint);
+ final EObject domainElement = getSemanticElement(op.getSemanticAdapter());
+ if (domainElement != null && visualID != UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
+ return false; // visual id for link EClass should match visual id from element type
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public Diagram createDiagram(final IAdaptable semanticAdapter, final String diagramKind, final PreferencesHint preferencesHint) {
+ final Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
+ diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
+ diagram.setType(TimingDiagramEditPart.MODEL_ID);
+ diagram.setElement(getSemanticElement(semanticAdapter));
+ diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
+ return diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode(final IAdaptable semanticAdapter, final View containerView, final String semanticHint, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final EObject domainElement = getSemanticElement(semanticAdapter);
+ final int visualID;
+ if (semanticHint == null) {
+ visualID = UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ } else {
+ visualID = UMLVisualIDRegistry.getVisualID(semanticHint);
+ }
+ switch (visualID) {
+ case InteractionEditPartTN.VISUAL_ID:
+ return createInteraction_2(domainElement, containerView, index, persisted, preferencesHint);
+ case FullLifelineEditPartCN.VISUAL_ID:
+ return createLifeline_19(domainElement, containerView, index, persisted, preferencesHint);
+ case CompactLifelineEditPartCN.VISUAL_ID:
+ return createLifeline_20(domainElement, containerView, index, persisted, preferencesHint);
+ case FullStateInvariantEditPartCN.VISUAL_ID:
+ return createStateInvariant_11(domainElement, containerView, index, persisted, preferencesHint);
+ case CompactStateInvariantEditPartCN.VISUAL_ID:
+ return createStateInvariant_28(domainElement, containerView, index, persisted, preferencesHint);
+ case OccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return createOccurrenceSpecification_12(domainElement, containerView, index, persisted, preferencesHint);
+ case MessageOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return createMessageOccurrenceSpecification_13(domainElement, containerView, index, persisted, preferencesHint);
+ case StateDefinitionEditPart.VISUAL_ID:
+ return createNode_9(domainElement, containerView, index, persisted, preferencesHint);
+ case FullStateInvariantVerticalLineEditPart.VISUAL_ID:
+ return createNode_39(domainElement, containerView, index, persisted, preferencesHint);
+ case TimeConstraintEditPart.VISUAL_ID:
+ return createTimeConstraint_15(domainElement, containerView, index, persisted, preferencesHint);
+ case TimeObservationEditPart.VISUAL_ID:
+ return createTimeObservation_16(domainElement, containerView, index, persisted, preferencesHint);
+ case DurationConstraintEditPartCN.VISUAL_ID:
+ return createDurationConstraint_18(domainElement, containerView, index, persisted, preferencesHint);
+ case DurationObservationEditPartCN.VISUAL_ID:
+ return createDurationObservation_17(domainElement, containerView, index, persisted, preferencesHint);
+ case GeneralOrderingEditPart.VISUAL_ID:
+ return createGeneralOrdering_67(domainElement, containerView, index, persisted, preferencesHint);
+ case FreeTimingRulerEditPartCN.VISUAL_ID:
+ return createNode_24(domainElement, containerView, index, persisted, preferencesHint);
+ case LinearTimingRulerEditPartCN.VISUAL_ID:
+ return createNode_25(domainElement, containerView, index, persisted, preferencesHint);
+ case TickEditPart.VISUAL_ID:
+ return createNode_26(domainElement, containerView, index, persisted, preferencesHint);
+ case DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID:
+ return createDestructionOccurrenceSpecification_27(domainElement, containerView, index, persisted, preferencesHint);
+ case LifelineEditPart.VISUAL_ID:
+ return createLifeline_40(domainElement, containerView, index, persisted, preferencesHint);
+ case GateEditPart.VISUAL_ID:
+ return createGate_69(domainElement, containerView, index, persisted, preferencesHint);
+ }
+ // can't happen, provided #provides(CreateNodeViewOperation) is correct
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createEdge(final IAdaptable semanticAdapter, final View containerView, final String semanticHint, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final IElementType elementType = getSemanticElementType(semanticAdapter);
+ final String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
+ switch (UMLVisualIDRegistry.getVisualID(elementTypeHint)) {
+ case MessageSyncEditPart.VISUAL_ID:
+ return createMessage_3(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case MessageAsyncEditPart.VISUAL_ID:
+ return createMessage_4(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case MessageReplyEditPart.VISUAL_ID:
+ return createMessage_41(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case MessageCreateEditPart.VISUAL_ID:
+ return createMessage_44(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case MessageDeleteEditPart.VISUAL_ID:
+ return createMessage_47(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case MessageLostEditPart.VISUAL_ID:
+ return createMessage_50(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case MessageFoundEditPart.VISUAL_ID:
+ return createMessage_53(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ }
+ // can never happen, provided #provides(CreateEdgeViewOperation) is correct
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createInteraction_2(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(InteractionEditPartTN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Interaction");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Interaction");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Interaction");
+
+ final Node label37 = createLabel(node, UMLVisualIDRegistry.getType(InteractionNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(InteractionCompartmentEditPartTN.VISUAL_ID), false, false, true, true);
+ createCompartment(node, UMLVisualIDRegistry.getType(TimeRulerCompartmentEditPartCN.VISUAL_ID), false, false, true, true);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Interaction");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createLifeline_19(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(FullLifelineEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "FullLifeline");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "FullLifeline");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "FullLifeline");
+
+ final Node label21 = createLabel(node, UMLVisualIDRegistry.getType(FullLifelineNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID), false, false, true, true);
+ createCompartment(node, UMLVisualIDRegistry.getType(FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID), false, false, false, false);
+ createCompartment(node, UMLVisualIDRegistry.getType(FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID), false, false, true, true);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "FullLifeline");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createLifeline_20(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(CompactLifelineEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "CompactLifeline");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "CompactLifeline");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "CompactLifeline");
+
+ final Node label22 = createLabel(node, UMLVisualIDRegistry.getType(CompactLifelineNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(CompactLifelineCompartmentEditPartCN.VISUAL_ID), false, false, false, false);
+ createCompartment(node, UMLVisualIDRegistry.getType(CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID), false, false, true, true);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "CompactLifeline");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createStateInvariant_11(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(FullStateInvariantEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "FullStateInvariant");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "FullStateInvariant");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "FullStateInvariant");
+
+ final Node label62 = createLabel(node, UMLVisualIDRegistry.getType(FullStateInvariantAppliedStereotypeEditPart.VISUAL_ID));
+ label62.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location62 = (Location) label62.getLayoutConstraint();
+ location62.setX(0);
+ location62.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createStateInvariant_28(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(CompactStateInvariantEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "CompactStateInvariant");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "CompactStateInvariant");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "CompactStateInvariant");
+
+ final Node label31 = createLabel(node, UMLVisualIDRegistry.getType(CompactStateInvariantNameEditPart.VISUAL_ID));
+ final Node label64 = createLabel(node, UMLVisualIDRegistry.getType(StateInvariantAppliedStereotypeEditPart.VISUAL_ID));
+ label64.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location64 = (Location) label64.getLayoutConstraint();
+ location64.setX(0);
+ location64.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createOccurrenceSpecification_12(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Node node = NotationFactory.eINSTANCE.createShape();
+ node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
+ node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(OccurrenceSpecificationEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "OccurrenceSpecification");
+
+ final Node label10 = createLabel(node, UMLVisualIDRegistry.getType(OccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ label10.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location10 = (Location) label10.getLayoutConstraint();
+ location10.setX(0);
+ location10.setY(18);
+ final Node label58 = createLabel(node, UMLVisualIDRegistry.getType(OccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID));
+ label58.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location58 = (Location) label58.getLayoutConstraint();
+ location58.setX(0);
+ location58.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createMessageOccurrenceSpecification_13(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(MessageOccurrenceSpecificationEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "MessageOccurrenceSpecification");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "MessageOccurrenceSpecification");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "MessageOccurrenceSpecification");
+
+ final Node label14 = createLabel(node, UMLVisualIDRegistry.getType(MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ label14.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location14 = (Location) label14.getLayoutConstraint();
+ location14.setX(0);
+ location14.setY(18);
+ final Node label59 = createLabel(node, UMLVisualIDRegistry.getType(MessageOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID));
+ label59.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location59 = (Location) label59.getLayoutConstraint();
+ location59.setX(0);
+ location59.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_9(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(StateDefinitionEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "StateDefinition");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "StateDefinition");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "StateDefinition");
+
+ final Node label38 = createLabel(node, UMLVisualIDRegistry.getType(StateDefinitionLabelEditPart.VISUAL_ID));
+ label38.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_39(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(FullStateInvariantVerticalLineEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "VerticalLineStateInvariant");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "VerticalLineStateInvariant");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "VerticalLineStateInvariant");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createTimeConstraint_15(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(TimeConstraintEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "TimeConstraint");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "TimeConstraint");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "TimeConstraint");
+
+ final Node label30 = createLabel(node, UMLVisualIDRegistry.getType(TimeConstraintSpecificationEditPart.VISUAL_ID));
+ label30.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location30 = (Location) label30.getLayoutConstraint();
+ location30.setX(-5);
+ location30.setY(-15);
+ final Node label65 = createLabel(node, UMLVisualIDRegistry.getType(TimeConstraintAppliedStereotypeEditPart.VISUAL_ID));
+ label65.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location65 = (Location) label65.getLayoutConstraint();
+ location65.setX(0);
+ location65.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createTimeObservation_16(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(TimeObservationEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "TimeObservation");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "TimeObservation");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "TimeObservation");
+
+ final Node label34 = createLabel(node, UMLVisualIDRegistry.getType(TimeObservationNameEditPart.VISUAL_ID));
+ label34.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location34 = (Location) label34.getLayoutConstraint();
+ location34.setX(-5);
+ location34.setY(-15);
+ final Node label66 = createLabel(node, UMLVisualIDRegistry.getType(TimeObservationAppliedStereotypeEditPart.VISUAL_ID));
+ label66.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location66 = (Location) label66.getLayoutConstraint();
+ location66.setX(0);
+ location66.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDurationConstraint_18(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DurationConstraintEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "DurationConstraint");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DurationConstraint");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "DurationConstraint");
+
+ final Node label33 = createLabel(node, UMLVisualIDRegistry.getType(DurationConstraintSpecificationEditPart.VISUAL_ID));
+ label33.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location33 = (Location) label33.getLayoutConstraint();
+ location33.setX(0);
+ location33.setY(15);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDurationObservation_17(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DurationObservationEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "DurationObservation");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DurationObservation");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "DurationObservation");
+
+ final Node label35 = createLabel(node, UMLVisualIDRegistry.getType(DurationObservationNameEditPart.VISUAL_ID));
+ label35.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location35 = (Location) label35.getLayoutConstraint();
+ location35.setX(0);
+ location35.setY(15);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createGeneralOrdering_67(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(GeneralOrderingEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "GeneralOrdering");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "GeneralOrdering");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "GeneralOrdering");
+
+ final Node label68 = createLabel(node, UMLVisualIDRegistry.getType(GeneralOrderingNameEditPart.VISUAL_ID));
+ label68.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location68 = (Location) label68.getLayoutConstraint();
+ location68.setX(-5);
+ location68.setY(-15);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_24(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(FreeTimingRulerEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "FreeTimingRuler");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "FreeTimingRuler");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "FreeTimingRuler");
+
+ createCompartment(node, UMLVisualIDRegistry.getType(FreeTimeRulerCompartmentEditPart.VISUAL_ID), false, false, false, false);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "FreeTimingRuler");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_25(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(LinearTimingRulerEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "LinearTimingRuler");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "LinearTimingRuler");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "LinearTimingRuler");
+
+ createCompartment(node, UMLVisualIDRegistry.getType(LinearTimeRulerCompartmentEditPart.VISUAL_ID), false, false, false, false);
+
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "LinearTimingRuler");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_26(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(TickEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Tick");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Tick");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Tick");
+
+ final Node label36 = createLabel(node, UMLVisualIDRegistry.getType(TickNameEditPart.VISUAL_ID));
+ label36.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
+ label36.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location36 = (Location) label36.getLayoutConstraint();
+ location36.setX(0);
+ location36.setY(12);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDestructionOccurrenceSpecification_27(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "DestructionOccurrenceSpecification");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DestructionOccurrenceSpecification");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "DestructionOccurrenceSpecification");
+
+ final Node label32 = createLabel(node, UMLVisualIDRegistry.getType(DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ label32.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location32 = (Location) label32.getLayoutConstraint();
+ location32.setX(0);
+ location32.setY(18);
+ final Node label63 = createLabel(node, UMLVisualIDRegistry.getType(DestructionOccurrenceSpecificationAppliedStereotypeEditPart.VISUAL_ID));
+ label63.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location63 = (Location) label63.getLayoutConstraint();
+ location63.setX(0);
+ location63.setY(5);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createLifeline_40(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(LifelineEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Lifeline");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Lifeline");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Lifeline");
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createGate_69(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(GateEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Gate");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Gate");
+
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Gate");
+
+ final Node label70 = createLabel(node, UMLVisualIDRegistry.getType(GateLabelEditPart.VISUAL_ID));
+ label70.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+
+ final Location location70 = (Location) label70.getLayoutConstraint();
+ location70.setX(20);
+ location70.setY(0);
+
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_3(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageSyncEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageSync");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageSync");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageSync");
+
+ final Node label56 = createLabel(edge, UMLVisualIDRegistry.getType(MessageSyncNameLabelEditPart.VISUAL_ID));
+ label56.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location56 = (Location) label56.getLayoutConstraint();
+ location56.setX(0);
+ location56.setY(-10);
+ final Node label57 = createLabel(edge, UMLVisualIDRegistry.getType(MessageSyncAppliedStereotypeEditPart.VISUAL_ID));
+ label57.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location57 = (Location) label57.getLayoutConstraint();
+ location57.setX(0);
+ location57.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_4(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageAsyncEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageAsync");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageAsync");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageAsync");
+
+ final Node label60 = createLabel(edge, UMLVisualIDRegistry.getType(MessageAsyncNameLabelEditPart.VISUAL_ID));
+ label60.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location60 = (Location) label60.getLayoutConstraint();
+ location60.setX(0);
+ location60.setY(-10);
+ final Node label61 = createLabel(edge, UMLVisualIDRegistry.getType(MessageAsyncAppliedStereotypeEditPart.VISUAL_ID));
+ label61.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location61 = (Location) label61.getLayoutConstraint();
+ location61.setX(0);
+ location61.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_41(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageReplyEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageReply");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageReply");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageReply");
+
+ final Node label42 = createLabel(edge, UMLVisualIDRegistry.getType(MessageReplyNameLabelEditPart.VISUAL_ID));
+ label42.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location42 = (Location) label42.getLayoutConstraint();
+ location42.setX(0);
+ location42.setY(-10);
+ final Node label43 = createLabel(edge, UMLVisualIDRegistry.getType(MessageReplyAppliedStereotypeEditPart.VISUAL_ID));
+ label43.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location43 = (Location) label43.getLayoutConstraint();
+ location43.setX(0);
+ location43.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_44(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageCreateEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageCreate");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageCreate");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageCreate");
+
+ final Node label45 = createLabel(edge, UMLVisualIDRegistry.getType(MessageCreateNameLabelEditPart.VISUAL_ID));
+ label45.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location45 = (Location) label45.getLayoutConstraint();
+ location45.setX(0);
+ location45.setY(-10);
+ final Node label46 = createLabel(edge, UMLVisualIDRegistry.getType(MessageCreateAppliedStereotypeEditPart.VISUAL_ID));
+ label46.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location46 = (Location) label46.getLayoutConstraint();
+ location46.setX(0);
+ location46.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_47(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageDeleteEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageDelete");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageDelete");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageDelete");
+
+ final Node label48 = createLabel(edge, UMLVisualIDRegistry.getType(MessageDeleteNameLabelEditPart.VISUAL_ID));
+ label48.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location48 = (Location) label48.getLayoutConstraint();
+ location48.setX(0);
+ location48.setY(-10);
+ final Node label49 = createLabel(edge, UMLVisualIDRegistry.getType(MessageDeleteAppliedStereotypeEditPart.VISUAL_ID));
+ label49.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location49 = (Location) label49.getLayoutConstraint();
+ location49.setX(0);
+ location49.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_50(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageLostEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageLost");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageLost");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageLost");
+
+ final Node label51 = createLabel(edge, UMLVisualIDRegistry.getType(MessageLostNameLabelEditPart.VISUAL_ID));
+ label51.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location51 = (Location) label51.getLayoutConstraint();
+ location51.setX(0);
+ location51.setY(-10);
+ final Node label52 = createLabel(edge, UMLVisualIDRegistry.getType(MessageLostAppliedStereotypeEditPart.VISUAL_ID));
+ label52.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location52 = (Location) label52.getLayoutConstraint();
+ location52.setX(0);
+ location52.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createMessage_53(final EObject domainElement, final View containerView, final int index, final boolean persisted,
+ final PreferencesHint preferencesHint) {
+ final Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ final RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ final ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ points.add(new RelativeBendpoint());
+ points.add(new RelativeBendpoint());
+ bendpoints.setPoints(points);
+ edge.setBendpoints(bendpoints);
+ ViewUtil.insertChildView(containerView, edge, index, persisted);
+ edge.setType(UMLVisualIDRegistry.getType(MessageFoundEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "MessageFound");
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "MessageFound");
+
+ // org.eclipse.gmf.runtime.notation.Routing routing =
+ // org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ // if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge,
+ // org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ // }
+
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "MessageFound");
+
+ final Node label54 = createLabel(edge, UMLVisualIDRegistry.getType(MessageFoundNameLabelEditPart.VISUAL_ID));
+ label54.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location54 = (Location) label54.getLayoutConstraint();
+ location54.setX(0);
+ location54.setY(-10);
+ final Node label55 = createLabel(edge, UMLVisualIDRegistry.getType(MessageFoundAppliedStereotypeEditPart.VISUAL_ID));
+ label55.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ final Location location55 = (Location) label55.getLayoutConstraint();
+ location55.setX(0);
+ location55.setY(-30);
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ protected void stampShortcut(final View containerView, final Node target) {
+ if (!TimingDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ final EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", TimingDiagramEditPart.MODEL_ID); //$NON-NLS-1$
+ target.getEAnnotations().add(shortcutAnnotation);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Node createLabel(final View owner, final String hint) {
+ final DecorationNode rv = NotationFactory.eINSTANCE.createDecorationNode();
+ rv.setType(hint);
+ ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
+ return rv;
+ }
+
+ /**
+ * @generated
+ */
+ protected Node createCompartment(final View owner, final String hint, final boolean canCollapse, final boolean hasTitle, final boolean canSort,
+ final boolean canFilter) {
+ // SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
+ // rv.setShowTitle(showTitle);
+ // rv.setCollapsed(isCollapsed);
+ Node rv;
+ if (canCollapse) {
+ rv = NotationFactory.eINSTANCE.createBasicCompartment();
+ } else {
+ rv = NotationFactory.eINSTANCE.createDecorationNode();
+ }
+ rv.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+
+ if (hasTitle) {
+ final TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
+ ts.setShowTitle(true);
+ rv.getStyles().add(ts);
+ }
+ if (canSort) {
+ rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle());
+ }
+ if (canFilter) {
+ rv.getStyles().add(NotationFactory.eINSTANCE.createFilteringStyle());
+ }
+ rv.setType(hint);
+ ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
+ return rv;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSemanticElement(final IAdaptable semanticAdapter) {
+ if (semanticAdapter == null) {
+ return null;
+ }
+ final EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IElementType getSemanticElementType(final IAdaptable semanticAdapter) {
+ if (semanticAdapter == null) {
+ return null;
+ }
+ return (IElementType) semanticAdapter.getAdapter(IElementType.class);
+ }
+
+ /**
+ * @generated
+ */
+ private void initFontStyleFromPrefs(final View view, final IPreferenceStore store, final String elementName) {
+ final String fontConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.FONT);
+ final String fontColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_FONT);
+
+ final FontStyle viewFontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE);
+ if (viewFontStyle != null) {
+ final FontData fontData = PreferenceConverter.getFontData(store, fontConstant);
+ viewFontStyle.setFontName(fontData.getName());
+ viewFontStyle.setFontHeight(fontData.getHeight());
+ viewFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
+ viewFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
+
+ final org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(store, fontColorConstant);
+ viewFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void initForegroundFromPrefs(final View view, final IPreferenceStore store, final String elementName) {
+ final String lineColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_LINE);
+ final org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
+ ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
+ }
+
+ /**
+ * @generated
+ */
+ private void initBackgroundFromPrefs(final View view, final IPreferenceStore store, final String elementName) {
+ final String fillColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_FILL);
+ final String gradientColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_GRADIENT);
+ final String gradientPolicyConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.GRADIENT_POLICY);
+
+ final org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant);
+ ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
+
+ final FillStyle fillStyle = (FillStyle) view.getStyle(NotationPackage.Literals.FILL_STYLE);
+ fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
+
+ ;
+ if (store.getBoolean(gradientPolicyConstant)) {
+ final GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(gradientColorConstant));
+ fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
+ fillStyle.setTransparency(gradientPreferenceConverter.getTransparency());
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.java
new file mode 100644
index 00000000000..b82e6a332a5
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.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.sheet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLPropertySection extends AdvancedPropertySection implements IPropertySourceProvider {
+
+ /**
+ * @generated
+ */
+ public IPropertySource getPropertySource(final Object object) {
+ if (object instanceof IPropertySource) {
+ return (IPropertySource) object;
+ }
+ final AdapterFactory af = getAdapterFactory(object);
+ if (af != null) {
+ final IItemPropertySource ips = (IItemPropertySource) af.adapt(object, IItemPropertySource.class);
+ if (ips != null) {
+ return new PropertySource(object, ips);
+ }
+ }
+ if (object instanceof IAdaptable) {
+ return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IPropertySourceProvider getPropertySourceProvider() {
+ return this;
+ }
+
+ /**
+ * Modify/unwrap selection.
+ *
+ * @generated
+ */
+ protected Object transformSelection(final Object selected) {
+
+ if (selected instanceof EditPart) {
+ final Object model = ((EditPart) selected).getModel();
+ return model instanceof View ? ((View) model).getElement() : null;
+ }
+ if (selected instanceof View) {
+ return ((View) selected).getElement();
+ }
+ if (selected instanceof IAdaptable) {
+ final View view = (View) ((IAdaptable) selected).getAdapter(View.class);
+ if (view != null) {
+ return view.getElement();
+ }
+ }
+ return selected;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setInput(final IWorkbenchPart part, final ISelection selection) {
+ if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
+ super.setInput(part, selection);
+ return;
+ }
+ final StructuredSelection structuredSelection = ((StructuredSelection) selection);
+ final ArrayList transformedSelection = new ArrayList(structuredSelection.size());
+ for (final Iterator it = structuredSelection.iterator(); it.hasNext();) {
+ final Object r = transformSelection(it.next());
+ if (r != null) {
+ transformedSelection.add(r);
+ }
+ }
+ super.setInput(part, new StructuredSelection(transformedSelection));
+ }
+
+ /**
+ * @generated
+ */
+ protected AdapterFactory getAdapterFactory(final Object object) {
+ if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
+ return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
+ }
+ final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
+ if (editingDomain != null) {
+ return ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java
new file mode 100644
index 00000000000..e82a124d495
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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.sheet;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.uml.diagram.timing.navigator.UMLNavigatorGroup;
+import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("all")
+// disable warnings on generated code
+public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelProvider {
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ element = unwrap(element);
+ if (element instanceof UMLNavigatorGroup) {
+ return ((UMLNavigatorGroup) element).getGroupName();
+ }
+ final IElementType etype = getElementType(getView(element));
+ return etype == null ? "" : etype.getDisplayName();
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(final Object element) {
+ final IElementType etype = getElementType(getView(unwrap(element)));
+ return etype == null ? null : UMLElementTypes.getImage(etype);
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrap(final Object element) {
+ if (element instanceof IStructuredSelection) {
+ return ((IStructuredSelection) element).getFirstElement();
+ }
+ return element;
+ }
+
+ /**
+ * @generated
+ */
+ private View getView(final Object element) {
+ if (element instanceof View) {
+ return (View) element;
+ }
+ if (element instanceof IAdaptable) {
+ return (View) ((IAdaptable) element).getAdapter(View.class);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private IElementType getElementType(View view) {
+ // For intermediate views climb up the containment hierarchy to find the one associated with an element type.
+ while (view != null) {
+ final int vid = UMLVisualIDRegistry.getVisualID(view);
+ final IElementType etype = UMLElementTypes.getElementType(vid);
+ if (etype != null) {
+ return etype;
+ }
+ view = view.eContainer() instanceof View ? (View) view.eContainer() : null;
+ }
+ return null;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/timing_diagram_theme.css b/incoming/org.eclipse.papyrus.uml.diagram.timing/timing_diagram_theme.css
new file mode 100644
index 00000000000..a359fb57121
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/timing_diagram_theme.css
@@ -0,0 +1,31 @@
+/* /org.eclipse.papyrus.infra.gmfdiag.css/resources/base.css */
+PapyrusUMLTimingDiagram * {
+ gradient:none;
+}
+
+
+/* /org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css */
+PapyrusUMLTimingDiagram OccurrenceSpecification,MessageOccurrenceSpecification {
+ fillColor: #006000;
+ lineColor: #006000;
+}
+
+PapyrusUMLTimingDiagram Lifeline {
+ gradient: white vertical;
+}
+
+PapyrusUMLTimingDiagram StateInvariant {
+ lineColor: black;
+ fillColor: #9BC7CC;
+ gradient: white vertical;
+}
+
+PapyrusUMLTimingDiagram Interaction {
+ fillColor: #9BC7CC;
+ gradient: none;
+}
+
+PapyrusUMLTimingDiagram Gate {
+ fillColor: #2A52BE;
+ lineColor: #2A52BE;
+}

Back to the top