Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java166
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java166
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java166
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java160
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java160
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java166
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java166
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactLifelineEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactStateInvariantEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DestructionOccurrenceSpecificationEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationConstraintEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationObservationEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullLifelineEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullStateInvariantEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GateEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GeneralOrderingEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/InteractionEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/LifelineEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageAsyncEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageCreateEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageDeleteEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageFoundEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageLostEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageOccurrenceSpecificationEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageReplyEditHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageSyncEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/OccurrenceSpecificationEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/PackageEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeConstraintEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeObservationEditHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/UMLBaseEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java134
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java456
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java796
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.java135
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java447
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java793
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java538
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java354
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java354
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java310
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java474
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java796
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java140
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.java135
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java134
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java386
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java243
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java533
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java354
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java142
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java481
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java793
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java323
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java124
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java310
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java566
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java752
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java392
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java324
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java793
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java287
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java781
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java364
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java776
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java364
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java780
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.java135
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java119
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java333
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java120
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java247
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java120
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java247
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java189
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java247
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java156
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java101
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java491
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java242
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java225
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java191
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java68
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java227
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java118
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java104
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java182
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java343
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.java109
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java96
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java178
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java112
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java429
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java202
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DeleteElementAction.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.java60
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/Messages.java529
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java153
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java168
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java95
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java60
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java434
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java537
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java331
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java375
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java88
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java1648
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java1007
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java96
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.java36
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java177
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java398
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java901
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java263
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactStateInvariantPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DestructionOccurrenceSpecificationPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramAppearancePreferencePage.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramConnectionsPreferencePage.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramGeneralPreferencePage.java30
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPreferenceInitializer.java91
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPrintingPreferencePage.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramRulersAndGridPreferencePage.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationConstraintPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationObservationPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java128
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullStateInvariantPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GatePreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GeneralOrderingPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LifelinePreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageAsyncPreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageCreatePreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageDeletePreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageFoundPreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageLostPreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageOccurrenceSpecificationPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageReplyPreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageSyncPreferencePage.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/OccurrenceSpecificationPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/StateDefinitionPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TickPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeConstraintPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeObservationPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/VerticalLineStateInvariantPreferencePage.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.java34
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java153
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java490
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java92
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java469
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java800
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.java76
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java1413
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.java122
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java88
243 files changed, 64239 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java
new file mode 100644
index 00000000000..aac5ef9e2f3
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java
new file mode 100644
index 00000000000..169baf0cdf8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java
new file mode 100644
index 00000000000..291358df10b
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java
new file mode 100644
index 00000000000..1fe8cf4db15
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java
new file mode 100644
index 00000000000..60f38663826
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java
new file mode 100644
index 00000000000..f78653354c1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java
new file mode 100644
index 00000000000..826afe40125
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java
new file mode 100644
index 00000000000..05e166feb32
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java
new file mode 100644
index 00000000000..c6687a706c4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java
new file mode 100644
index 00000000000..53d109e7c8d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java
new file mode 100644
index 00000000000..a159897c518
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java
new file mode 100644
index 00000000000..78589b26a75
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java
new file mode 100644
index 00000000000..86356c91650
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java
new file mode 100644
index 00000000000..3d2fa0b3873
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java
new file mode 100644
index 00000000000..094de7eaf39
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java
new file mode 100644
index 00000000000..f12ba33fe1c
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java
new file mode 100644
index 00000000000..c9aa11253db
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java
new file mode 100644
index 00000000000..cf7fbd5ef33
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java
new file mode 100644
index 00000000000..7addc368ffc
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java
new file mode 100644
index 00000000000..21f904f6631
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java
new file mode 100644
index 00000000000..5e189028828
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java
new file mode 100644
index 00000000000..eef4db153e6
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java
new file mode 100644
index 00000000000..105df89b331
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java
new file mode 100644
index 00000000000..5d46893aa93
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java
new file mode 100644
index 00000000000..53a3e14e881
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java
new file mode 100644
index 00000000000..0b540068711
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java
new file mode 100644
index 00000000000..f195ed5984c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java
new file mode 100644
index 00000000000..ea4deda222b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java
new file mode 100644
index 00000000000..ccfa5cf2276
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactLifelineEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/CompactStateInvariantEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DestructionOccurrenceSpecificationEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationConstraintEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/DurationObservationEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullLifelineEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/FullStateInvariantEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GateEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/GeneralOrderingEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/InteractionEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/LifelineEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageAsyncEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageCreateEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageDeleteEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageFoundEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageLostEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageOccurrenceSpecificationEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageReplyEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/MessageSyncEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/OccurrenceSpecificationEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/PackageEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeConstraintEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/TimeObservationEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/helpers/UMLBaseEditHelper.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.java
new file mode 100644
index 00000000000..380f2a66060
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineCompartmentEditPartCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java
new file mode 100644
index 00000000000..aaa107537e6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineEditPartCN.java
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java
new file mode 100644
index 00000000000..3a767d70dc1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineNameEditPart.java
@@ -0,0 +1,796 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.java
new file mode 100644
index 00000000000..e206c5479b9
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactLifelineTimeRulerCompartmentEditPartCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java
new file mode 100644
index 00000000000..119d6556fc1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantEditPartCN.java
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.java
new file mode 100644
index 00000000000..5ea2c43cc59
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/CompactStateInvariantNameEditPart.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..d1f78760cdd
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java
new file mode 100644
index 00000000000..250f70984cc
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java
new file mode 100644
index 00000000000..26d847683c9
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DestructionOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java
new file mode 100644
index 00000000000..c978446903f
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintEditPartCN.java
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java
new file mode 100644
index 00000000000..6050e4d3c35
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationConstraintSpecificationEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java
new file mode 100644
index 00000000000..1a6f626bc2b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationEditPartCN.java
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java
new file mode 100644
index 00000000000..3a00444bad1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/DurationObservationNameEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.java
new file mode 100644
index 00000000000..f0e6d8825a1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimeRulerCompartmentEditPart.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java
new file mode 100644
index 00000000000..f63d2b6a620
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FreeTimingRulerEditPartCN.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java
new file mode 100644
index 00000000000..a6d0f80501f
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineEditPartCN.java
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java
new file mode 100644
index 00000000000..117b4975eab
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineNameEditPart.java
@@ -0,0 +1,796 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java
new file mode 100644
index 00000000000..3cbd77c44cc
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineStateDefinitionCompartmentEditPartCN.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.java
new file mode 100644
index 00000000000..2d0baf05dda
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimeRulerCompartmentEditPartCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.java
new file mode 100644
index 00000000000..552b52e3557
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullLifelineTimelineCompartmentEditPartCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..bad1413d7d7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java
new file mode 100644
index 00000000000..a0f6e38d3a2
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantEditPartCN.java
@@ -0,0 +1,386 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java
new file mode 100644
index 00000000000..85f3e3eabff
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/FullStateInvariantVerticalLineEditPart.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java
new file mode 100644
index 00000000000..910b733bd49
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateEditPart.java
@@ -0,0 +1,533 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java
new file mode 100644
index 00000000000..f7705f66311
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GateLabelEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java
new file mode 100644
index 00000000000..db2e3eaa388
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingEditPart.java
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java
new file mode 100644
index 00000000000..4ad53f8750d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/GeneralOrderingNameEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java
new file mode 100644
index 00000000000..d0f7d1ce8d7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionCompartmentEditPartTN.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java
new file mode 100644
index 00000000000..d0bbaceeff2
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionEditPartTN.java
@@ -0,0 +1,481 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.java
new file mode 100644
index 00000000000..670ba00214d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/InteractionNameEditPart.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java
new file mode 100644
index 00000000000..b0884b89d32
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LifelineEditPart.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java
new file mode 100644
index 00000000000..52dd282d6f6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimeRulerCompartmentEditPart.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java
new file mode 100644
index 00000000000..ba88049158a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/LinearTimingRulerEditPartCN.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..3dcd764551d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncEditPart.java
new file mode 100644
index 00000000000..b760a38caf3
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java
new file mode 100644
index 00000000000..a6d06266dbb
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageAsyncNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..ef407137681
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateEditPart.java
new file mode 100644
index 00000000000..57671d9be8a
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java
new file mode 100644
index 00000000000..39f8aad3be8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageCreateNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..74136cd827c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteEditPart.java
new file mode 100644
index 00000000000..f011523b2d0
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java
new file mode 100644
index 00000000000..d8955fb936c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageDeleteNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..57dc9c67c3d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundEditPart.java
new file mode 100644
index 00000000000..61242d7af24
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java
new file mode 100644
index 00000000000..31cf8482b5b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageFoundNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..2a03a1da53b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostEditPart.java
new file mode 100644
index 00000000000..6d0ba801a61
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java
new file mode 100644
index 00000000000..1ac14dccabd
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageLostNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..c1d30c503d4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java
new file mode 100644
index 00000000000..34155f232b8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,566 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java
new file mode 100644
index 00000000000..d5b15567495
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageOccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..149b9ba7e8d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyEditPart.java
new file mode 100644
index 00000000000..8f4a54dcefe
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java
new file mode 100644
index 00000000000..051d4a0615a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageReplyNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..c599bc278db
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncAppliedStereotypeEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncEditPart.java
new file mode 100644
index 00000000000..dc72189661c
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java
new file mode 100644
index 00000000000..d06ac90811e
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/MessageSyncNameLabelEditPart.java
@@ -0,0 +1,752 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..dc8d1916438
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java
new file mode 100644
index 00000000000..00e042a8369
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationEditPartCN.java
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java
new file mode 100644
index 00000000000..dc057d8f73e
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/OccurrenceSpecificationLabelEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java
new file mode 100644
index 00000000000..94ef6867f3d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionEditPart.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.java
new file mode 100644
index 00000000000..272244841c1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateDefinitionLabelEditPart.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..ca81cc874d6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/StateInvariantAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java
new file mode 100644
index 00000000000..13cbe3b5827
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickEditPart.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java
new file mode 100644
index 00000000000..51c8b1828d6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TickNameEditPart.java
@@ -0,0 +1,781 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..9d61a1ec130
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java
new file mode 100644
index 00000000000..ab72cff4639
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintEditPart.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java
new file mode 100644
index 00000000000..12b9d8b02f3
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeConstraintSpecificationEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java
new file mode 100644
index 00000000000..78aeb830693
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationAppliedStereotypeEditPart.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java
new file mode 100644
index 00000000000..b48778e1d82
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationEditPart.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java
new file mode 100644
index 00000000000..3dfadb276e5
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeObservationNameEditPart.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.java
new file mode 100644
index 00000000000..15bc2ad0239
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimeRulerCompartmentEditPartCN.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/TimingDiagramEditPart.java
new file mode 100644
index 00000000000..b4911a5bafc
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/parts/UMLEditPartFactory.java
new file mode 100644
index 00000000000..fa3463a57eb
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..b591034abdd
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..35430e90f2d
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..75528f51e37
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..34cf94b472e
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..54131bcc319
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..d1b48b72954
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..93cca0e6d66
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..fdbdd05ba22
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..340edfbf3fa
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..71294a04fc9
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..8ea077efd8f
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..19b2c6a2450
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..e190f061e29
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..ed3cbe1fc87
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java
new file mode 100644
index 00000000000..69ab0662cdd
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java
new file mode 100644
index 00000000000..8cac636666b
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..7ae3dc0af57
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..c21cdaac003
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..045509d391d
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..aa34ce1db35
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..545da71153f
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..2db6c1a129c
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..b208e5ef77d
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..dd1493ea725
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..dd20f687f39
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..96f23dfc1ca
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..6a780ca14b0
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..1efd5463cc4
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java
new file mode 100644
index 00000000000..ca41ca53b9d
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..82de5aedcc9
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
new file mode 100644
index 00000000000..0387a764619
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -0,0 +1,491 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java
new file mode 100644
index 00000000000..80bcd5386fd
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java
new file mode 100644
index 00000000000..d9f06ea32da
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLAbstractExpression.java
new file mode 100644
index 00000000000..0d67c6d3063
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java
new file mode 100644
index 00000000000..bd759342d51
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/expressions/UMLOCLFactory.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLAbstractNavigatorItem.java
new file mode 100644
index 00000000000..40f66600eaf
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java
new file mode 100644
index 00000000000..b336e49a39c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorContentProvider.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java
new file mode 100644
index 00000000000..3c08d4c9de5
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorItem.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java
new file mode 100644
index 00000000000..8ff35982b21
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLDomainNavigatorLabelProvider.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorActionProvider.java
new file mode 100644
index 00000000000..d805c725ca8
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java
new file mode 100644
index 00000000000..77446650baa
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorContentProvider.java
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorGroup.java
new file mode 100644
index 00000000000..01757b8c8d8
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.java
new file mode 100644
index 00000000000..79705b4d902
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorItem.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLabelProvider.java
new file mode 100644
index 00000000000..55a26764237
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorLinkHelper.java
new file mode 100644
index 00000000000..643f12dffb1
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/navigator/UMLNavigatorSorter.java
new file mode 100644
index 00000000000..00d4ba9088e
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/AbstractParser.java
new file mode 100644
index 00000000000..b99dd70ab66
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java
new file mode 100644
index 00000000000..825b09be2f1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/parsers/MessageFormatParser.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DeleteElementAction.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.java
new file mode 100644
index 00000000000..2ba57767ce9
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/DiagramEditorContextMenuProvider.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/Messages.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.java
new file mode 100644
index 00000000000..044dbd55763
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ModelElementSelectionPage.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java
new file mode 100644
index 00000000000..0a8c06f612b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizard.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLCreationWizardPage.java
new file mode 100644
index 00000000000..558ffbe104b
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramActionBarContributor.java
new file mode 100644
index 00000000000..e0add97e1a6
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java
new file mode 100644
index 00000000000..8c83aeddae4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramContentInitializer.java
@@ -0,0 +1,434 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java
new file mode 100644
index 00000000000..4f951c6ebe7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java
@@ -0,0 +1,537 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorPlugin.java
new file mode 100644
index 00000000000..6dc8ff78cdd
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java
new file mode 100644
index 00000000000..a4d7cf04dc3
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditorUtil.java
@@ -0,0 +1,375 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdateCommand.java
new file mode 100644
index 00000000000..659674f559a
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java
new file mode 100644
index 00000000000..c1906018dad
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramUpdater.java
@@ -0,0 +1,1648 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java
new file mode 100644
index 00000000000..3fdc9436d35
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDocumentProvider.java
@@ -0,0 +1,1007 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLInitDiagramFileAction.java
new file mode 100644
index 00000000000..6f300b56903
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.java
new file mode 100644
index 00000000000..0b5697510e7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLLinkDescriptor.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLMatchingStrategy.java
new file mode 100644
index 00000000000..a2c31c88016
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.java
new file mode 100644
index 00000000000..153b9c8eb41
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNewDiagramFileWizard.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.java
new file mode 100644
index 00000000000..688f9fd9e93
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLNodeDescriptor.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java
new file mode 100644
index 00000000000..54ffdd551c8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLPaletteFactory.java
@@ -0,0 +1,398 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLUriEditorInputTester.java
new file mode 100644
index 00000000000..54eb2c5fcf9
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java
new file mode 100644
index 00000000000..dabf088973a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java
@@ -0,0 +1,901 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java
new file mode 100644
index 00000000000..7afec5b03ca
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/ValidateAction.java
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactLifelinePreferencePage.java
new file mode 100644
index 00000000000..03978bd3db8
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/CompactStateInvariantPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DestructionOccurrenceSpecificationPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramAppearancePreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramConnectionsPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramGeneralPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPreferenceInitializer.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramPrintingPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DiagramRulersAndGridPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationConstraintPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/DurationObservationPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FreeTimingRulerPreferencePage.java
new file mode 100644
index 00000000000..06e1c96389a
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullLifelinePreferencePage.java
new file mode 100644
index 00000000000..ddebd699779
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/FullStateInvariantPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GatePreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/GeneralOrderingPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/InteractionPreferencePage.java
new file mode 100644
index 00000000000..33bb500f43f
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LifelinePreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/LinearTimingRulerPreferencePage.java
new file mode 100644
index 00000000000..b52faf23840
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageAsyncPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageCreatePreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageDeletePreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageFoundPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageLostPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageOccurrenceSpecificationPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageReplyPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/MessageSyncPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/OccurrenceSpecificationPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/StateDefinitionPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TickPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeConstraintPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/TimeObservationPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/preferences/VerticalLineStateInvariantPreferencePage.java b/plugins/uml/diagram/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/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/ElementInitializers.java
new file mode 100644
index 00000000000..b4842b3bf40
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLEditPartProvider.java
new file mode 100644
index 00000000000..4c3140ef1ed
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java
new file mode 100644
index 00000000000..2f64d77c2c3
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLElementTypes.java
@@ -0,0 +1,490 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLIconProvider.java
new file mode 100644
index 00000000000..4690f4eb08b
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLMarkerNavigationProvider.java
new file mode 100644
index 00000000000..4c635c4ec15
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLModelingAssistantProvider.java
new file mode 100644
index 00000000000..4d0a171c0fb
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLParserProvider.java
new file mode 100644
index 00000000000..47e1ed38c74
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationDecoratorProvider.java
new file mode 100644
index 00000000000..47470375a12
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.java
new file mode 100644
index 00000000000..fbf48b43686
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLValidationProvider.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.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java
new file mode 100644
index 00000000000..ea40727ec7c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/providers/UMLViewProvider.java
@@ -0,0 +1,1413 @@
+/*
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLPropertySection.java
new file mode 100644
index 00000000000..e3eb98a2c33
--- /dev/null
+++ b/plugins/uml/diagram/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/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/sheet/UMLSheetLabelProvider.java
new file mode 100644
index 00000000000..221ebd0d166
--- /dev/null
+++ b/plugins/uml/diagram/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;
+ }
+
+}

Back to the top